Reputation: 1
We have 35 mesenchyaml stem cells (MSCs) single-cell RNA-Seq data, and would like to compare gene expression heterogeneity between different culture conditions (i.e. hypoxia and normoxia). In other words, We would like to identify genes that are more homogeneous in hypoxia than in normoxia.
I know how to run leveneTest using the car package on R for single gene (please see two examples below). However, I don’t know how to run leveneTest for all 5,834 genes at the same time. Could you help me, and please see our data from: http://68.181.92.180/~Gary/temporal/Log2_Transpose_CPM_MSC35Sample_CPM5Sample10_5834Gene.txt
More importantly, how to transform all 5,834 leveneTest results to a table with two columns? The first column is the gene symbol, and the second column is the P-value. Many thanks.
setwd("/Volumes/TOSHIBA EXT/20170305_LeveneTest/car")
require(car)
msc <- read.table("Log2_Transpose_CPM_MSC35Sample_CPM5Sample10_5834Gene.txt", header = T)
Test:
leveneTest(CEBPB ~ Culture, data = msc, center=median)
Levene's Test for Homogeneity of Variance (center = median)
Df F value Pr(>F)
group 1 6.5486 0.01527 *
33
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
And:
leveneTest(PLIN2 ~ Culture, data = msc, center=median)
Levene's Test for Homogeneity of Variance (center = median)
Df F value Pr(>F)
group 1 0.1804 0.6738
33
Upvotes: 0
Views: 146
Reputation: 9656
The simples way is using an external package:
library(matrixTests)
row_brownforsythe(msc[-1], msc$Culture)
Here Brown-Forsythe is the Levene's test variant with center="median"
Note: I cannot see your data, so I assumed "Culture" is in the first column. All columns that are not used for comparison have to be removed.
Upvotes: 0