PopSV
PopSV copied to clipboard
Error when running the testthat.R script
My goal is to run 70 samples with a batch script, but currently, I am already struggling with the testthat.R script. Help would be much appreciated.
R/4.2.2-mkl
Warning messages: 1: replacing previous import ‘GenomicRanges::shift’ by ‘data.table::shift’ when loading ‘PopSV’ 2: replacing previous import ‘GenomicRanges::subtract’ by ‘magrittr::subtract’ when loading ‘PopSV’ [E::get_intv] Failed to parse TBX_GENERIC, was wrong -p [type] used? The offending line was: "chr start end bc" [E::hts_idx_push] Invalid record on sequence #1: end 1 < begin 90002 [E::get_intv] Failed to parse TBX_GENERIC, was wrong -p [type] used? The offending line was: "chr start end pv qv" [E::get_intv] Failed to parse TBX_GENERIC, was wrong -p [type] used? The offending line was: "chr start end s1 s2 s3 s4 s5 s6 s7 s8 s9 s10" [E::get_intv] Failed to parse TBX_GENERIC, was wrong -p [type] used? The offending line was: "chr start end m sd" [E::get_intv] Failed to parse TBX_GENERIC, was wrong -p [type] used? The offending line was: "chr start end s1 s2 s3 s4 s5 s6 s7 s8 s9 s10" [E::get_intv] Failed to parse TBX_GENERIC, was wrong -p [type] used? ... The offending line was: "chr start end fc" [E::get_intv] Failed to parse TBX_GENERIC, was wrong -p [type] used? The offending line was: "chr start end fc" [ FAIL 23 | WARN 10 | SKIP 4 | PASS 206 ]
══ Skipped tests ════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════ • empty test (4)
══ Failed tests ═════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
── Error (test-binbam.R:53): Writes files ──────────────────────────────────────
Error in value[[3L]](cond)
: index build failed
file: test.tsv.bgz
Backtrace:
▆
- └─PopSV::bin.bam(bam.f, bin.df, outfile.prefix = "test.tsv", appendIndex.outfile = TRUE) at test-binbam.R:53:2
- └─Rsamtools::indexTabix(final.file, format = "bed")
-
└─base::tryCatch(...)
-
└─base (local) tryCatchList(expr, classes, parentenv, handlers)
-
└─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
-
└─value[[3L]](cond)
── Error (test-freq.R:24): The number of regions is similar in annotation mode ──
Error in (function (cond) .Internal(C_tryCatchHelper(addr, 1L, cond)))(structure(list(message = c(i = "In argument:
chunk = cut(1:n(), 1 + ceiling(n()/chunk.size))."), trace = structure(list(call = list(freq.range(bin.df, annotate.only = TRUE), range.df %>% dplyr::ungroup(.) %>% dplyr::mutate(chunk = cut(1:n(), 1 + ceiling(n()/chunk.size))) %>% dplyr::group_by(chunk) %>% dplyr::do(freq.chunk(.)) %>% dplyr::ungroup(.) %>% dplyr::select(-chunk) %>% as.data.frame, as.data.frame(.), dplyr::select(., -chunk), dplyr::ungroup(.), dplyr::do(., freq.chunk(.)), dplyr::group_by(., chunk), dplyr::mutate(., chunk = cut(1:n(), 1 + ceiling(n()/chunk.size))), mutate.data.frame(., chunk = cut(1:n(), 1 + ceiling(n()/chunk.size))), mutate_cols(.data, dplyr_quosures(...), by), withCallingHandlers(for (i in seq_along(dots)) { poke_error_context(dots, i, mask = mask) context_poke("column", old_current_column) new_columns <- mutate_col(dots[[i]], data, mask, new_columns) }, error = dplyr_error_handler(dots = dots, mask = mask, bullets = mutate_bullets, error_call = error_call, error_class = "dplyr:::mutate_error"), warning = dplyr_warning_handler(state = warnings_state, mask = mask, error_call = error_call)), mutate_col(dots[[i]], data, mask, new_columns), mask$eval_all_mutate(quo), eval(), cut(1:n(), 1 + ceiling(n()/chunk.size)), .handleSimpleError(
, "could not find function \"n\"", base::quote(n())), h(simpleError(msg, call)), abort(message, class = error_class, parent = parent, call = error_call)), parent = c(0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 9L, 10L, 10L, 12L, 13L, 0L, 0L, 16L, 17L), visible = c(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE), namespace = c("PopSV", NA, "BiocGenerics", "dplyr", "dplyr", "dplyr", "dplyr", "dplyr", "dplyr", "dplyr", "base", "dplyr", NA, "dplyr", "base", "base", "dplyr", "rlang" ), scope = c("::", NA, "::", "::", "::", "::", "::", "::", ":::", ":::", "::", ":::", NA, "local", "::", "::", "local", "::"), error_frame = c(FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE)), row.names = c(NA, -18L), version = 2L, class = c("rlang_trace", "rlib_trace", "tbl", "data.frame")), parent = structure(list( message = "could not find function \"n\"", call = n()), class = c("simpleError", "error", "condition")), rlang = list(inherit = TRUE), call = dplyr::mutate(., chunk = cut(1:n(), 1 + ceiling(n()/chunk.size))), use_cli_format = TRUE), class = c("dplyr:::mutate_error", "rlang_error", "error", "condition")))
: error in evaluating the argument 'x' in selecting a method for function 'as.data.frame': ℹ In argument: chunk = cut(1:n(), 1 + ceiling(n()/chunk.size))
.
Caused by error in n()
:
! could not find function "n"
Backtrace:
▆
- ├─PopSV::freq.range(bin.df, annotate.only = TRUE) at test-freq.R:24:2
- │ └─... %>% as.data.frame
- ├─BiocGenerics::as.data.frame(.)
- ├─dplyr::select(., -chunk)
- ├─dplyr::ungroup(.)
- ├─dplyr::do(., freq.chunk(.))
- ├─dplyr::group_by(., chunk)
- ├─dplyr::mutate(., chunk = cut(1:n(), 1 + ceiling(n()/chunk.size)))
- ├─dplyr:::mutate.data.frame(., chunk = cut(1:n(), 1 + ceiling(n()/chunk.size)))
- │ └─dplyr:::mutate_cols(.data, dplyr_quosures(...), by)
- │ ├─base::withCallingHandlers(...)
- │ └─dplyr:::mutate_col(dots[[i]], data, mask, new_columns)
- │ └─mask$eval_all_mutate(quo)
- │ └─dplyr (local) eval()
- ├─base::cut(1:n(), 1 + ceiling(n()/chunk.size))
- ├─base::.handleSimpleError(...)
- │ └─dplyr (local) h(simpleError(msg, call))
- │ └─rlang::abort(message, class = error_class, parent = parent, call = error_call)
- │ └─rlang:::signal_abort(cnd, .file)
- │ └─base::signalCondition(cnd)
- └─base (local)
<fn>
(<dply:::_>
) ── Error (test-graphs.R:24): Chromosome plots ────────────────────────────────── Error inif (chr.position == "vertical") { ggp = ggp + ggplot2::facet_grid(chr ~ ., scales = "free") }
: the condition has length > 1 Backtrace: ▆ - └─PopSV::chrplot(res.df, bin.size = 3e+06) at test-graphs.R:24:14 ── Error (test-graphs.R:48): Example graph works with its many parameters ────── Error: id variables not found in data: chr, start, end Backtrace: ▆
- └─PopSV::coverage.plot(1, 100, 130, bc.f, flanks = 50) at test-graphs.R:48:14
- └─base::lapply(...)
-
└─PopSV (local) FUN(X[[i]], ...)
-
└─reshape::melt.data.frame(...)
-
└─reshape::melt_check(data, id.vars, measure.vars)
── Failure (test-qcSamples.R:40): Writes output files correctly ──────────────── dim(bcm) not equal to c(nrow(bin.df), 7). 1/2 mismatches [1] 95 - 100 == -5 ── Failure (test-qcSamples.R:45): Writes output files correctly ──────────────── dim(bcm) not equal to c(nrow(bin.sub), 7). 1/2 mismatches [1] 19 - 20 == -1 ── Failure (test-qcSamples.R:54): Works with different chunk sizes ───────────── dim(bcm) not equal to c(nrow(bin.df), 7). 1/2 mismatches [1] 95 - 100 == -5 ── Failure (test-qcSamples.R:58): Works with different chunk sizes ───────────── dim(bcm) not equal to c(nrow(bin.df), 7). 1/2 mismatches [1] 95 - 100 == -5 ── Failure (test-qcSamples.R:67): Works with different columns ───────────────── dim(bcm) not equal to c(nrow(bin.df), 7). 1/2 mismatches [1] 95 - 100 == -5 ── Failure (test-qcSamples.R:85): Samples and coordinates are correctly merged ── rank(bc2$bc) not equal to rank(bcm[, samps[2]]). Lengths differ: 100 is not 95 ── Failure (test-tabix.R:34): Reads subsets ──────────────────────────────────── df$bc not equal to b1.df$bc[ii]. Lengths differ: 2 is not 10 ── Failure (test-tabix.R:35): Reads subsets ──────────────────────────────────── df$chr not equal to b1.df$chr[ii]. Lengths differ: 2 is not 10 ── Failure (test-tabix.R:36): Reads subsets ──────────────────────────────────── df$start not equal to b1.df$start[ii]. Lengths differ: 2 is not 10 ── Failure (test-tabix.R:39): Reads subsets ──────────────────────────────────── df$bc not equal to b1.df$bc[ii]. Lengths differ: 92 is not 100 ── Failure (test-tabix.R:40): Reads subsets ──────────────────────────────────── df$chr not equal to b1.df$chr[ii]. Lengths differ: 92 is not 100 ── Failure (test-tabix.R:41): Reads subsets ──────────────────────────────────── df$start not equal to b1.df$start[ii]. Lengths differ: 92 is not 100 ── Failure (test-tabix.R:44): Reads subsets ──────────────────────────────────── df$bc not equal to b1.df$bc[ii]. Lengths differ: 492 is not 500 ── Failure (test-tabix.R:45): Reads subsets ──────────────────────────────────── df$chr not equal to b1.df$chr[ii]. Lengths differ: 492 is not 500 ── Failure (test-tabix.R:46): Reads subsets ──────────────────────────────────── df$start not equal to b1.df$start[ii]. Lengths differ: 492 is not 500 ── Failure (test-tabix.R:108): Checks for bins missing columns ───────────────── nrow(read.bedix("test.tsv", good.df)) not equal to nrow(good.df). 1/1 mismatches [1] 992 - 1000 == -8 ── Failure (test-tabix.R:127): Factors doesn't cause errors ──────────────────── df$bc not equal to b1.df$bc[ii]. Lengths differ: 2 is not 10 ── Failure (test-tabix.R:128): Factors doesn't cause errors ──────────────────── df$chr not equal to b1.df$chr[ii]. Lengths differ: 2 is not 10 ── Failure (test-tabix.R:129): Factors doesn't cause errors ──────────────────── df$start not equal to b1.df$start[ii]. Lengths differ: 2 is not 10
[ FAIL 23 | WARN 10 | SKIP 4 | PASS 206 ] Error: Test failures Execution halted