ArchR icon indicating copy to clipboard operation
ArchR copied to clipboard

`subscript out of bonds` error when adding motif annotations

Open ndejay opened this issue 1 year ago • 1 comments

Hello,

Thanks for this great software suite. It's been working great for me so far, except I keep running into the following error when I try to add motif annotations.

Attach your log file ArchR-addMotifAnnotations-4be527e01aa-Date-2023-08-30_Time-14-40-56.log

Describe the bug I get an error when adding any motif annotation to my ArchR project.

> proj <- ArchR::addMotifAnnotations(ArchRProj = proj, motifSet = "cisbp", name = "Motif_cisbp", force = T)
ArchR logging to : ArchRLogs/ArchR-addMotifAnnotations-4be527e01aa-Date-2023-08-30_Time-14-40-56.log
If there is an issue, please report to github with logFile!
peakAnnotation name already exists! Overriding.
2023-08-30 14:41:57 : Gettting Motif Set, Species : Homo sapiens, 0.083 mins elapsed.
Using version 2 motifs!
2023-08-30 14:42:00 : Finding Motif Positions with motifmatchr!, 0.129 mins elapsed.
Error in (function (cond)  : 
  error in evaluating the argument 'x' in selecting a method for function 'ncol': subscript out of bounds
> traceback()
11: (function (cond) 
    .Internal(C_tryCatchHelper(addr, 1L, cond)))(structure(list(message = "subscript out of bounds", 
        call = motif_mats[[x]], object = list(), subscript = NA_integer_, 
        index = 1L), class = c("subscriptOutOfBoundsError", "error", 
    "condition")))
10: ncol(motif_mats[[x]])
9: IRanges(start = start(ranges[tmp_out$seq_ix[m_ix] + 1]) + tmp_out$pos[m_ix], 
       width = ncol(motif_mats[[x]]))
8: GRanges(seqnames(ranges)[tmp_out$seq_ix[m_ix] + 1], IRanges(start = start(ranges[tmp_out$seq_ix[m_ix] + 
       1]) + tmp_out$pos[m_ix], width = ncol(motif_mats[[x]])), 
       strand = tmp_out$strand[m_ix], score = tmp_out$score[m_ix])
7: FUN(X[[i]], ...)
6: lapply(1:length(motif_mats), function(x) {
       m_ix <- which(tmp_out$motif_ix == x - 1)
       GRanges(seqnames(ranges)[tmp_out$seq_ix[m_ix] + 1], IRanges(start = start(ranges[tmp_out$seq_ix[m_ix] + 
           1]) + tmp_out$pos[m_ix], width = ncol(motif_mats[[x]])), 
           strand = tmp_out$strand[m_ix], score = tmp_out$score[m_ix])
   })
5: matchMotifs_helper(pwms, seqs, bg, p.cutoff, w, out, subject)
4: .local(pwms, subject, ...)
3: motifmatchr::matchMotifs(pwms = motifs, subject = peakSet, genome = BSgenome, 
       out = "positions", p.cutoff = cutOff, w = width)
2: motifmatchr::matchMotifs(pwms = motifs, subject = peakSet, genome = BSgenome, 
       out = "positions", p.cutoff = cutOff, w = width)
1: ArchR::addMotifAnnotations(ArchRProj = proj, motifSet = "cisbp", 
       name = "Motif_cisbp", force = T)

To Reproduce I cannot reproduce the issue using the tutorial hematopoiesis dataset. There is no error in the log file, only in the console.

Expected behavior I expected the peak annotations to be added as in the tutorial hematopoiesis data set.

I also tried the following to no avail:

  • Trying JASPAR
pwm_jaspar <- TFBSTools::getMatrixSet(
  x = JASPAR2022::JASPAR2022,
  opts = list(
  tax_group = "vertebrates",
  species = "9606",
  matrixtype = "PWM"
  )
)

proj <-
  ArchR::addMotifAnnotations(
    ArchRProj = proj,
    name = "JASPAR2022",
    motifPWMs = pwm_jaspar,
    force = T
  )
  • #1933
  • #1831
  • #1513

Thanks - any help would be greatly appreciated!

Best, Nic

ndejay avatar Aug 30 '23 18:08 ndejay