Question: Function for removing low expressed genes
2
gravatar for M K
2.4 years ago by
M K350
United States
M K350 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 • 1.3k views
ADD COMMENTlink modified 2.4 years ago by h.mon13k • written 2.4 years ago by M K350
4
gravatar for Gian
2.4 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.4 years ago by Gian350

Thanks Gian.

ADD REPLYlink written 2.4 years ago by M K350

If this answers your question please accept the answer

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

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

ADD COMMENTlink written 2.4 years ago by Devon Ryan78k

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.4 years ago by M K350
2
gravatar for h.mon
2.4 years ago by
h.mon13k
Brazil
h.mon13k 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.4 years ago by h.mon13k
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: 818 users visited in the last hour