Hi Michael For what it is worth, yesterday I "expected" the seqlength()<- thing to work. So yes, I find that solution natural.
Anything that allows you to do additional manipulation easily would be welcome, for example like a drop unused levels. But seqlengths()<- will go a long way to help this out. Kasper On Wed, Oct 6, 2010 at 5:30 PM, Michael Lawrence <[email protected]> wrote: > At the moment, this is extremely difficult and requires obscure hacks to > achieve. It's been brought up numerous times. > > It happens all the time when comparing gene annotations to read alignments. > The gene annotations from GenomicFeatures include the entire set > chromosomes, which is nice, but the sequence reads are usually loaded in a > genome-independent way and only have the chromosomes present in the data. It > would be best to add the additional chromosomes to the read dataset, even if > there are no mappings, rather than throw away intervals from the other set. > > The main problem is that the seqlengths and seqnames need to updated > simultaneously. Really one should take precedence over the other, and I > recently changed the GRanges constructor to favor seqlengths, so that the > levels of seqnames are set to the names of seqlengths. Thus, it would be > nice if one could call seqlengths<- and have it add the necessary levels to > seqnames automatically. Then you can just do: > > seqlengths(reads) <- seqlengths(genes) > > and be done with it. Of course, if seqnames contains values that are not > present in the new seqlengths, it should fail. > > Comments? Should I make it work this way? > > Michael > > On Wed, Oct 6, 2010 at 2:10 PM, Chris Seidel <[email protected]> wrote: > >> Hello, >> >> How do I remove a factor level for the sequence names of a GRanges object? >> >> Sometimes I work with data sets that have not been aligned to all the >> same chromosomes. To make them comparable I have to remove or ignore >> reads for the odd chromosome. So if I have a GRanges object for which I >> want to remove all reads matching a given chromosome, e.g.: >> >> gr <- gr[seqnames(gr) != "chrXHet"] >> >> levels(seqnames(gr)) will return all original seqnames, but I would like >> to exclude "chrXHet" since I've removed all the reads matching that >> chromosome. How do I do this? >> >> -Chris >> >> _______________________________________________ >> Bioc-sig-sequencing mailing list >> [email protected] >> https://stat.ethz.ch/mailman/listinfo/bioc-sig-sequencing >> > > [[alternative HTML version deleted]] > > _______________________________________________ > Bioc-sig-sequencing mailing list > [email protected] > https://stat.ethz.ch/mailman/listinfo/bioc-sig-sequencing > _______________________________________________ Bioc-sig-sequencing mailing list [email protected] https://stat.ethz.ch/mailman/listinfo/bioc-sig-sequencing
