[Bioc-sig-seq] drop factor level for seqnames of a GRanges object

Chris Seidel seidel at phaget4.org
Wed Oct 6 23:10:44 CEST 2010


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?


More information about the Bioc-sig-sequencing mailing list