Skip to content
David Reiss edited this page Jun 3, 2015 · 1 revision

How can I get and plot expression data in EGRIN 2.0 MongoDB?

Interactive graphics in iPython

import query.egrin2_query as e2q
import pymongo
client = pymongo.MongoClient('baligadev')
db = client['mtu_db']

There are several dependencies that need to be satisfied, including:

  • pymongo

  • numpy

  • pandas

  • joblib

  • scipy

  • statsmodels

  • itertools

    corem_genes = e2q.find_corem_info(db, x=["Rv0350","Rv0440"], x_type="corem_id", y_type="rows") print corem_genes #corem_genes.sort() #for i in corem_genes:

    print i + " is also called " + row2id( i, host="localhost", db="mtu_db", return_field = "name" )


    AttributeError Traceback (most recent call last)

    in () ----> 1 corem_genes = e2q.find_corem_info(db, x=["Rv0350","Rv0440"], x_type="corem_id", y_type="rows") 2 print corem_genes 3 #corem_genes.sort() 4 #for i in corem_genes: 5 # print i + " is also called " + row2id( i, host="localhost", db="mtu_db", return_field = "name" )

    /users/wwu/egrin2-tools/query/egrin2_query.pyc in find_corem_info(db, x, x_type, x_input_type, y_type, y_return_field, count, logic) 671 return None 672 else: --> 673 to_r = row2id_batch(db, query.rows[0], return_field=y_return_field, input_type="row_id") 674 675 elif y_type == "cols.col_id":

    /usr/lib/python2.7/dist-packages/pandas/core/generic.pyc in getattr(self, name) 1813 return self[name] 1814 raise AttributeError("'%s' object has no attribute '%s'" % -> 1815 (type(self).name, name)) 1816 1817 def setattr(self, name, value):

    AttributeError: 'DataFrame' object has no attribute 'rows'

    corem_conditions = coremFinder(x = 1,x_type = "corem_id", y_type="conds",host="localhost",db="eco_db") corem_conditions.sort() for i in corem_conditions[0:5]: print i print "\nThere are %s other conditions in which these genes are co-regulated" % len(corem_conditions)

    ATCC25404_wt_24hr_biofilm ATCC25404_wt_R1drd19_24hr_biofilm B178_mutant_Hsp60 B178_wt_Hsp60 BW25113_30C_biofilm

    There are 418 other conditions in which these genes are co-regulated

    gene_expression = expressionFinder(rows=corem_genes,cols=range(250),host="localhost",db="mtu_db")

    line_plot = plotExpression( gene_expression, plot_type = "line", ipynb = True, sort = False ) py.iplot( line_plot )

<iframe id="igraph" scrolling="no" style="border:none;"seamless="seamless" src="https://plot.ly/~scalefreegan/187.embed" height="525" width="100%"></iframe>
line_plot = plotExpression( gene_expression, plot_type = "line", ipynb = True, sort = True )
py.iplot( line_plot )
<iframe id="igraph" scrolling="no" style="border:none;"seamless="seamless" src="https://plot.ly/~scalefreegan/179.embed" height="525" width="100%"></iframe>
heatmap = plotExpression( gene_expression, plot_type = "heatmap", ipynb = True )
py.iplot( heatmap )
<iframe id="igraph" scrolling="no" style="border:none;"seamless="seamless" src="https://plot.ly/~scalefreegan/180.embed" height="525" width="100%"></iframe>
boxplot = plotExpression( gene_expression, plot_type = "boxplot", ipynb = True )
py.iplot( boxplot )
<iframe id="igraph" scrolling="no" style="border:none;"seamless="seamless" src="https://plot.ly/~scalefreegan/181.embed" height="525" width="100%"></iframe>
boxplot = plotExpression( gene_expression.iloc[ :,range( 10 ) ], plot_type = "boxplot", ipynb = True )
py.iplot( boxplot )
<iframe id="igraph" scrolling="no" style="border:none;"seamless="seamless" src="https://plot.ly/~scalefreegan/182.embed" height="525" width="100%"></iframe>