pyfasta

Pythonic access to fasta sequence files
Download

pyfasta Ranking & Summary

Advertisement

  • Rating:
  • License:
  • MIT/X Consortium Lic...
  • Price:
  • FREE
  • Publisher Name:
  • brentp
  • Publisher web site:
  • http://code.google.com/u/bpederse/

pyfasta Tags


pyfasta Description

Pythonic access to fasta sequence files pyfasta is a library that offers Pythonic access to fasta sequence files.Usage: .. sourcecode:: python >>> from pyfasta import Fasta >>> f = Fasta('tests/data/three_chrs.fasta') >>> sorted(f.keys()) >>> f FastaGz('tests/data/three_chrs.fasta.gz', 0..80) >>> f 'ACTGACTGAC' # the index stores the start and stop of each header from teh fasta file >>> f.index {'chr3': (160, 3760), 'chr2': (80, 160), 'chr1': (0, 80)} # can query by a 'feature' dictionary >>> f.sequence({'chr': 'chr1', 'start': 2, 'stop': 9}) 'CTGACTGA' # with reverse complement for - strand >>> f.sequence({'chr': 'chr1', 'start': 2, 'stop': 9, 'strand': '-'}) 'TCAGTCAG' # creates a .gz and a .gdx pickle of the fasta and the index. >>> import os >>> sorted(os.listdir('tests/data/')) # cleanup (though for real use these will remain for faster access) >>> os.unlink('tests/data/three_chrs.fasta.gdx') >>> os.unlink('tests/data/three_chrs.fasta.gz') Requirements: · Python What's New in This Release: · don't re-flatten the file every time! · allow spaces before and after the header in the orginal fasta.


pyfasta Related Software