ask for some code to remove absent genes
1
0
Entering edit mode
zhihua li ▴ 120
@zhihua-li-1129
Last seen 10.2 years ago
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!
• 973 views
ADD COMMENT
0
Entering edit mode
@stecalzatiscaliit-259
Last seen 10.2 years ago
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 COMMENT

Login before adding your answer.

Traffic: 915 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6