[Biopython] question about RestrictionBatch.lambdasplit
Peter
biopython at maubp.freeserve.co.uk
Sat Dec 19 11:17:33 UTC 2009
2009/12/19 Björn Johansson <bjorn_johansson at bio.uminho.pt>:
> Hi,
>
> I am trying to get a restriction batch tha is limited to some enzymes with a
> certain size.
> I think that the lambdasplit might be used for this.
>
> I have not found any examples of the use of the restrictionbatch.lambdasplit
>
> rb = RestrictionBatch(first=[],suppliers=['F','R'])
>
> rb2= rb.lambdasplit(lambda x: x.size==6)
>
> this code does not work. Could someone give me an example on how to use
> this?
> I have tried to see docs on the lambda function in python, but I still could
> not solve this.
> grateful for any answer!
> /bjorn
Hmm, no mention of lambdasplit in this doc:
http://biopython.org/DIST/docs/cookbook/Restriction.html
Also no mention in Tests/test_Restriction.py
Looking at the code, you need a function (which could
be defined with a python lambda but need not be)
which will be given as single argument and must
return a boolean (or rather, something which will be
evaluated as a boolean). You code looks fine:
>>> from Bio.Restriction import *
>>> rb = RestrictionBatch(first=[],suppliers=['F','R'])
>>> len(rb)
228
>>> len([x for x in rb if x.size==6])
128
>>> rb2= rb.lambdasplit(lambda x: x.size==6)
>>> len(rb2)
0
Either we have both misunderstood the point of
this function, or there is a bug in lambdasplit.
Please file a bug report:
http://bugzilla.open-bio.org/enter_bug.cgi?product=Biopython
Thanks,
Peter
More information about the Biopython
mailing list