[Tutor] substitute function

Srinivas Iyyer srini_iyyer_bio at yahoo.com
Sun Jul 31 22:02:52 CEST 2005


yes luke. 
I could you biopython, but i am giving a shot to
bypass it and write my own.

thank you kent for your reply.

srini

--- luke <rabidpoobear at gmail.com> wrote:

> Are you making a biology program Srinivas?
> 
> ----- Original Message -----
> From: "Kent Johnson" <kent37 at tds.net>
> Cc: <tutor at python.org>
> Sent: Sunday, July 31, 2005 2:46 PM
> Subject: Re: [Tutor] substitute function
> 
> 
> > Srinivas Iyyer wrote:
> > > Hello group:
> > >
> > > Is there a 'substitute' function in python.
> > >
> > > For example:
> > > I want to substitute A with T and G with C and
> vice
> > > versa
> > >
> > > A -> T
> > > G -> C
> > > T -> A
> > > c -> G
> >
> > You can do this with the translate() method of a
> string. It is a two-step
> process. First you have to make a translation table
> that defines the
> translation. Do this with string.maketrans():
> >  >>> import string
> >  >>> xlate = string.maketrans('AGTC', 'TCAG')
> >
> > Next use the translation table to translate the
> string of interest:
> >  >>> 'AAGTTC'.translate(xlate)
> > 'TTCAAG'
> >
> > Kent
> >
> > _______________________________________________
> > Tutor maillist  -  Tutor at python.org
> > http://mail.python.org/mailman/listinfo/tutor
> 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
> 



		
____________________________________________________
Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 


More information about the Tutor mailing list