[BioPython] small "bug" correction in package BioSql
Eric Gibert
ericgibert at yahoo.fr
Thu Nov 8 06:07:02 EST 2007
Dear all,
In BioSeq/BioSeq.py, in the class DBSeq definition, we have the function:
def _retrieve_seq(adaptor, primary_id):
seqs = adaptor.execute_and_fetchall(
"SELECT alphabet, length(seq) FROM biosequence" \
" WHERE bioentry_id = %s", (primary_id,))
if seqs:
moltype, length = seqs[0]
moltype = moltype.lower() # <-- EG as "DNA" is found in my database!
from Bio.Alphabet import IUPAC
if moltype == "dna":
alphabet = IUPAC.unambiguous_dna
elif moltype == "rna":
alphabet = IUPAC.unambiguous_rna
elif moltype == "protein":
alphabet = IUPAC.protein
else:
raise AssertionError("Unknown moltype: %s" % moltype)
seq = DBSeq(primary_id, adaptor, alphabet, 0, int(length))
return seq
else:
return None
please note my correction: force moltype to be turn in lower case as my database has upper case value! this raises the "Unknown moltype" error.
Alternatively, we could request the SQL statement to return a lower case version of "alphabet" but I do not know if this function is standard for all database...
Might be good to add in the standard package.
Eric
_____________________________________________________________________________
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail
More information about the BioPython
mailing list