Prop.test for multiple rows/or full matrix and get p.values ?
0
0
Entering edit mode
3.9 years ago
Ankit ▴ 500

Hi everyone,

I have a matrix of gene expression. I want to apply prop.test function in r for each row and obtain p.values only. How to to do that in R ?

My attempts are as follows:

1.

myout <- purrr::pmap(countmatrix,~{prop.test(x = countmatrix$x, n = countmatrix$n, correct = "FALSE")})

It gives estimates and the object is huge and difficult to find p.values.

2.

myout <-Map(prop.test,x =countmatrix$x, n= countmatrix$n)

It gives the summary report of prop.test, but how to get p.values directly as I dont see any myout$p.value

I would appreciate any help. And if somebody has better suggestions will be useful.

Thank you

prop.test statistics matrix • 1.7k views
ADD COMMENT
0
Entering edit mode

for now I tried to use this, if it make sense

myout.p <- data.frame(capture.output(for (i in seq_along(myout)){
  cat(myout[[i]]$p.value, "\n")
}))
ADD REPLY
0
Entering edit mode

It will help if you show the structure of your input data (the gene expression matrix)

ADD REPLY
0
Entering edit mode

Here is the normalized count matrix:

Gene    sample1.allele1 sample2.allele1 sample1.allele2 sample2.allele2 sample1.sum sample2.sum
Gene1   603.0048247277  869.4788427557  546.7243744198  791.9740688625  1149.7291991476 1661.4529116183
Gene2   27.5659348447   41.8703950917   39.05174103 19.5989083408   66.6176758747   61.4693034325
Gene3   124.0467068011  89.0859470037   3320.5465681675 2317.1254815652 3444.5932749686 2406.2114285689
 Gene4  0   0   16.0801286594   8.0177352303    16.0801286594   8.0177352303
Gene5   148.1668997902  163.9181424867  119.452384327   161.2455640766  267.6192841173  325.1637065634
Gene6   0   2.6725784101    0   1.7817189401    0   4.4542973502
Gene7   195.2587051499  230.7326027395  194.1101245314  199.5525212882  389.3688296813  430.2851240277
Gene8   50.5375472153   26.7257841011   47.0918053597   37.4160977415   97.629352575    64.1418818426
Gene9   70.0634177303   129.1746231553  78.10348206 146.991812556   148.1668997902  276.1664357113
ADD REPLY
0
Entering edit mode

Hmm... prop.test is a procedure to test for differences in proportions in categorical data (like a chi-squared test). You show a matrix with continuous gene expression data. Maybe I'm missing something here, but what is the hypothesis, comparison... that you want to test?

Also, if the matrix you show is your countmatrix in the question, I don't see any $nor $xcolumns which you use in your script.

ADD REPLY
0
Entering edit mode

The concept is to see allelic differences. Basically to get statistically significant genes expression between two alleles i.e allele1 and allele2.

For replicate 1,

$n = sample1.sum

$x = sample1.allele1

For replicate 2,

$n = sample2.sum

$x = sample2.allele1

ADD REPLY

Login before adding your answer.

Traffic: 1899 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6