[Biopython-dev] [Biopython] Using SeqLocation to extract subsequence
Kyle Ellrott
kellrott at gmail.com
Tue Nov 3 12:23:27 EST 2009
>
>
> def FeatureDescGuess( feature ):
> desc = ""
> try:
> desc=feature.qualifiers['product'][0]
> except KeyError:
> pass
> return desc
>
> Could be just:
>
> 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.
Actually, I wrote it that way so it could be extended. First it would try
'product' and if that didn't exist replace it with something like a
'db_xref' or a 'note' entry. I was hoping to get some input on what people
think would be 'order of importance' of things to try.
Kyle
More information about the Biopython-dev
mailing list