FASTA Parser Version History 2020-04-13 — David M. Ng — Cleaned up the code. 2020-04-12 — David M. Ng — Initial version. This project defines a custom block FASTA_Read. It "reads" from a FASTA file that has been input into the list FASTA_Read_file. Each time FASTA_Read is called, the following two output variables are set: 1. FASTA_Read_description 2. FASTA_Read_sequence FASTA_Read_filepos should be set to 1 before the first call to FASTA_Read. FASTA_Read_filepos will be set to -1 when there are no more sequences to be read, i.e., on the last call to FASTA_Read that had a sequence to read.
Assumptions about the FASTA file: 1. The FASTA file has been imported into list FASTA_Read_file (right-click on list, select import). 2. The FASTA file is correctly formatted (i.e., no error checking is performed). 3. For sequence lines, all characters are proper characters of the sequence (e.g., space characters will not be stripped). Before a call to FASTA_Read: 1. Assume the value of FASTA_Read_filepos is the index into FASTA_Read_file containing the next description line (i.e., starting with ">"). After a call to FASTA_Read: 1. FASTA_Read_description contains the description text (not including the initial ">"). 2. FASTA_Read_sequence contains the sequence up to the next description line or end of file; new line characters are omitted. 3. FASTA_Read_filepos is set to the index of the next description line, or -1 if at the end of file.