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

Thanks Gian.

ADD REPLYlink written 22 months ago by M K300

If this answers your question please accept the answer

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

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

ADD COMMENTlink written 22 months ago by Devon Ryan70k

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 22 months ago by M K300
2
gravatar for h.mon
22 months ago by
h.mon8.7k
Brazil
h.mon8.7k 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 22 months ago by h.mon8.7k
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: 562 users visited in the last hour