In [4]:
%run notebook.config.ipy

The rpy2.ipython extension is already loaded. To reload it, use:
  %reload_ext rpy2.ipython
set database db: ../csvdb
set database anndb: /gfs/mirror/annotations/mm10_ensembl83/csvdb
set database ipydb: csvdb

Retrieve QC statistics from the database

In [10]:
statement = '''select * from qc_summary'''

df = DB.fetch_DataFrame(statement,db)

id_columns = ["sample_id"] + PARAMS["name_field_titles"].split(",")

data = pd.melt(df,id_vars=id_columns)

Histograms of post-mapping QC metrics

In [13]:
%%R -i data -w 1000 -h 1200

gp <- ggplot(data, aes(x=value))
gp <- gp + facet_wrap(~variable, scales="free")
gp <- gp + geom_histogram(nbin=200)
gp <- gp + theme(axis.text.x=element_text(angle=90))
gp <- gp + ggtitle("Post-mapping QC histograms\n")
gp <- gp + ylab("no. cells") + xlab("value - fraction or count")

#ggsave("post_mapping_qc.pdf", gp, device=cairo_pdf)

Overview heatmap of post-mapping QC metrics

In [14]:
%%R -i id_columns -i df -w1000 -h600

mat <- as.matrix(df[,!colnames(df) %in% id_columns])
rownames(mat) <- df$cell
pal = brewer.pal(100,"RdYlBu")
heatmap.2(t(mat), trace="none",scale="row",col=pal, mar=c(3,12), main="Heatmap of Post-mapping QC metrics")

/ifs/devel/ssansom/python-2.7.9/lib/python2.7/site-packages/rpy2/robjects/ UserWarning: Loading required package: RColorBrewer

  res = super(Function, self).__call__(*new_args, **new_kwargs)