[Biopython-dev] Restriction analysis package.

fsms at users.sourceforge.net fsms at users.sourceforge.net
Mon Jun 7 05:37:32 EDT 2004


Michael Hoffman wrote:

>On Mon, 7 Jun 2004, fsms at users.sourceforge.net wrote:
>
>  
>
>>Ok, sorry my mistake. antiparallel is fed with a string
>>not a Seq object.
>>    
>>
>
>A Seq object works just fine. It just always returns a string:
>
>Python 2.3.3 (#1, Mar 31 2004, 11:17:07)
>[GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)] on linux2
>Type "help", "copyright", "credits" or "license" for more information.
>  
>
>>>>from Bio.Seq import Seq
>>>>from Bio.Alphabet import IUPAC
>>>>s = Seq("ACGTAAAAAA", IUPAC.IUPACAmbiguousDNA)
>>>>from Bio.SeqUtils import antiparallel
>>>>b = antiparallel(s)
>>>>b
>>>>        
>>>>
>'TTTTTTACGT'
>  
>
>>>>type(b)
>>>>        
>>>>
><type 'str'>
>  
>
Hi,

Do not on mine.
Seems the new way of doing it restrain it to string.
have look at the CVS in SeqUtils.

SeqUtils from CVS.
version 1.6 :

def complement(seq):
" returns the complementary sequence (NOT antiparallel) "
return ''.join([IUPACData.ambiguous_dna_complement[x] for x in seq])

works on any iterable.

version 1.7 :
def complement(seq):
'''returns the complementary sequence (NOT antiparallel)
much faster on long sequences than the previous loop based one.
provided by Michael Palmer, University of Waterloo '''
return seq.translate(_ttable)

works only on string.

and version 1.9 precise it.

May it would be a good idea to either modify Seq and MutableSeq to 
return a translate method
then.

something like :

def translate(self, table)
return self.tostring().translate(table)

Fred





More information about the Biopython-dev mailing list