[Biopython] Restriction Batch Error, Python3.5 Biopython 1.7 Jupyter notebook

Markus Piotrowski Markus.Piotrowski at ruhr-uni-bochum.de
Thu Aug 24 14:52:44 UTC 2017


Dear Sean,

remove the quotes from the restriction enzyme's name, its not a string.

This should work:
 >>> from Bio import Restriction as res
 >>> from Bio.Restriction import RestrictionBatch as rb
 >>> from Bio.Seq import Seq
 >>> my_batch = rb([res.EcoRI, res.HindIII])
 >>> my_seq = Seq('GAATTC')
 >>> my_analysis = res.Analysis(my_batch, my_seq)
 >>> result = my_analysis.full()
 >>> print(result)
{EcoRI: [2], HindIII: []}
 >>> result[res.EcoRI]
[2]

Best,
Markus







Am 22.08.2017 um 23:15 schrieb Sean Brimer:
> Alright, So I have gotten it to work, I had to do 'from 
> Bio.Restriction import *' I know its not the best way to import a 
> module but it worked. So now I have a follow up question.
>
> I would like to capture the output of the restriction batch result and 
> use it to look for a match from another table. The result looks like a 
> dictionary however when I do the following I'm denied.
>
> ----> 1ana['MluI']TypeError: 'Analysis' object is not subscriptable
> Am I wrong about this class?
>
> On Tue, Aug 22, 2017 at 3:11 PM Sean Brimer <skbrimer at gmail.com 
> <mailto:skbrimer at gmail.com>> wrote:
>
>     Hi All,
>
>     I'm having issue with the RestrictionBatch class, when I tried to
>     create it I get the following error
>
>     rb = RestrictionBatch([MluI,HincII,SacII])
>     ---------------------------------------------------------------------------
>     NameError                                 Traceback (most recent
>     call last)
>     <ipython-input-11-90ba40b69f00> in <module>()
>           1 # rb stands for restriction batch
>     ----> 2 rb = RestrictionBatch([MluI,HincII,SacII])
>
>     NameError: name 'RestrictionBatch' is not defined
>
>     I'm not sure how you would define this class, I am following the
>     cookbook but not having much luck.
>
>     Any advice is welcomed and thank you,
>
>     Sean
>
>
>
> _______________________________________________
> Biopython mailing list  -  Biopython at mailman.open-bio.org
> http://mailman.open-bio.org/mailman/listinfo/biopython

-- 
_________________________________
Dr. Markus Piotrowski
Privatdozent/Akademischer Rat
Lehrstuhl für Molekulare Genetik und Physiologie der Pflanzen
ND 3/49
Universitätsstr. 150
44801 Bochum

Tel. xx49-(0)234-3224290
Fax. xx49-(0)234-3214187

http://www.ruhr-uni-bochum.de/pflaphy/Seiten_dt/PG_Piotrowski_d.html
http://homepage.ruhr-uni-bochum.de/Markus.Piotrowski/Index.html

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.open-bio.org/pipermail/biopython/attachments/20170824/f34a82a2/attachment.html>


More information about the Biopython mailing list