GreenleafLab / ArchR

ArchR : Analysis of Regulatory Chromatin in R (www.ArchRProject.com)
MIT License
384 stars 137 forks source link

`subscript out of bonds` error when adding motif annotations #2014

Open ndejay opened 1 year ago

ndejay commented 1 year ago

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:

proj <- ArchR::addMotifAnnotations( ArchRProj = proj, name = "JASPAR2022", motifPWMs = pwm_jaspar, force = T )



- #1933
- #1831 
- #1513 

Thanks - any help would be greatly appreciated!

Best,
Nic
rcorces commented 1 year ago

Hi @ndejay! Thanks for using ArchR! Please make sure that your post belongs in the Issues section. Only bugs and error reports belong in the Issues section. Usage questions and feature requests should be posted in the Discussions section, not in Issues.
It is worth noting that there are very few actual bugs in ArchR. If you are getting an error, it is probably something specific to your dataset, usage, or computational environment, all of which are extremely challenging to troubleshoot. As such, we require reproducible examples (preferably using the tutorial dataset) from users who want assistance. If you cannot reproduce your error, we will not be able to help. Before going through the work of making a reproducible example, search the previous Issues, Discussions, function definitions, or the ArchR manual and you will likely find the answers you are looking for. If your post does not contain a reproducible example, it is unlikely to receive a response.
In addition to a reproducible example, you must do the following things before we help you, unless your original post already contained this information: 1. If you've encountered an error, have you already searched previous Issues to make sure that this hasn't already been solved? 2. Did you post your log file? If not, add it now. 3.__ Remove any screenshots that contain text and instead copy and paste the text using markdown's codeblock syntax (three consecutive backticks). You can do this by editing your original post.