[Biopython] question about RestrictionBatch.lambdasplit

Björn Johansson bjorn_johansson at bio.uminho.pt
Sun Dec 20 06:58:43 UTC 2009


Hi,
I copied the output from running Frederics example on my machine below:

bjorn at bjorn-laptop:~/wikidpad/user_extensions/SeqTools$ python
Python 2.6.4 (r264:75706, Dec  7 2009, 18:45:15)
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 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
>>> len([x for x in rb if len(x) == 6])
128
>>> len([x for x in rb if len(x) == 6])
128
>>> rb3 = rb.lambdasplit(lambda x : len(x) == 6)
>>> len(rb3)
0
>>> rb2 == rb3
True
>>> EcoRI in rb
True
>>> EcoRI in rb2 and EcoRI in rb3
False
>>> EcoRI.size == len(EcoRI) == 6
True
>>>

The lambdasplit does not seem to be working for me. I use python 2.6.4 on
ubuntu karmic
How can I print the biooython version?
thansk for your help!
/bjorn


2009/12/19 Frédéric Sohm <sohm at inaf.cnrs-gif.fr>

> Hi Björn, Peter,
>
> The code is working for me.
> I can't reproduce the bug.
>
>
>
> >>> 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)
> 128
> >>> len([x for x in rb if len(x) == 6])
> 128
> >>> rb3 = rb.lambdasplit(lambda x : len(x) == 6)
> >>> len(rb3)
> 128
> >>> rb2 == rb3
> True
> >>> EcoRI in rb
> True
> >>> EcoRI in rb2 and EcoRI in rb3
> True
> >>> EcoRI.size == len(EcoRI) == 6
> True
> >>>
>
>
> I am a bit puzzled there, Peter's code should work (and is effectively
> working on my machine) ...
>
> My setup is :
>
> Debian Lenny
> python 2.5.2 or python 2.4.6 (both tested)
> Biopython : 1.45
>
> What about yours ?
>
>
> Best regards
>
> Fred
>
>
>
> Peter wrote:
>
>> 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
>>
>> _______________________________________________
>> Biopython mailing list  -  Biopython at lists.open-bio.org
>> http://lists.open-bio.org/mailman/listinfo/biopython
>>
>>
> --
> Frédéric Sohm
> GIS AMAGEN CNRS INRA
> Equipe INRA U1126 "Morphogenèse du système nerveux des Chordés"
> UPR 2197 DEPSN, CNRS
> Institut de Neurobiologie A. Fessard
> 1 Avenue de la Terrasse
> 91 198 GIF-SUR -YVETTE
> FRANCE
> Phone: 33 1 69 82 34 12
> Fax: 33 1 69 82 41 67
> email: sohm at inaf.cnrs-gif.fr
>



-- 
______O_________oO________oO______o_______oO__
Björn Johansson
Assistant Professor
Departament of Biology
University of Minho
Campus de Gualtar
4710-057 Braga
PORTUGAL
http://www.bio.uminho.pt
http://sites.google.com/site/bjornhome
Work (direct) +351-253 601517
Private mob. +351-967 147 704
Dept of Biology (secretariate) +351-253 60 4310
Dept of Biology (fax) +351-253 678980




More information about the Biopython mailing list