[Bioc-devel] a pattern to be avoided? mcols(x)$y <- z

Vincent Carey @tvjc @ending from ch@nning@h@rv@rd@edu
Wed Oct 3 16:01:40 CEST 2018


The following comes up in use of Fdb.InfiniumMethylation.hg19::getPlatform


debug: mcols(GR)$channel <- Rle(as.factor(mcols(GR)$channel450))

Browse[3]> system.time(uu <- Rle(as.factor(mcols(GR)$channel450)))

   user  system elapsed

  0.020   0.003   0.022

Browse[3]> system.time(mcols(GR)$channel <-
Rle(as.factor(mcols(GR)$channel450)))

   user  system elapsed

 47.263   0.067  47.373

Browse[3]> GR$channel[1]

factor-Rle of length 1 with 1 run

  Lengths:    1

  Values : Both

Levels(3): Both Grn Red

Browse[3]> system.time(GR$channel <- Rle(as.factor(mcols(GR)$channel450)))

   user  system elapsed

  0.058   0.006   0.065


Presumably the mcols()$<- copies/rewrites a lot of data needlessly?

-- 
The information in this e-mail is intended only for the ...{{dropped:18}}



More information about the Bioc-devel mailing list