There are existing parsers in BioPython for the following file formats, which could be integrated into Bio.SeqIO if appropriate.

+

There are existing parsers in BioPython for the following file formats, which could be integrated into Bio.SeqIO or Bio.AlignIO if appropriate.

−

+

−

=== NBRF / PIR format ===

+

−

+

−

Bio.NBRF has a Martel parser for [[bp:PIR sequence format|PIR sequence format]], which is similar to the [[bp:FASTA sequence format|FASTA format]]. It would need addition work to return SeqRecords. It might be easier to extend to reuse the Bio.SeqIO fasta code instead.

+

−

+

−

There is also [http://www.psc.edu/general/software/packages/seq-intro/nbrffile.html PSC documentation].

+

=== KEGG format ===

=== KEGG format ===

Can Bio.KEGG parse files in [[bp:KEGG sequence format|KEGG format]]?

Can Bio.KEGG parse files in [[bp:KEGG sequence format|KEGG format]]?

−

−

=== IntelliGenetics / MASE alignment format ===

−

−

Bio.IntelliGenetics seems to use Martel parse MASE format like files into its own record object. It could be extended to return SeqRecord objects. There are already sample input files in Biopython for the unit tests, but these are clearly not multiple sequence alignments. See also this EMBOSS example:

An ordinary function which returns an iterator. For example, you could build a list of SeqRecords and then turn it into an iterator using the iter() function.

You may accept additional optional arguments (an alphabet for example). However there must be one and only one required argument (the input file handle).

What you use as the SeqRecord's id, name and description will depend on the file format. Ideally you would use the accesion number for the id. This id should also be unique for each record (unless the records in the file are in themselves ambiguous).

When storing any annotations in the record's annotations dictionary follow the defacto standard laid down by the GenBank parser... I should try and document this more.

If the supplied file seems to be invalid, raise a ValueError exception.

Finally, the new format must be added to the relevant dictionary mapping in Bio/SeqIO/__init__.py so that the Bio.SeqIO.parse() and Bio.SeqIO.read() functions are aware of it.

Writing new file formats

Note: The details are still subject to change

To add support for writing a new file format you should write a sub class of one of the writer objects in Bio.SeqIO.Interfaces

Then, the new format must be added to the relevant dictionary mappings in Bio/SeqIO/__init__.py so that the Bio.SeqIO.write() function is aware of your code.

If the supplied records cannot be written to this file format, raise a ValueError exception. Where appropriate, please use the following wording:

raiseValueError("Must have at least one sequence")raiseValueError("Sequences must all be the same length")raiseValueError("Duplicate record identifier: %s"% ...)
...

ToDo - Defined standard exceptions in Bio.SeqIO itself?

Possible additional formats

There are existing parsers in BioPython for the following file formats, which could be integrated into Bio.SeqIO or Bio.AlignIO if appropriate.