[pygr-notify] Issue 55 in pygr: Types of acceptable sourceDB or targetDB for sqlgraph.GraphView

codesite-noreply at google.com codesite-noreply at google.com
Fri Dec 19 23:33:33 PST 2008


Status: Accepted
Owner: jqian.ubc
Labels: Type-Enhancement Priority-High

New issue 55 by jqian.ubc: Types of acceptable sourceDB or targetDB for  
sqlgraph.GraphView
http://code.google.com/p/pygr/issues/detail?id=55

Please use labels and text to provide additional information.

Since the sqlgraph.GraphView class is also considered a graph interface,
wouldn't it be nice to make it flexible in taking any types of sourceDB or
targetDB?  Right now, it will only take a sql-table type sourceDB or
targetDB.  Error will be raised if I try to pass in an AnnotationDB-type
sourceDB or targetDB.

What steps will reproduce the problem?
>>> import pygr.Data
>>> from ensembl import adaptor
>>> from pygr import sqlgraph

# get the exon AnnotationDB from pygr.Data
>>> exonDB =  
pygr.Data.Bio.Annotation.Ensembl.homo_sapiens_core_47_36i.exon()
>>> conn = pygr.Data.Bio.Server.Ensembl.Ensembldb()
>>> translationTB =
sqlgraph.SQLTable('homo_sapiens_core_47_36i.translation',
itemClass=sqlgraph.TupleO, serverInfo=conn)
>>> sql_statement = 'SELECT t3.exon_id FROM
homo_sapiens_core_47_36i.translation AS tr,
homo_sapiens_core_47_36i.exon_transcript AS t1,
homo_sapiens_core_47_36i.exon_transcript AS t2,
homo_sapiens_core_47_36i.exon_transcript AS t3 WHERE tr.translation_id = %s
AND tr.transcript_id = t1.transcript_id AND t1.transcript_id =
t2.transcript_id AND t2.transcript_id = t3.transcript_id AND t1.exon_id =
tr.start_exon_id AND t2.exon_id = tr.end_exon_id AND t3.rank >= t1.rank AND
t3.rank <= t2.rank ORDER BY t3.rank'
>>> cursor = translationTB.cursor
>>> translationExons = sqlgraph.GraphView(translationTB, exonDB,
sql_statement, cursor)
>>> translation = translationTB[15121]
>>> exons = translationExons[translation]
>>> for e in exons:
...     print e.id
...
95059
95172
95081
95050
95160
95020
95101
95069
95088
95035
95110

What is the expected output? What do you see instead?

# Since the exonDB is an exon AnnotationDB, each exon from the exonDB is
expected to have a sequence attribute.  But when requested, it raises an
error instead!

>>> for e in exons:
...     print e.id, len(e.squence)
...
95059
Traceback (most recent call last):
   File "<stdin>", line 2, in <module>
   File "/home/qing/workspace2008/pygr/pygr/seqdb.py", line 710, in
getAnnotationAttr
     return self.db.getSliceAttr(self.db.sliceDB[self.id], attr)
   File "/home/qing/workspace2008/pygr/pygr/seqdb.py", line 834, in  
getSliceAttr
     return getattr(sliceInfo,attr) # GET ATTRIBUTE AS USUAL
AttributeError: 'EnsemblRow_homo_sapiens_core_47_36i.exon' object has no
attribute 'squence'

# But when the sequence attribute is requested in the most standard way, it
does return a sequence attribute!
>>> exon = exonDB[95059]
>>> len(exon.sequence)
140








--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings



More information about the pygr-notify mailing list