Package Bio :: Module Seq :: Class Seq
[hide private]
[frames] | no frames]

Class Seq

source code

Known Subclasses:

Instance Methods [hide private]
 
__add__(self, other) source code
 
__getitem__(self, index) source code
 
__init__(self, data, alphabet=Alphabet()) source code
 
__len__(self) source code
translation table
__maketrans(Seq, alphabet)
Return a translation table for use with complement() and reverse_complement().
source code
 
__radd__(self, other) source code
 
__repr__(self)
Returns a (truncated) representation of the sequence for debugging.
source code
 
__str__(self)
Returns the full sequence as a python string.
source code
 
complement(self)
Returns the complement sequence.
source code
 
count(self, sub, start=None, end=None)
Count method, like that of a python string.
source code
 
reverse_complement(self)
Returns the reverse complement sequence.
source code
 
tomutable(self) source code
 
tostring(self)
Returns the full sequence as a python string.
source code
Method Details [hide private]

__maketrans(Seq, alphabet)

source code 

Return a translation table for use with complement() and reverse_complement().

Compatible with lower case and upper case sequences.

alphabet is a dictionary as implement in Data.IUPACData

For internal use only.

Returns: translation table

__str__(self)
(Informal representation operator)

source code 

Returns the full sequence as a python string.

Note that Biopython 1.44 and earlier would give a truncated version of repr(my_seq) for str(my_seq). If you are writing code which need to be backwards compatible with old Biopython, you should continue to use my_seq.tostring() rather than str(my_seq)

complement(self)

source code 

Returns the complement sequence. New Seq object.

count(self, sub, start=None, end=None)

source code 

Count method, like that of a python string.

Return an integer, the number of occurrences of substring argument sub in the (sub)sequence given by [start:end]. Optional arguments start and end are interpreted as in slice notation.

sub - a string or another Seq object to look for start - optional integer, slice start end - optional integer, slice end

e.g. from Bio.Seq import Seq my_seq = Seq("AAAATGA") print my_seq.count("A") print my_seq.count("ATG") print my_seq.count(Seq("AT")) print my_seq.count("AT", 2, -1)

reverse_complement(self)

source code 

Returns the reverse complement sequence. New Seq object.

tostring(self)

source code 

Returns the full sequence as a python string.

Although not formally deprecated, you are now encouraged to use str(my_seq) instead of my_seq.tostring().