Hi folks,

I've been told to ask some of my more fun questions on this mailing list instead of Slack. I'm climbing the ladder of submitting my first Bioconductor package (https://gitlab.com/coregenomics/tsshmm) and feel like there are gremlins that keep adding rungs to the top of the ladder. The latest head scratcher from running devtools::check() is a unit test for a trivial 2 line function failing with this gem of an error:


> test_check("tsshmm")
══ Failed tests ════════════════════════════════════════════════════════════════ ── Error (test-tss.R:11:5): replace_unstranded splits unstranded into + and - ── Error in `tryCatchOne(expr, names, parentenv, handlers[[1L]])`: internal logical NA value has been modified
Backtrace:
     █
  1. ├─testthat::expect_equal(...) test-tss.R:11:4
2. │ └─testthat::quasi_label(enquo(expected), expected.label, arg = "expected")
  3. │   └─rlang::eval_bare(expr, quo_get_env(quo))
  4. └─GenomicRanges::GRanges(c("chr:100:+", "chr:100:-"))
  5.   └─methods::as(seqnames, "GRanges")
  6.     └─GenomicRanges:::asMethod(object)
  7.       └─GenomicRanges::GRanges(ans_seqnames, ans_ranges, ans_strand)
  8.         └─GenomicRanges:::new_GRanges(...)
  9.           └─S4Vectors:::normarg_mcols(mcols, Class, ans_len)
 10.             └─S4Vectors::make_zero_col_DFrame(x_len)
 11.               └─S4Vectors::new2("DFrame", nrows = nrow, check = FALSE)
 12.                 └─methods::new(...)
 13.                   ├─methods::initialize(value, ...)
 14.                   └─methods::initialize(value, ...)
 15.                     └─methods::validObject(.Object)
 16.                       └─base::try(...)
 17.                         └─base::tryCatch(...)
18. └─base:::tryCatchList(expr, classes, parentenv, handlers) 19. └─base:::tryCatchOne(expr, names, parentenv, handlers[[1L]])
[ FAIL 1 | WARN 0 | SKIP 0 | PASS 109 ]


The full continuous integration log is here:
https://gitlab.com/coregenomics/tsshmm/-/jobs/1673603868

The function in question is:


replace_unstranded <- function (gr) {
    idx <- strand(gr) == "*"
    if (length(idx) == 0L)
        return(gr)
    sort(c(
        gr[! idx],
        `strand<-`(gr[idx], value = "+"),
        `strand<-`(gr[idx], value = "-")))
}


Also online here:
https://gitlab.com/coregenomics/tsshmm/-/blob/ef5e19a0e2f68fca93665bc417afbcfb6d437189/R/hmm.R#L170-178

... and the unit test is:


test_that("replace_unstranded splits unstranded into + and -", {
    expect_equal(replace_unstranded(GRanges("chr:100")),
                 GRanges(c("chr:100:+", "chr:100:-")))
    expect_equal(replace_unstranded(GRanges(c("chr:100", "chr:200:+"))),
                 sort(GRanges(c("chr:100:+", "chr:100:-", "chr:200:+"))))
})


Also online here:
https://gitlab.com/coregenomics/tsshmm/-/blob/ef5e19a0e2f68fca93665bc417afbcfb6d437189/tests/testthat/test-tss.R#L11-L12

What's interesting is this is *not* reproducible by running devtools::test() but only devtools::check() so as far as I know there isn't a way to interactively debug this while devtools::check() is going on?

Every few days I've seen on that "internal ... value has been modified" which prevents me from running nearly any R commands. Originally I would restart R, but then I found I could clear that error by running gc(). No idea what causes it. Maybe some S4 magic?

Yes, I have downloaded the mailing lists for bioc-devel, r-devel, r-help, and r-package-devel and see no mention of "value has been modified" [1].

Any help appreciated.

Pariksheet



[1] Mailing lists downloader:
#!/bin/bash -x

for url in https://stat.ethz.ch/pipermail/{bioc-devel,r-{devel,help,package-devel}}/
do
    dir=$(basename $url)
    wget \
        --timestamping \
        --no-remove-listing \
        --recursive \
        --level 1 \
        --no-directories \
        --no-host-directories \
        --cut-dirs 2 \
        --directory-prefix "$dir" \
        --accept '*.txt.gz' \
        --relative \
        --no-parent \
        $url
done

_______________________________________________
Bioc-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/bioc-devel

Reply via email to