Question: Function for removing low expressed genes
2
gravatar for M K
2.0 years ago by
M K310
United States
M K310 wrote:

Dear All,

I have a matrix contains the gene names at the first columns and the rest of columns in this matrix represent the gene expression in different tissues. My question is how to write a function or line in R to remove the rows that have expression less than specific value say 5. 

 

R • 980 views
ADD COMMENTlink modified 2.0 years ago by h.mon9.2k • written 2.0 years ago by M K310
4
gravatar for Gian
2.0 years ago by
Gian350
Canada
Gian350 wrote:

If you want to remove all the rows that never have expression of 5 or higher:

matrix[apply(matrix[,-1],1,function(X) length(X[X>=5])>0 ),]
ADD COMMENTlink written 2.0 years ago by Gian350

Thanks Gian.

ADD REPLYlink written 2.0 years ago by M K310

If this answers your question please accept the answer

ADD REPLYlink written 2.0 years ago by Gian350
2
gravatar for Devon Ryan
2.0 years ago by
Devon Ryan73k
Freiburg, Germany
Devon Ryan73k wrote:

Have a look at the genefilter package in Bioconductor. In particular, note the kOverA() function.
 

ADD COMMENTlink written 2.0 years ago by Devon Ryan73k

I just need simple R line because I am using this file for testing something else (i.e easy line to do this regardless the first column if it is gene name oe anything else)

ADD REPLYlink written 2.0 years ago by M K310
2
gravatar for h.mon
2.0 years ago by
h.mon9.2k
Brazil
h.mon9.2k wrote:

edgeR approach filters by counts per million (CPM), see for example page 11 of the user guide. y is a DGEList:

keep <- rowSums(cpm(y)>1) >= 2
y <- y[keep, , keep.lib.sizes=FALSE]
ADD COMMENTlink written 2.0 years ago by h.mon9.2k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 874 users visited in the last hour