select present probes
1
0
Entering edit mode
Wendy Qiao ▴ 360
@wendy-qiao-4501
Last seen 9.7 years ago
Hi all, I have a matrix of "A"/"P" calls. I want to filter for the probes that are present on all the replicates, for example sample1_1 sample1_2 sample2_1 sample2_2 gene1 A P P P gene2 P P A P gene3 A P A P gene4 A A A A ... I want to select for gene1 and gene2. I guess this a computational question. As I am new to R, could anybody give me some hints...Thank you in advance. Wendy [[alternative HTML version deleted]]
• 697 views
ADD COMMENT
0
Entering edit mode
@matthew-mccall-4459
Last seen 5.0 years ago
United States
There are probably more elegant ways to do this but the following should work: ind <- which(apply(mat, 1, function(x) all(x[,1:2]=="P") | all(x[,3:4]=="P"))) filtered.mat <- mat[ind,] Matt On Fri, Apr 15, 2011 at 2:43 PM, Wendy Qiao <wendy2.qiao at="" gmail.com=""> wrote: > Hi all, > > I have a matrix of "A"/"P" calls. I want to filter for the probes that are > present on all the replicates, for example > ? ? ? ? ?sample1_1 ? ? ? sample1_2 ? ? ? ?sample2_1 ? ? ? sample2_2 > gene1 ? ? ?A ? ? ? ? ? ? ? ? ? P ? ? ? ? ? ? ? ? ? ? ? P ? ? ? ? ? ? ? ? ?P > gene2 ? ? ?P ? ? ? ? ? ? ? ? ? P ? ? ? ? ? ? ? ? ? ? ?A ? ? ? ? ? ? ? ? ? P > gene3 ? ? A ? ? ? ? ? ? ? ? ? P ? ? ? ? ? ? ? ? ? ? ?A ? ? ? ? ? ? ? ? ? ?P > gene4 ? ? A ? ? ? ? ? ? ? ? ? A ? ? ? ? ? ? ? ? ? ? A > A > ... > > I want to select for gene1 and gene2. I guess this a computational question. > As I am new to R, could anybody give me some hints...Thank you in advance. > > Wendy > > ? ? ? ?[[alternative HTML version deleted]] > > _______________________________________________ > Bioconductor mailing list > Bioconductor at r-project.org > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor > -- Matthew N McCall, PhD 112 Arvine Heights Rochester, NY 14611 Cell: 202-222-5880
ADD COMMENT

Login before adding your answer.

Traffic: 901 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