' PROGRAM IN VISUAL BASIC TO PARSE FASTA FILE IN
' PROGRAM IN VISUAL BASIC TO PARSE FASTA FILE IN
' EXCEL EMBEDDED FORMAT
Sub Parse_Fasta()
'
' Macro for Excel sheet
'
' To parse FASTA file from NCBI to different fields
'
' Macro recorded 10/6/2006 by Anguraj Sadanandam
'
' Make sure you rename your worksheet containing
' FASTA files
'
'Activating the worksheet
Worksheets("sheet1").Activate
'Declaration of variables
Dim b As String
Dim c As String
Dim i As Integer
Dim j As Integer
i = 1
j = 1
' CHANGE THE NUMBER 200 DEPENDING ON THE NUMBER OF ROWS
' IN YOUR FASTA FILE IN SHEET1
For i = 1 To 200 Step 1
' Reading data from sheet1
b = Worksheets("sheet1").Cells(i, 1)
'Checks for FASTA format
If b ">sp" Then
'If the row has no ">sp", then it has sequence
'Concatenate the sequence information for each entry
c = c & b
'Copying to Sheet1 as a field
Worksheets("sheet2").Cells(j - 1, 4) = c
'MsgBox Worksheets("sheet1").Cells(i, 2)
'Worksheets("sheet3").Cells(j, 1) = Worksheets("sheet1").Cells(i - 1, 2)
'Worksheets("sheet3").Cells(j, 2) = Worksheets("sheet1").Cells(i - 1, 3)
'If the row has ">sp" then it has the information for the sequence
ElseIf b = ">sp" Then
'Copying other information to sheet1
Worksheets("sheet2").Cells(j, 1) = Worksheets("sheet1").Cells(i, 2)
Worksheets("sheet2").Cells(j, 2) = Worksheets("sheet1").Cells(i, 3)
Worksheets("sheet2").Cells(j, 3) = Worksheets("sheet1").Cells(i, 4)
c = ""
j = j + 1
End If
Next i
End Sub
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related searches
- how to cite pdf file in apa
- how to read csv file in python
- how to read csv file in pandas
- how to open text file in excel
- how to open csv file in excel
- how to include a file in python
- how to open a file in cmd
- how to move a file in linux
- how to copy a file in linux
- how to insert text file in excel
- how to restore deleted file in pc
- how to open png file in word