def _embl_convert_fasta(in_handle, out_handle, alphabet=None): """Fast EMBL to FASTA (PRIVATE).""" #We don't need to parse the features... from Bio.GenBank.Scanner import EmblScanner records = EmblScanner().parse_records(in_handle, do_features=False) #For FASTA output we can ignore the alphabet too return SeqIO.write(records, out_handle, "fasta")
def EmblCdsFeatureIterator(handle, alphabet=Alphabet.generic_protein): """Breaks up a EMBL file into SeqRecord objects for each CDS feature. Every section from the LOCUS line to the terminating // can contain many CDS features. These are returned as with the stated amino acid translation sequence (if given). """ #This calls a generator function: return EmblScanner(debug=0).parse_cds_features(handle, alphabet)
def EmblIterator(handle): """Breaks up an EMBL file into SeqRecord objects. Every section from the LOCUS line to the terminating // becomes a single SeqRecord with associated annotation and features. Note that for genomes or chromosomes, there is typically only one record.""" #This calls a generator function: return EmblScanner(debug=0).parse_records(handle)
def EmblIterator(handle): """Breaks up an EMBL file into SeqRecord objects. Every section from the LOCUS line to the terminating // becomes a single SeqRecord with associated annotation and features. Note that for genomes or chromosomes, there is typically only one record. This gets called internally by Bio.SeqIO for the EMBL file format: >>> from Bio import SeqIO >>> for record in SeqIO.parse("EMBL/epo_prt_selection.embl", "embl"): ... print(record.id) ... A00022.1 A00028.1 A00031.1 A00034.1 A00060.1 A00071.1 A00072.1 A00078.1 CQ797900.1 Equivalently, >>> with open("EMBL/epo_prt_selection.embl") as handle: ... for record in EmblIterator(handle): ... print(record.id) ... A00022.1 A00028.1 A00031.1 A00034.1 A00060.1 A00071.1 A00072.1 A00078.1 CQ797900.1 """ # This calls a generator function: return EmblScanner(debug=0).parse_records(handle)