Back to index

python-biopython  1.60
Functions | Variables
fasta_iterator Namespace Reference

Functions

def extract_organisms
def extract_organisms

Variables

tuple all_species = extract_organisms("ls_orchid.fasta", "fasta")

Function Documentation

def fasta_iterator.extract_organisms (   file_to_parse,
  format 
)

Definition at line 7 of file fasta_iterator.py.

00007 
00008 def extract_organisms(file_to_parse, format):
00009     all_species = []
00010     for cur_record in SeqIO.parse(open(file_to_parse), format) :
00011         # extract the info from the description
00012         new_species = cur_record.description.split()[1]
00013 
00014         # append the new species to the list if it isn't there
00015         if new_species not in all_species:
00016             all_species.append(new_species)
00017 
00018     return all_species

Here is the call graph for this function:

Here is the caller graph for this function:

def fasta_iterator.extract_organisms (   file_to_parse)

Definition at line 32 of file fasta_iterator.py.

00032 
00033 def extract_organisms(file_to_parse):
00034     # set up the parser and iterator
00035     parser = Fasta.RecordParser()
00036     file = open(file_to_parse, 'r')
00037     iterator = Fasta.Iterator(file, parser)
00038 
00039     all_species = []
00040 
00041     while 1:
00042         cur_record = iterator.next()
00043 
00044         if cur_record is None:
00045             break
00046         
00047         # extract the info from the title
00048         new_species = cur_record.title.split()[1]
00049 
00050         # append the new species to the list if it isn't there
00051         if new_species not in all_species:
00052             all_species.append(new_species)
00053 
00054     return all_species

Here is the call graph for this function:


Variable Documentation

tuple fasta_iterator.all_species = extract_organisms("ls_orchid.fasta", "fasta")

Definition at line 21 of file fasta_iterator.py.