GreenleafLab / ArchR

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

Subscript out of bounds error running addIterativeLSI #1496

Closed prmunn closed 2 years ago

prmunn commented 2 years ago

Running proj <- addIterativeLSI(ArchRProj = proj, useMatrix = "TileMatrix", name = "IterativeLSI", threads = 1, force = TRUE) Getting the following error: Checking Inputs... ArchR logging to : ArchRLogs/ArchR-addIterativeLSI-1a0b27423b2a8-Date-2022-06-29_Time-14-24-15.log If there is an issue, please report to github with logFile! 2022-06-29 14:24:16 : Computing Total Across All Features, 0.003 mins elapsed. 2022-06-29 14:24:18 : Computing Top Features, 0.032 mins elapsed. ########### 2022-06-29 14:24:19 : Running LSI (1 of 2) on Top Features, 0.058 mins elapsed. ########### 2022-06-29 14:24:19 : Sampling Cells (N = 10003) for Estimated LSI, 0.059 mins elapsed. 2022-06-29 14:24:19 : Creating Sampled Partial Matrix, 0.059 mins elapsed. 2022-06-29 14:24:24 : Computing Estimated LSI (projectAll = FALSE), 0.134 mins elapsed.


2022-06-29 14:24:28 : ERROR Found in .computeLSI for
LogFile = ArchRLogs/ArchR-addIterativeLSI-1a0b27423b2a8-Date-2022-06-29_Time-14-24-15.log

<simpleError in allLSI[cn, , drop = FALSE]: subscript out of bounds>



2022-06-29 14:24:28 : ERROR Found in .LSIPartialMatrix for
LogFile = ArchRLogs/ArchR-addIterativeLSI-1a0b27423b2a8-Date-2022-06-29_Time-14-24-15.log

<simpleError in .logError(e, fn = ".computeLSI", info = "", errorList = errorList, logFile = logFile): Exiting See Error Above>


Error in .logError(e, fn = ".LSIPartialMatrix", info = "", errorList = errorList, : Exiting See Error Above

ArchR-addIterativeLSI-1a0b27423b2a8-Date-2022-06-29_Time-14-24-15.log

Any idea what is causing this?

rcorces commented 2 years ago

Hi @prmunn! 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.
Before we help you, you must respond to the following questions 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. Can you recapitulate your error using the tutorial code and dataset? If so, provide a reproducible example. 3. Did you post your log file? If not, add it now. 4. 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.

prmunn commented 2 years ago
  1. I didn't find this bug in previous issues
  2. This code was mostly copied from the tutorial - the bug does not appear to happen with the tutorial datasets
  3. Log file posted
  4. No screen shots
rcorces commented 2 years ago

Interesting. I havent seen this one. It is coming from code related to re-projection of outlier cells in the LSI. https://github.com/GreenleafLab/ArchR/blob/041882c7d123ab6288aa37fa33fa6add54ca833e/R/IterativeLSI.R#L1205

My first ask would be to install the latest dev branch (release_1.0.2) and try that. Though I'm not very confident that will change anything. If that fails, you could try setting outlierQuantiles = NULL and I would guess it should run but that doesnt explain why you get the error. Let me know if either solution works. If the latest dev branch doesnt fix it, I can add a few more error reporting things to see if it becomes clear what the problem is. Its possible there is a transposition issue with the matrix but then I would be surprised nobody has encountered this issue before.

prmunn commented 2 years ago

Setting outlierQuantiles = NULL worked using release 1.0.1 Haven't tried it with the latest release yet. Many thanks!

rcorces commented 2 years ago

I'm going to leave this open because I think there is an underlying problem that may actually be a bug.

rcorces commented 2 years ago

Actually. I just tested this more comprehensively on the tutorial data and I dont think there is an obvious bug. Could be something obscure with project subsetting but I'm just going to leave this closed and if someone else runs into the error then I'll investigate more seriously.

jindalk commented 2 years ago

Fyi, I have been trying to adapt ArchR to a non-ATAC single cell genome wide assay and I ran into this bug as well (release 1.0.2), setting outlierQuantiles to NULL fixed it. Could be something dataset specific here, since this dataset is much sparser than conventional scATAC ones. I would understand if this is of less interest though, since non-ATAC applications aren't officially supported.

rcorces commented 2 years ago

My assumption would be that there are some odd-ball cells in your dataset, either with very low fragment counts or something similar. I'm happy to re-open this but I dont have a test dataset to help figure out the problem.

jindalk commented 2 years ago

Yeah I think that is likely the case, for now just setting outlierQuantiles to NULL seems to be working fine for us. If this becomes a bigger issue in the future for us I could come back to this and perhaps share some test data to help figure it out.

Thank you!