This file tests out the hts-db installation
In [ ]:
import sys
%load_ext autoreload
%autoreload 2
%load_ext sql
%pylab inline
%matplotlib inline
import pandas as pd
import pickle,time
import pymongo
import pylab as pl
FT1=['p53Act','DNADamage','StressKinase','OxidativeStress','MicrotubuleCSK','LysosomalMass',
'MitoMass','MitoMembPot','MitoFxnI','Steatosis',
'MitoticArrest','CellCycleArrest','NuclearSize','DNATexture','Apoptosis','CellLoss']
In [11]:
# This package contains the object (i.e. schema) definition for the database
from bio.data.htsdb import *
# This pacakge contains the functions for retrieving and displaying the data
import bio.comp.hts as hts
In [12]:
# Count the number of Plates
HtsPlate.objects.count()
Out[12]:
In [65]:
# Find Troglitazone
print hts.getChem('troglitazone')
# Now get the chemical object with the eid
TGTZ = HtsChem.objects(eid='TX006205').first()
In [67]:
# Get the plates containing troglitazone
Plates0 = HtsPlate.objects(chems=TGTZ)
Plates0
Out[67]:
In [68]:
# Which assays are on the first plate ?
[A.name for A in Plates0[0].assays]
Out[68]:
In [69]:
# Find all assays for Troglitazone
[(A.eid,A.name) for A in HtsPlate.objects(chems=TGTZ).distinct('assays')]
Out[69]:
In [54]:
# Get the p53Activation assay object
P53 = HtsAssay.objects(eid='p53Act').first()
In [70]:
# Find the normalized concentration response data for TGTZ for the p53 endpoint
for CRCi in HtsConcRespCurveNrm.objects(chem=TGTZ,assay=P53):
print CRCi.timeh
In [77]:
# Get the concentration response data as a pandas dataframe
X=hts.getChemConcResp(u'TX006205',ret='df')
In [78]:
# Get the percentage change data
X[('ppct')]
Out[78]:
In [79]:
# Get the assay results
AR=hts.getChemAssayResults('TX006205')
In [82]:
AR[('hit_call')]
Out[82]:
In [85]:
# Plot the conc response for Octanoic acid
hts.plotHtsConcRespHM('TX002151',exp_id='APR-HepG2-PhII',add_t0=True,loc=None)
In [22]:
FTLB3 = dict(zip(FT1,['p53','SK','OS','Mt','MM','MMP','MA','CCA','NS','CN']))
hts.plotHtsTrajHM('TX002151',exp_id='APR-HepG2-PhII',add_t0=True,cb=True,use_resp='slfc',
draw_chem=False,FTLB=FTLB3,
fs=1.1,xyoff=[2,-4],fgsz=[15,3],loc=None)