mistake: RE: [BioPython] TypeError: Unknown OP code: u'GROUP' and other issues

Bonis Sanz, Julio JBonis at imim.es
Tue Nov 30 10:27:36 EST 2004


There was an error in my code:

please replace 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

with this:

>>    for db_id in db_ids:
>>        #ids.append(db_id.dbids.ids[0]) #removed by jbonis
>>        ids.append(str(int(db_id.records_dbids.ids[0]))) #jbonis
>>    return ids

( add a str to ids.append() ) ... it should work fine now


-----Mensaje original-----
De: biopython-bounces at portal.open-bio.org
[mailto:biopython-bounces at portal.open-bio.org]En nombre de Bonis Sanz,
Julio
Enviado el: martes, 30 de noviembre de 2004 16:14
Para: biopython at biopython.org
Asunto: [BioPython] TypeError: Unknown OP code: u'GROUP' and other
issues


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/




_______________________________________________
BioPython mailing list  -  BioPython at biopython.org
http://biopython.org/mailman/listinfo/biopython



More information about the BioPython mailing list