[Bioc-devel] deprecation of keepSeqlevels and renameSeqlevels

Martin Morgan mtmorgan at fhcrc.org
Sun May 19 02:42:56 CEST 2013


On 05/18/2013 05:18 PM, Michael Lawrence wrote:
> Hi guys,
>
> Just wondering about the rationale of deprecating keepSeqlevels and
> renameSeqlevels. Sure, it's possible to do those things with seqlevels,
> somehow, but those functions make the high-level operation fairly obvious.
> They're very well named, and correspond to typical operations. I don't
> think we should deprecate functions just because they are simple wrappers
> on top of lower level functions. I might even suggest adding a
> dropSeqlevels(), e.g. dropSeqlevels("chrM").
>
> As I understand it, instead of:
> keepSeqlevels(x, "chr1")
>
> We need to do something like:
> seqlevels(x, new2old = 1, force = TRUE) <- "chr1"
> But to be more careful it would be:
> seqlevels(x, new2old = match("chr1", seqlevels(x)), force = TRUE) <- "chr1"
>
> This seqlevels stuff is already confusing to people and the above lines are
> regular visitors on my office white-board. These changes will probably
> cause me to sacrifice yet more of my white-board.
>
> In the future, perhaps we should propose these deprecations on the mailing
> list for discussion, before any code changes.

Probably this is my instigation, so sorry for not polling more widely. In 
exchange for deprecation, the help page for ?seqlevels has been bolstered with 
the suggestion

      ## Drop:
      seqlevels(gr, force=TRUE) <- c("chr2", "chr1", "chr4")
      seqlevels(gr)

so hopefully you can erase this part of your white-board and replace with 'see 
?seqlevels'. Some of the most common operations are straight-forward, e.g.,

     > gr = GRanges(paste0("chr", c(1:22, "X", "Y")), IRanges(1, 100))
     > seqlevels(gr) = sub("chr", "ch", seqlevels(gr))

new2old seems to be useful when using an un-named right-hand side, which is 
perhaps not the usual scenario. keepSeqlevels filled the use case of duplicating 
the object, whereas seqlevels<- is obviously a replacement.

Martin

>
> Michael
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> Bioc-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/bioc-devel
>


-- 
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793



More information about the Bioc-devel mailing list