Question: Function for removing low expressed genes
2
gravatar for M K
16 months ago by
M K270
United States
M K270 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 • 686 views
ADD COMMENTlink modified 16 months ago by h.mon4.8k • written 16 months ago by M K270
4
gravatar for Gian
16 months 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 16 months ago by Gian350

Thanks Gian.

ADD REPLYlink written 16 months ago by M K270

If this answers your question please accept the answer

ADD REPLYlink written 16 months ago by Gian350
2
gravatar for Devon Ryan
16 months ago by
Devon Ryan63k
Freiburg, Germany
Devon Ryan63k wrote:

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

ADD COMMENTlink written 16 months ago by Devon Ryan63k

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 16 months ago by M K270
2
gravatar for h.mon
16 months ago by
h.mon4.8k
Brazil
h.mon4.8k 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 16 months ago by h.mon4.8k
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: 1002 users visited in the last hour