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()

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.

Edited 1 Year Ago by Gribouillis

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 ?

Edited 1 Year Ago by Gribouillis

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

Edited 1 Year Ago by venk7

Attachments allplots_groups-page-001.jpg 56.29 KB

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 ?

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)

Edited 1 Year Ago by Gribouillis

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

Attachments
gene_id	sample_1	sample_2	status	value_1	value_2	log2_fold_change	test_stat	p_value	q_value	significant
XLOC_030200	SRR493359	SRR493360	OK	0	822.338	Inf	NA	5e-05	0.0039253	yes
XLOC_025507	SRR493359	SRR493361	OK	23180.9	22104.7	-0.0685826	-9.41583	5e-05	0.0039253	yes
XLOC_030200	SRR493359	SRR493361	OK	0	610.005	Inf	NA	5e-05	0.0039253	yes
XLOC_025507	SRR493360	SRR493361	OK	22993.7	22104.7	-0.0568836	-7.79236	5e-05	0.0039253	yes
XLOC_000001	SRR493359	SRR493363	OK	0	661.495	Inf	NA	5e-05	0.0039253	yes
XLOC_000035	SRR493359	SRR493363	OK	23.1601	0	-Inf	NA	5e-05	0.0039253	yes
XLOC_000054	SRR493359	SRR493363	OK	0	41.2733	Inf	NA	0.00055	0.0216768	yes
XLOC_000342	SRR493359	SRR493363	OK	19.5379	0	-Inf	NA	0.00055	0.0216768	yes
XLOC_000381	SRR493359	SRR493363	OK	15.4637	0	-Inf	NA	0.00075	0.0254967	yes
XLOC_000396	SRR493359	SRR493363	OK	52.7259	0	-Inf	NA	1e-04	0.00705651	yes
XLOC_000570	SRR493359	SRR493363	OK	0	20.7142	Inf	NA	6e-04	0.0223328	yes
XLOC_000582	SRR493359	SRR493363	OK	0	29.2818	Inf	NA	0.001	0.0295843	yes
XLOC_000656	SRR493359	SRR493363	OK	27.3144	0	-Inf	NA	0.00035	0.0164685	yes
XLOC_000669	SRR493359	SRR493363	OK	0	22.3058	Inf	NA	0.00045	0.0194388	yes
XLOC_000705	SRR493359	SRR493363	OK	103.696	0	-Inf	NA	5e-05	0.0039253	yes
XLOC_000713	SRR493359	SRR493363	OK	0	110.038	Inf	NA	5e-05	0.0039253	yes
XLOC_000797	SRR493359	SRR493363	OK	0	39.2676	Inf	NA	0.00095	0.0285989	yes
XLOC_000817	SRR493359	SRR493363	OK	27.8668	0	-Inf	NA	9e-04	0.0280205	yes
XLOC_000839	SRR493359	SRR493363	OK	0	23.6455	Inf	NA	6e-04	0.0223328	yes
XLOC_000853	SRR493359	SRR493363	OK	0	20.279	Inf	NA	0.001	0.0295843	yes
XLOC_000886	SRR493359	SRR493363	OK	64.1799	0	-Inf	NA	5e-05	0.0039253	yes
XLOC_001125	SRR493359	SRR493363	OK	23.0581	0	-Inf	NA	0.0012	0.0342908	yes
XLOC_001135	SRR493359	SRR493363	OK	30.259	0	-Inf	NA	1e-04	0.00705651	yes
XLOC_001202	SRR493359	SRR493363	OK	2171.83	0	-Inf	NA	5e-05	0.0039253	yes
XLOC_001294	SRR493359	SRR493363	OK	0	43.3524	Inf	NA	0.00095	0.0285989	yes
XLOC_001337	SRR493359	SRR493363	OK	103.722	0	-Inf	NA	5e-05	0.0039253	yes
XLOC_001358	SRR493359	SRR493363	OK	240.403	0	-Inf	NA	5e-05	0.0039253	yes
XLOC_001408	SRR493359	SRR493363	OK	0	63.4401	Inf	NA	5e-05	0.0039253	yes
XLOC_001488	SRR493359	SRR493363	OK	0	68.4914	Inf	NA	0.00055	0.0216768	yes
XLOC_001494	SRR493359	SRR493363	OK	35.6331	0	-Inf	NA	9e-04	0.0280205	yes
XLOC_001583	SRR493359	SRR493363	OK	0	203.355	Inf	NA	5e-05	0.0039253	yes
XLOC_001610	SRR493359	SRR493363	OK	0	47.6328	Inf	NA	5e-05	0.0039253	yes
XLOC_001616	SRR493359	SRR493363	OK	0	170.241	Inf	NA	5e-05	0.0039253	yes
XLOC_001810	SRR493359	SRR493363	OK	0.905031	35.5873	5.29725	0.878732	0.00155	0.0425294	yes
XLOC_001812	SRR493359	SRR493363	OK	126.653	0	-Inf	NA	5e-05	0.0039253	yes
XLOC_001814	SRR493359	SRR493363	OK	0	18.2301	Inf	NA	0.00035	0.0164685	yes
XLOC_001884	SRR493359	SRR493363	OK	0	38.8198	Inf	NA	0.00035	0.0164685	yes
XLOC_002406	SRR493359	SRR493363	OK	58.8432	0	-Inf	NA	5e-05	0.0039253	yes
XLOC_002428	SRR493359	SRR493363	OK	0	18.5964	Inf	NA	3e-04	0.0151565	yes
XLOC_002471	SRR493359	SRR493363	OK	30.6631	0	-Inf	NA	6e-04	0.0223328	yes
XLOC_002498	SRR493359	SRR493363	OK	0	18.3189	Inf	NA	3e-04	0.0151565	yes
XLOC_002586	SRR493359	SRR493363	OK	32.7805	0	-Inf	NA	0.00035	0.0164685	yes
XLOC_002628	SRR493359	SRR493363	OK	0	37.9476	Inf	NA	5e-05	0.0039253	yes
XLOC_002779	SRR493359	SRR493363	OK	0	12.4613	Inf	NA	6e-04	0.0223328	yes
XLOC_002879	SRR493359	SRR493363	OK	0	28.4107	Inf	NA	0.0012	0.0342908	yes
XLOC_002894	SRR493359	SRR493363	OK	147.706	0	-Inf	NA	5e-05	0.0039253	yes
XLOC_003098	SRR493359	SRR493363	OK	0	93.9241	Inf	NA	1e-04	0.00705651	yes
XLOC_003101	SRR493359	SRR493363	OK	0	13.1454	Inf	NA	3e-04	0.0151565	yes
XLOC_003216	SRR493359	SRR493363	OK	0	67.399	Inf	NA	0.00095	0.0285989	yes
XLOC_003238	SRR493359	SRR493363	OK	0	381.489	Inf	NA	5e-05	0.0039253	yes
XLOC_003374	SRR493359	SRR493363	OK	0	72.625	Inf	NA	5e-05	0.0039253	yes
XLOC_003600	SRR493359	SRR493363	OK	0	19.1986	Inf	NA	6e-04	0.0223328	yes
XLOC_003640	SRR493359	SRR493363	OK	0	51.5152	Inf	NA	5e-05	0.0039253	yes
XLOC_003747	SRR493359	SRR493363	OK	21.593	0	-Inf	NA	6e-04	0.0223328	yes
XLOC_003749	SRR493359	SRR493363	OK	62.8401	0	-Inf	NA	5e-05	0.0039253	yes
XLOC_003776	SRR493359	SRR493363	OK	0	34.2392	Inf	NA	0.00035	0.0164685	yes
XLOC_003818	SRR493359	SRR493363	OK	168.959	0	-Inf	NA	6e-04	0.0223328	yes
XLOC_003857	SRR493359	SRR493363	OK	80.2125	0	-Inf	NA	0.00025	0.0133177	yes
XLOC_003858	SRR493359	SRR493363	OK	30.6598	0	-Inf	NA	0.00055	0.0216768	yes
XLOC_003872	SRR493359	SRR493363	OK	0	34.4581	Inf	NA	5e-05	0.0039253	yes
XLOC_003929	SRR493359	SRR493363	OK	0	38.0747	Inf	NA	0.00015	0.0095286	yes
XLOC_004260	SRR493359	SRR493363	OK	0	14.5442	Inf	NA	0.00035	0.0164685	yes
XLOC_004272	SRR493359	SRR493363	OK	89.2669	0	-Inf	NA	5e-05	0.0039253	yes
XLOC_004431	SRR493359	SRR493363	OK	50.8074	0	-Inf	NA	5e-05	0.0039253	yes
XLOC_004623	SRR493359	SRR493363	OK	234.226	0	-Inf	NA	5e-05	0.0039253	yes
XLOC_004624	SRR493359	SRR493363	OK	0	97.2633	Inf	NA	5e-05	0.0039253	yes
XLOC_004689	SRR493359	SRR493363	OK	0	19.5687	Inf	NA	0.0018	0.0487687	yes
XLOC_004702	SRR493359	SRR493363	OK	0	47.0242	Inf	NA	0.00055	0.0216768	yes
XLOC_004722	SRR493359	SRR493363	OK	0	35.5046	Inf	NA	1e-04	0.00705651	yes
XLOC_004743	SRR493359	SRR493363	OK	0	18.5016	Inf	NA	0.00055	0.0216768	yes
XLOC_004749	SRR493359	SRR493363	OK	0	81.674	Inf	NA	5e-05	0.0039253	yes
XLOC_004750	SRR493359	SRR493363	OK	0	27.6201	Inf	NA	0.001	0.0295843	yes
XLOC_004799	SRR493359	SRR493363	OK	0	42.3057	Inf	NA	0.00025	0.0133177	yes
XLOC_004935	SRR493359	SRR493363	OK	0	23.2256	Inf	NA	0.00035	0.0164685	yes
XLOC_004989	SRR493359	SRR493363	OK	0	96.2836	Inf	NA	5e-05	0.0039253	yes
XLOC_005003	SRR493359	SRR493363	OK	0	15.4343	Inf	NA	0.00045	0.0194388	yes
XLOC_005036	SRR493359	SRR493363	OK	0	27.4475	Inf	NA	9e-04	0.0280205	yes
XLOC_005043	SRR493359	SRR493363	OK	0	909.528	Inf	NA	5e-05	0.0039253	yes
XLOC_005149	SRR493359	SRR493363	OK	90.0652	0	-Inf	NA	5e-05	0.0039253	yes
XLOC_005240	SRR493359	SRR493363	OK	0	101.913	Inf	NA	5e-05	0.0039253	yes
XLOC_005295	SRR493359	SRR493363	OK	0	183.892	Inf	NA	5e-05	0.0039253	yes
XLOC_005347	SRR493359	SRR493363	OK	0	29.7178	Inf	NA	1e-04	0.00705651	yes
XLOC_005465	SRR493359	SRR493363	OK	0	178.307	Inf	NA	5e-05	0.0039253	yes
XLOC_005506	SRR493359	SRR493363	OK	1014.45	0	-Inf	NA	8e-04	0.0262986	yes
XLOC_005511	SRR493359	SRR493363	OK	12.5338	0	-Inf	NA	0.00075	0.0254967	yes
XLOC_005588	SRR493359	SRR493363	OK	0	595.833	Inf	NA	5e-05	0.0039253	yes
XLOC_005638	SRR493359	SRR493363	OK	0	33.8325	Inf	NA	5e-05	0.0039253	yes
XLOC_005643	SRR493359	SRR493363	OK	0	1141.49	Inf	NA	5e-05	0.0039253	yes
XLOC_005644	SRR493359	SRR493363	OK	0	21.0593	Inf	NA	0.00075	0.0254967	yes
XLOC_005645	SRR493359	SRR493363	OK	0	124.181	Inf	NA	5e-05	0.0039253	yes
XLOC_005646	SRR493359	SRR493363	OK	0	38.6559	Inf	NA	0.00025	0.0133177	yes
XLOC_005687	SRR493359	SRR493363	OK	0	24.6855	Inf	NA	0.00095	0.0285989	yes
XLOC_005758	SRR493359	SRR493363	OK	0	1374.12	Inf	NA	5e-05	0.0039253	yes
XLOC_005792	SRR493359	SRR493363	OK	12.788	0	-Inf	NA	0.001	0.0295843	yes
XLOC_005798	SRR493359	SRR493363	OK	34.4776	0	-Inf	NA	0.00055	0.0216768	yes
XLOC_005813	SRR493359	SRR493363	OK	45.4414	0	-Inf	NA	9e-04	0.0280205	yes
XLOC_005852	SRR493359	SRR493363	OK	0	75.5239	Inf	NA	5e-05	0.0039253	yes
XLOC_005886	SRR493359	SRR493363	OK	47.8833	0	-Inf	NA	6e-04	0.0223328	yes
XLOC_006022	SRR493359	SRR493363	OK	32.0782	0	-Inf	NA	0.00025	0.0133177	yes
XLOC_006027	SRR493359	SRR493363	OK	54.8666	0	-Inf	NA	0.00015	0.0095286	yes
XLOC_006029	SRR493359	SRR493363	OK	21.0543	0	-Inf	NA	9e-04	0.0280205	yes
XLOC_006037	SRR493359	SRR493363	OK	56.9068	0	-Inf	NA	1e-04	0.00705651	yes
XLOC_006039	SRR493359	SRR493363	OK	78.0599	0	-Inf	NA	5e-05	0.0039253	yes
XLOC_006041	SRR493359	SRR493363	OK	77.5148	0	-Inf	NA	0.00025	0.0133177	yes
XLOC_006138	SRR493359	SRR493363	OK	39.6509	0	-Inf	NA	0.00055	0.0216768	yes
XLOC_006140	SRR493359	SRR493363	OK	0	47.345	Inf	NA	3e-04	0.0151565	yes
XLOC_006156	SRR493359	SRR493363	OK	14.493	0	-Inf	NA	9e-04	0.0280205	yes
XLOC_006164	SRR493359	SRR493363	OK	44.026	0	-Inf	NA	5e-04	0.0206933	yes
XLOC_006215	SRR493359	SRR493363	OK	25.0846	0	-Inf	NA	0.00075	0.0254967	yes
XLOC_006247	SRR493359	SRR493363	OK	136.333	0	-Inf	NA	0.00015	0.0095286	yes
XLOC_006533	SRR493359	SRR493363	OK	0	51.7613	Inf	NA	0.00015	0.0095286	yes
XLOC_006599	SRR493359	SRR493363	OK	0	1569.44	Inf	NA	5e-05	0.0039253	yes
XLOC_006601	SRR493359	SRR493363	OK	0	776.85	Inf	NA	5e-05	0.0039253	yes
XLOC_006615	SRR493359	SRR493363	OK	40.2367	0	-Inf	NA	0.00075	0.0254967	yes
XLOC_006669	SRR493359	SRR493363	OK	0	51.2195	Inf	NA	5e-05	0.0039253	yes
XLOC_006670	SRR493359	SRR493363	OK	0	18.943	Inf	NA	8e-04	0.0262986	yes
XLOC_006673	SRR493359	SRR493363	OK	0	14.3265	Inf	NA	7e-04	0.0245713	yes
XLOC_006780	SRR493359	SRR493363	OK	0	76.431	Inf	NA	0.00055	0.0216768	yes
XLOC_006787	SRR493359	SRR493363	OK	21.3234	0	-Inf	NA	9e-04	0.0280205	yes
XLOC_006819	SRR493359	SRR493363	OK	0	50.098	Inf	NA	0.00055	0.0216768	yes
XLOC_006912	SRR493359	SRR493363	OK	0	16.6927	Inf	NA	0.00015	0.0095286	yes
XLOC_006969	SRR493359	SRR493363	OK	0	132.972	Inf	NA	1e-04	0.00705651	yes
XLOC_007001	SRR493359	SRR493363	OK	0	22.3553	Inf	NA	9e-04	0.0280205	yes
XLOC_007057	SRR493359	SRR493363	OK	0	69.1404	Inf	NA	5e-05	0.0039253	yes
XLOC_007126	SRR493359	SRR493363	OK	78.9626	0	-Inf	NA	0.00075	0.0254967	yes
XLOC_007170	SRR493359	SRR493363	OK	0	22.8631	Inf	NA	0.0011	0.0317841	yes
XLOC_007187	SRR493359	SRR493363	OK	339.247	0	-Inf	NA	5e-05	0.0039253	yes
XLOC_007193	SRR493359	SRR493363	OK	0	68.3822	Inf	NA	0.00035	0.0164685	yes
XLOC_007272	SRR493359	SRR493363	OK	27.0875	0	-Inf	NA	8e-04	0.0262986	yes
XLOC_007299	SRR493359	SRR493363	OK	0	22.2462	Inf	NA	4e-04	0.0180625	yes
XLOC_007362	SRR493359	SRR493363	OK	0	1184.16	Inf	NA	7e-04	0.0245713	yes
XLOC_007447	SRR493359	SRR493363	OK	52.5601	0	-Inf	NA	5e-05	0.0039253	yes
XLOC_007458	SRR493359	SRR493363	OK	0	299.274	Inf	NA	5e-05	0.0039253	yes
XLOC_007459	SRR493359	SRR493363	OK	0	322.989	Inf	NA	5e-05	0.0039253	yes
XLOC_007562	SRR493359	SRR493363	OK	0	165.189	Inf	NA	0.00095	0.0285989	yes
XLOC_007563	SRR493359	SRR493363	OK	0	22.5893	Inf	NA	5e-05	0.0039253	yes
XLOC_007758	SRR493359	SRR493363	OK	182.576	0	-Inf	NA	0.00035	0.0164685	yes
XLOC_007862	SRR493359	SRR493363	OK	45.0233	0	-Inf	NA	0.00055	0.0216768	yes
XLOC_00

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.

This article has been dead for over six months. Start a new discussion instead.