Trees | Indices | Help |
---|
|
Provides objects to represent biological sequences with alphabets.
See also http://biopython.org/wiki/Seq and the chapter in our tutorial:
|
|||
Seq A read-only sequence object (essentially a string with an alphabet). |
|||
UnknownSeq A read-only sequence object of known length but unknown contents. |
|||
MutableSeq An editable sequence object (with an alphabet). |
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|
|||
_dna_complement_table =
|
|||
_rna_complement_table =
|
|||
__package__ =
|
|
Makes a python string translation table (PRIVATE). Arguments:
Returns a translation table (a string of length 256) for use with the python string's translate method to use in a (reverse) complement. Compatible with lower case and upper case sequences. For internal use only. |
Transcribes a DNA sequence into RNA. If given a string, returns a new string object. Given a Seq or MutableSeq, returns a new Seq object with an RNA alphabet. Trying to transcribe a protein or RNA sequence raises an exception. e.g. >>> transcribe("ACTGN") 'ACUGN' |
Back-transcribes an RNA sequence into DNA. If given a string, returns a new string object. Given a Seq or MutableSeq, returns a new Seq object with an RNA alphabet. Trying to transcribe a protein or DNA sequence raises an exception. e.g. >>> back_transcribe("ACUGN") 'ACTGN' |
Helper function to translate a nucleotide string (PRIVATE). Arguments:
Returns a string. e.g. >>> from Bio.Data import CodonTable >>> table = CodonTable.ambiguous_dna_by_id[1] >>> _translate_str("AAA", table) 'K' >>> _translate_str("TAR", table) '*' >>> _translate_str("TAN", table) 'X' >>> _translate_str("TAN", table, pos_stop="@") '@' >>> _translate_str("TA?", table) Traceback (most recent call last): ... TranslationError: Codon 'TA?' is invalid >>> _translate_str("ATGCCCTAG", table, cds=True) 'MP' >>> _translate_str("AAACCCTAG", table, cds=True) Traceback (most recent call last): ... TranslationError: First codon 'AAA' is not a start codon >>> _translate_str("ATGCCCTAGCCCTAG", table, cds=True) Traceback (most recent call last): ... TranslationError: Extra in frame stop codon found. |
Translate a nucleotide sequence into amino acids. If given a string, returns a new string object. Given a Seq or MutableSeq, returns a Seq object with a protein alphabet. Arguments:
A simple string example using the default (standard) genetic code: >>> coding_dna = "GTGGCCATTGTAATGGGCCGCTGAAAGGGTGCCCGATAG" >>> translate(coding_dna) 'VAIVMGR*KGAR*' >>> translate(coding_dna, stop_symbol="@") 'VAIVMGR@KGAR@' >>> translate(coding_dna, to_stop=True) 'VAIVMGR' Now using NCBI table 2, where TGA is not a stop codon: >>> translate(coding_dna, table=2) 'VAIVMGRWKGAR*' >>> translate(coding_dna, table=2, to_stop=True) 'VAIVMGRWKGAR' In fact this example uses an alternative start codon valid under NCBI table 2, GTG, which means this example is a complete valid CDS which when translated should really start with methionine (not valine): >>> translate(coding_dna, table=2, cds=True) 'MAIVMGRWKGAR' Note that if the sequence has no in-frame stop codon, then the to_stop argument has no effect: >>> coding_dna2 = "GTGGCCATTGTAATGGGCCGC" >>> translate(coding_dna2) 'VAIVMGR' >>> translate(coding_dna2, to_stop=True) 'VAIVMGR' NOTE - Ambiguous codons like "TAN" or "NNN" could be an amino acid or a stop codon. These are translated as "X". Any invalid codon (e.g. "TA?" or "T-A") will throw a TranslationError. NOTE - Does NOT support gapped sequences. It will however translate either DNA or RNA. |
Returns the reverse complement sequence of a nucleotide string. If given a string, returns a new string object. Given a Seq or a MutableSeq, returns a new Seq object with the same alphabet. Supports unambiguous and ambiguous nucleotide sequences. e.g. >>> reverse_complement("ACTG-NH") 'DN-CAGT' |
|
_dna_complement_table
|
_rna_complement_table
|
Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Tue Sep 22 19:31:49 2009 | http://epydoc.sourceforge.net |