Entering edit mode
18 months ago
sata72
•
0
I have a list of genes with two meth and exp parameter for each genes (with several sample for exp and meth). i want to create table with "Pearson" correlation matrix with p value.
This is a example of the list and the numbers are random selected.
Input:
list meth1 meth2 meth3 meth4 meth5 meth6 meth7 meth8 meth9 meth10 exp1 exp2 exp3 exp4 exp5 exp6 exp7 exp8 exp9 exp10
gene 1 1 1 1 1 1 1 1 1 1 1 7.2 7.2 7.2 7.2 7.2 7.2 7.2 7.2 7.2 7.2
gene 2 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 7.5 7.5 7.5 7.5 7.5 7.5 7.5 7.5 7.5 7.5
gene 3 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 5 5 5 5 5 5 5 5 5 5
gene 4 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 4 4 4 4 4 4 4 4 4 4
gene 5 0.7 0.7 0.7 0.7 0.7 0.7 0.7 0.7 0.7 0.7 3 3 3 3 3 3 3 3 3 3
gene 6 0.9 0.9 0.9 0.9 0.9 0.9 0.9 0.9 0.9 0.9 2 2 2 2 2 2 2 2 2 2
....
Expected output:
list Correlation value Pvalue
gene 1 0.3 0.05
gene 2 0.8 0.04
gene 3 0.9 0.06
gene 4 0.2 0.01
gene 5 -0.4 0.002
gene 6 0.2 0.05
....
Your question is not clear, you want to draw correlation between the meth and exp values for each gene right? then the example you provided does not make sense since for all genes the values are constant anyways. Anyways, in R you can simply use
cor()
function to do the correlation, and it has a "method" argument which you can use to specify your method of choice like "Pearson", "Spearman" etc.Thank you for response actually i want to find genes that highly correlated and statistically significant with exp and meth values. cor() calculate the overall correlation between meth and exp.
for each gene i have information of 10 sample for meth and 10 sample for exp. i want to find correlation of these meth samples and exp samples. and compare all of the genes to find winch one have high correlation and also significant.
So you want to do differential expression analysis.
no. i don't want to find genes with differently exp, i want to find genes with high correlated between exp (10sample) and meth (10sample).
If i want to get cor and pvalue for the gene 1 i can use this:
in the output
so i can compare genes to see which genes are high correlated (exp, meth). but i want to create a table in the output with all of the genes.