Skip to content

FASTA

Supports reading and writing fasta files 🔗. Files can be wrapped into zipped files using zlib (file ending .gz). All classes/functions are available through the iv2py.fasta module.


Functions and classes

  • iv2py.fasta.record
  • iv2py.fasta.reader
  • iv2py.fasta.writer

Example usages

Loads a file and prints it to the command line. The file is being read line by line.

import iv2py as iv

for record in iv.fasta.reader(file='file.fa'):
    print(record.id)
    print(record.seq)

Writes a record to a fasta file.

import iv2py as iv

record = iv.fasta.record(id="my id", seq="somesequence")

writer = iv.fasta.writer(file='file.fa')
writer.write(record)
writer.close()