I do this all the time with SEs, so here's a couple of options.

## keepSeqlevels generic
setMethod("keepSeqlevels", signature(x="SummarizedExperiment", value="ANY"),
          function(x, value) { # {{{
            y <- which(rownames(x) %in%
names(keepSeqlevels(rowData(x),value)))
            return(x[y, ])
          }) # }}}
gmset.noXY <- keepSeqlevels(gmset, paste0('chr', 1:22))

## or use split; this is slower and balkier than keepSeqlevels
gmset.noXY <- split(gmset, as.vector(seqnames(gmset)))[ paste0('chr', 1:22)
]

## bonus: masking, cf. MM
load("maskedRegions.rda")
gmset <- gmset[ countOverlaps(gmset, maskedRegions) == 0, ]

## or perhaps gmset[ !gmset %within% maskedRegions, ] ... ?

there is a small pile of functions like this (combine(), combine(,
withNAs=TRUE), keepSeqlevels(), etc.) I'd like to see as generics for all
SummarizedExperiments in GenomicRanges.  Let the appropriate people know if
you agree with this notion and any pitfalls you foresee


--t





On Thu, Jan 10, 2013 at 5:01 AM, Toby Hughes <toby.hughes@adelaide.edu.au>wrote:

> Hi all,
>
> I am relatively new to both R and the Bioconductor packages, so apologies
> if this is a naīve question.  I am using minfi to preprocess a small set
> (60 samples) of Illumina450k microarray data.  I have got to the point
> where I have a GenomicMethylSet, following the use of mapToGenome on a
> MethylSet to provide annotation, having excluded those probes without a
> defined position in the process.  I now wish to exclude probes from the sex
> chromosomes before using dmpFinder, and so I am seeking to subset the
> GenomicMethylSet to the autosomes only.  Despite days of searching and a
> number of references saying this is relatively straightforward, I have not
> yet had any success (have been exploring GenomicRanges).  Could someone
> please point me in the right direction with a code snippet or a reference?
>
> Kind regards,
>
> Toby.
>
>         [[alternative HTML version deleted]]
>
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor@r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives:
> http://news.gmane.org/gmane.science.biology.informatics.conductor
>
>


-- 
*A model is a lie that helps you see the truth.*
*
*
Howard Skipper<http://cancerres.aacrjournals.org/content/31/9/1173.full.pdf>

	[[alternative HTML version deleted]]

