[BioPython] using a variable as input for restriction enzyme
Frederic Sohm
frederic.sohm at iaf.cnrs-gif.fr
Mon Dec 12 07:13:38 EST 2005
Hi,
While the two precedent methods will work, I find simpler to use any of the
following :
this one especially intended for this kind of problems :
>>> from Bio.Restriction import AllEnzymes
>>> rsite = 'EcoRI'
>>> AllEnzymes.get(rsite).elucidate()
'G^AATT_C'
>>>
If you use only commercial enzymes you can use :
>>> from Bio.Restriction import CommOnly
>>> rsite = 'EcoRI'
>>> CommOnly.get(rsite).elucidate()
G^AATT_C'
>>>
or
You can also evaluate the string :
>>> from Bio import Restriction
>>> rsite = 'EcoRI'
>>> eval('Restriction.'+rsite).elucidate()
'G^AATT_C'
Another way less talkative but which will put a lot of names in your
namespace :
>>> from Bio.Restriction import *
>>> rsite = 'EcoRI'
>>> eval(rsite).elucidate()
'G^AATT_C'
>>>
Hope this help.
Best regards
Fred
--
Frédéric Sohm
Equipe INRA U1126 "Morphogenèse du système nerveux des Chordés"
UPR 2197 DEPSN, CNRS
Institut de Neurosciences A. Fessard
1 Avenue de la Terrasse
91 198 GIF-SUR-YVETTE
FRANCE
Phone: +33 (0) 1 69 82 34 12
Fax:+33 (0) 1 69 82 34 47
More information about the BioPython
mailing list