[BioPython] TypeError: Unknown OP code: u'GROUP' and other issues
Bonis Sanz, Julio
JBonis at imim.es
Tue Nov 30 10:13:35 EST 2004
Hi all,
Working with biopython I have found some bugs....
For example when using GenBank.search_for() function:
>> GenBank.search_for("HTR2A[GENE]")
it returns the error:
>> TypeError: Unknown OP code: u'GROUP'
This is becouse the XML from NCBI returns a "new" operator, named GROUP that is not included in the biopython code.
<TranslationStack>
<TermSet>
<Term>HTR2A[GENE]</Term>
<Field>GENE</Field>
<Count>27</Count>
<Explode>Y</Explode>
</TermSet>
<OP>GROUP</OP>
</TranslationStack>
I dont know what those operators means, but touching the biopython code (Bio/EUtils/parse.py) like this:
elif s == "NOT":
stack[-2:] = [Datatypes.Not(stack[-2], stack[-1])]
#added by jbonis
elif s == "GROUP":
garbage = s
#end of added by jbonis
else:
raise TypeError("Unknown OP code: %r" % (s,))
it works....
But there is other problem.... using GenBank.search_for() ... it returns:
"Error: Sequence Viewer does not have any Presentations for code='gi_text'"
the solution I have found is to change the Bio/GenBank/__init__py search_for() function like this:
>> for db_id in db_ids:
>> #ids.append(db_id.dbids.ids[0]) #removed by jbonis
>> ids.append(int(db_id.records_dbids.ids[0])) #jbonis
>> return ids
Hope it helps to others with the same problem, and to the people from biopython to improve the next release.
regards,
Julio Bonis Sanz MD
http://www.juliobonis.com/portal/
More information about the BioPython
mailing list