[BioC] select present probes

Matthew McCall mccallm at gmail.com
Fri Apr 15 20:51:24 CEST 2011


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



More information about the Bioconductor mailing list