[Biopython-dev] [Biopython] Using SeqLocation to extract subsequence

Peter biopython at maubp.freeserve.co.uk
Tue Nov 3 21:49:31 UTC 2009


On Tue, Nov 3, 2009 at 6:17 PM, Kyle Ellrott <kellrott at gmail.com> wrote:
>> >> def FeatureDescGuess( feature ):
>> >>   return feature.qualifiers.get('product', [""])[0]
>> >>
>> >> and therefore doesn't really need an entire function.
>> >
>> > That could attempt to get the first element of a None type, if the
>> > 'product'
>> > qualifier doesn't exist.
>>
>> No, because we supply a default value (a list containing the empty
>> string).
>
> Didn't see that.  That's what I get for programming during a colloquium ;-)
>

:)

There could be a problem if the SeqFeature qualifiers wasn't a
list, for example a string like ""NC_123456" instead of say
["NC_123456"], but the assumption is safe with anything
from the GenBank or EMBL parsers.

Peter




More information about the Biopython-dev mailing list