markrobinsonuzh / CrispRVariants

22 stars 4 forks source link

Error readsToTargets with many samples #8

Open jehenninger opened 6 years ago

jehenninger commented 6 years ago

Sometimes when I use readsToTargets on many samples with multiple targets (5 in this case), I get the following error (and I included the traceback()):

"Counting variant combinations

Error in value[[jj]][ri, ] <- xij : incorrect number of subscripts on matrix

traceback() 20: stop(e) 19: value[3L] 18: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 17: tryCatchList(expr, classes, parentenv, handlers) 16: tryCatch({ FUN(...) }, error = handle_error) 15: withCallingHandlers({ tryCatch({ FUN(...) }, error = handle_error) }, warning = handle_warning) 14: FUN(X[[i]], ...) 13: lapply(X, FUN, ...) 12: BiocParallel::bplapply(seq_along(bamByPCR), function(i) { bams <- bamByPCR[[i]] tgt <- tg_gr[[i]] chs <- chimerasByPCR[[i]] ref <- references[[i]] if (isTRUE(verbose)) { message(sprintf("\n\nWorking on target %s\n", names(tgt))) } cset <- alnsToCrisprSet(bams, ref, tgt, reverse.complement, collapse.pairs, names, use.consensus, target.loc, verbose, chimeras = chs, orientation = orientation, ...) }, BPPARAM = bpparam) 11: BiocParallel::bplapply(seq_along(bamByPCR), function(i) { bams <- bamByPCR[[i]] tgt <- tg_gr[[i]] chs <- chimerasByPCR[[i]] ref <- references[[i]] if (isTRUE(verbose)) { message(sprintf("\n\nWorking on target %s\n", names(tgt))) } cset <- alnsToCrisprSet(bams, ref, tgt, reverse.complement, collapse.pairs, names, use.consensus, target.loc, verbose, chimeras = chs, orientation = orientation, ...) }, BPPARAM = bpparam) 10: .local(reads, targets, ...) 9: readsToTargets(bams, targets, references = references, target.loc = target.loc, verbose = verbose, reverse.complement = reverse.complement, ignore.strand = ignore.strand, collapse.pairs = collapse.pairs, names = names, bpparam = bpparam, use.consensus = use.consensus, chimera.to.target = chimera.to.target, orientation = orientation) 8: readsToTargets(bams, targets, references = references, target.loc = target.loc, verbose = verbose, reverse.complement = reverse.complement, ignore.strand = ignore.strand, collapse.pairs = collapse.pairs, names = names, bpparam = bpparam, use.consensus = use.consensus, chimera.to.target = chimera.to.target, orientation = orientation) 7: .local(reads, targets, ...) 6: readsToTargets(file.path(samples[[i]]$bamfile), targets = gdl[gene_idx], references = reference[gene_idx], names = samples[[i]]$group, target.loc = 22, verbose = TRUE) 5: readsToTargets(file.path(samples[[i]]$bamfile), targets = gdl[gene_idx], references = reference[gene_idx], names = samples[[i]]$group, target.loc = 22, verbose = TRUE) at myCrisprVariantsScript.R#104 4: eval(ei, envir) 3: eval(ei, envir) 2: withVisible(eval(ei, envir))"

The error is a bit too cryptic for me to debug. Every sample has reads, although some of the samples won't have mutations in some of the targets. Most of the time, this function works completely fine.

HLindsay commented 6 years ago

Hi,

I suspect the error happens when no reads are assigned to one of the guides for some reason, but so far I haven't been able figure out what exactly causes this. Would it be possible for you to send me some data that replicates the problem? If not, could you send me the results of running sessionInfo()? Do your guide sequences overlap, and are you using only the guide locations or also the PCR primers for distinguishing them?

Best, Helen