1 May 2012 16:52
Re: [Biopython] Google Summer of Code Project: SearchIO in Biopython
Wibowo Arindrarto <w.arindrarto <at> gmail.com>
2012-05-01 14:52:38 GMT
2012-05-01 14:52:38 GMT
On Mon, Apr 30, 2012 at 12:57, Peter Cock <p.j.a.cock <at> googlemail.com> wrote:
> On Mon, Apr 30, 2012 at 11:08 AM, Wibowo Arindrarto
> <w.arindrarto <at> gmail.com> wrote:
>>
>> I'm thinking of using the Search object as the object returned by
>> SearchIO.parse or SearchIO.read. That way, we can store attributes
>> common to the different search queries in it. For example:
>>
>>>>> search = SearchIO.parse('blast_result.xml', 'blast-xml')
>>>>> search.format
>> 'blast-xml'
>>>>> search.algorithm
>> 'blastx'
>>>>> search.version
>> '2.2.26+'
>>>>> search.database
>> 'refseq_protein'
>>>>> search.results
>> <generator object results at ....>
>>
>> And iteration over the results would be done like this (for example):
>>>>> for result in search.results:
>> ... print result.query, print len(result)
>>
>> Additionaly, we can also define __iter__ and next for Search so we can
>> just do the following:
>>>>> for result in search:
>> ... print result.query, print len(result)
>>
>> What do you think?
(Continue reading)
RSS Feed