This is an R script which I used for plotting. Can anyone please give me a python code for this. Thanks in Advance !!

setwd("/pipeline/deff")
source('http://www.bioconductor.org/biocLite.R')
biocLite('cummeRbund')
library(cummeRbund)
cuff_data <- readCufflinks('deff')
pdf("allplots.pdf")
#"distbtn of expression levels for each dataset"
plot(csDensity(genes(cuff_data)))
#"compare the exp of each gene in all the conditions with scatter plot"       
plot(csScatterMatrix(genes(cuff_data)))   
#"distances between condition with dendrogram"
plot(csDendro(genes(cuff_data)))
#"to inspect differentially expressed genes"
plot(csVolcanoMatrix(genes(cuff_data)))
dev.off()

Recommended Answers

All 9 Replies

The problem is not with the plotting, there are very good libraries for plotting such as matplotlib or pyqtgraph or perhaps the gr framework, etc. The problem is rather that you're obtaining your numerical data from a R library (bioconductor, commeRbund etc), so you will need a way to access the numerical data.

You may be able to access the R packages through the rpy2 module. Another solution is to use R to write data files, then read these data files from python and use python's plotting packages.

But in python code no need to use the package which I used in R. I guess its better to use matplotlib. Can you please give me a python code for this R script. Thank you !!

But in python code no need to use the package which I used in R.

In order to plot anything, you need data. Where will you get the data from if you're not using the R package ? Can you post an image produced by the R script ?

Yes, Please check the attachment. Sending you one of the plot for my data. I got this with R script. Thankyou

You may be able to send the pdf if you zip it first. Anyway, this does not answer my question: where will you get the data from if you're not using the R package ?

How can I send the data?

I see 2 ways:

  1. Use the rpy2 python module to execute R statements from python until you get the cuff_data object, and extract python data from this pointer.
  2. Without interaction between the 2 scripts, launch a R script from python, which prints the numerical data in its output, or writes a file containing the output in a form understood by python (such as columns of numbers, or csv files, or hdf5 files etc)

Yes, I'm sending you the text file which has the output from R script.

Sorry, I don't see how these data are related to the plot you showed above. You need to know where the curves come from.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.