xryanglab / xtail

Genome-wide assessment of differential translations with ribosome profiling data
GNU General Public License v3.0
17 stars 18 forks source link

Compatibiliy with R4.0.0 #16

Open mflamand opened 4 years ago

mflamand commented 4 years ago

Hello, I tried to repackage xtail v1.1.5 under the newly released R4.0.0 (windows10) Unfortunately I running the main function xtails fails as such:

data("xtaildata")
mrna<-xtaildata$mrna
rpf` <- xtaildata$rpf
condition = c("control", "control", "treat", "treat")
test.results<- xtail(mrna, rpf, condition, bins=1000)

Error in assays<-(*tmp*, value = new("SimpleList", listData = list( : please use 'assay(x, withDimnames=FALSE)) <- value' or 'assays(x, withDimnames=FALSE)) <- value' when the dimnames on the supplied assay(s) are not identical to the dimnames on DESeqDataSet object 'x'

  1. stop(wmsg("please use 'assay(x, withDimnames=FALSE)) <- value' ", "or 'assays(x, withDimnames=FALSE)) <- value' when the ", what, " on the supplied assay(s) are not identical to ", "the ", what, " on ", class(x), " object 'x'"))

  2. assays<-(*tmp*, value = new("SimpleList", listData = list( counts = structure(c(825L, 1054L, 71L, 191L, 81L, 756L, 947L, 1158L, 152L, 746L, 1154L, 201L, 1337L, 1246L, 61L, 473L, 123L, 714L, 497L, 924L, 21L, 221L, 3544L, 402L, 938L, 178L, ...

  3. assays<-(*tmp*, value = new("SimpleList", listData = list( counts = structure(c(825L, 1054L, 71L, 191L, 81L, 756L, 947L, 1158L, 152L, 746L, 1154L, 201L, 1337L, 1246L, 61L, 473L, 123L, 714L, 497L, 924L, 21L, 221L, 3544L, 402L, 938L, 178L, ...

  4. .local(object, ..., value)

  5. dispersionMatrix<-(*tmp*, value = matrix(rep(dispersions(dataSet), ncol(dataSet)), ncol = ncol(dataSet), byrow = FALSE))

  6. dispersionMatrix<-(*tmp*, value = matrix(rep(dispersions(dataSet), ncol(dataSet)), ncol = ncol(dataSet), byrow = FALSE))

  7. estimateFun(mrna, condition, baseLevel, mrna_sizeFactor)

  8. xtail(mrna, rpf, condition, bins = 1000)

xtail still works on my system for R-3.6.3 so its not an urgent issue. I was wondering if you were planning to update the code to make compatible with version 4.x.x ? There were quite a few changes (such as the now default data.frame(stringsAsFactors = FALSE) )made so I am unsure were to start looking. If necessary I can also try under a different platform (RHEL or Fedora Linux) to see if the problem persist

Thanks for your help!

xug15 commented 4 years ago

Hi, we develop a docker image that swaps xtail into R to solve this problem. You can see the manual from this link https://hub.docker.com/r/yanglab/xtail .

mflamand commented 4 years ago

Thank you for the reply. Although this probably works great, using a docker is not the best option for me.

If you are interested in fixing the R code for R4.0, or anyone else want's to use it directly, I manage to make it work by doing the following changes:

CoreFuns.R#57 and CoreFuns#58 : add withDimnames=FALSE within assays() methods.R#19 : add withDimnames=FALSE within assays()

This worked by still gave warnings that DESeq2 converted strings to factors in the formula.:

changing xtail.R#48 with : condition=as.factor(condition) fixed those warnings.

The changes to factors are directly caused by the new data.frame behavior, but I am unsure why the SummarizedExperiment assay() behavior have changed.

In any case, running the sample data under R3.6.3 and 4.0.0 gave me the same number of log2FC and log2R

Delayed-Gitification commented 3 years ago

@mflamand your fix worked for me, thank you!

FelixErnst commented 2 years ago

See #18