Skip to content
Prev 4718 / 21312 Next

[Bioc-devel] deprecation of keepSeqlevels and renameSeqlevels

For sorting the chromosome names in "natural" order, you can use
the makeSeqnameIds() helper function in GenomicRanges:

   seqlevels(gr) <- seqlevels(gr)[makeSeqnameIds(seqlevels(gr))]

It recognizes several naming conventions (chr-prefixed or not,
roman, etc...) e.g.:

   > makeSeqnameIds(c("Y", "1", "9", "M", "2"))
   [1] 4 1 3 5 2

   > makeSeqnameIds(c("chrY", "chrI", "chrIX", "chrM", "chrII"))
   [1] 4 1 3 5 2

I still need to improve the documentation of this function, put
more examples, and add unit tests. It's used internally by the
makeTranscriptDb* functions in GenomicFeatures to assign internal
ids to the chromosomes so that all the TranscriptDb extractors
can then return GRanges and GRangesList objects with the seqlevels
in the "natural" order.

Cheers,
H.
On 09/17/2013 10:23 AM, Kasper Daniel Hansen wrote: