Search
Question: ask for some code to remove absent genes
0
gravatar for zhihua li
12.6 years ago by
zhihua li120
zhihua li120 wrote:
hi netters, i have a gene expression matrix where rows are genes and columns are conditions. The values are either "A"(absent) or "P"(present). There are 15 conditions in total. If a gene is absent in most of these conditions, say at least 13 out of the 15 values are "A", then I would like to remove this gene from the matrix. So finally I'll get a new matrix with only those genes that are present in at least 2 of the conditions. Could anyone give me a hint about how to write the code? Thanks a lot!
ADD COMMENTlink modified 12.6 years ago by stecalza@tiscali.it290 • written 12.6 years ago by zhihua li120
0
gravatar for stecalza@tiscali.it
12.6 years ago by
stecalza@tiscali.it290 wrote:
something like wG = apply(matrix,1,FUN=function(x) sum(x == "P") > 13) matrixNew = matrix[wG,] should work HIH Stefano On Thu, May 12, 2005 at 01:56:54PM +0000, zhihua li wrote: <zhihua>hi netters, <zhihua> <zhihua>i have a gene expression matrix where rows are genes and columns are <zhihua>conditions. The values are either "A"(absent) or "P"(present). There are 15 <zhihua>conditions in total. If a gene is absent in most of these conditions, say <zhihua>at least 13 out of the 15 values are "A", then I would like to remove this <zhihua>gene from the matrix. So finally I'll get a new matrix with only those <zhihua>genes that are present in at least 2 of the conditions. Could anyone give <zhihua>me a hint about how to write the code? <zhihua> <zhihua>Thanks a lot! <zhihua> <zhihua>_______________________________________________ <zhihua>Bioconductor mailing list <zhihua>Bioconductor@stat.math.ethz.ch <zhihua>https://stat.ethz.ch/mailman/listinfo/bioconductor -- Stefano Calza, PhD Sezione di Statistica Medica e Biometria Dip. di Scienze Biomediche e Biotecnologie Universit? degli Studi di Brescia - Italia Viale Europa, 11 25123 Brescia email: calza@med.unibs.it Telefono/Phone: +390303717532 Fax: +390303717488 Section of Medical Statistics and Biometry Dept. Biomedical Sciences and Biotechnology University of Brescia - Italy
ADD COMMENTlink written 12.6 years ago by stecalza@tiscali.it290
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.2.0
Traffic: 101 users visited in the last hour