Skip to content

subscript out of bounds error in addIterativeLSI on Ubuntu but works on Windows #2319

@shaoxiong2588

Description

@shaoxiong2588

Hello,
I'm encountering an error when running addIterativeLSI on Ubuntu, while the same code works successfully on Windows with my own data. The tutorial data works fine on both systems.

Working Code (Tutorial Data):
rlibrary(ArchR)
library(parallel)

inputFiles <- c("HemeFragments/scATAC_BMMC_R1.fragments.tsv.gz",
"HemeFragments/scATAC_CD34_BMMC_R1.fragments.tsv.gz",
"HemeFragments/scATAC_PBMC_R1.fragments.tsv.gz")
names(inputFiles) <- c("scATAC_BMMC_R1","scATAC_CD34_BMMC_R1","scATAC_PBMC_R1")

addArchRGenome("hg19")
addArchRThreads(threads = 1)

ArrowFiles <- createArrowFiles(
inputFiles = inputFiles,
sampleNames = names(inputFiles),
minTSS = 4,
minFrags = 1000,
addTileMat = TRUE,
addGeneScoreMat = TRUE
)

projHeme1 <- ArchRProject(
ArrowFiles = ArrowFiles,
outputDirectory = "HemeTutorial",
copyArrows = TRUE
)

This works fine

projHeme1 <- addIterativeLSI(
ArchRProj = projHeme1,
useMatrix = "TileMatrix",
name = "IterativeLSI",
iterations = 2,
clusterParams = list(
resolution = c(0.2),
sampleCells = 10000,
n.start = 10
),
varFeatures = 25000,
dimsToUse = 1:30
)

Failing Code (

My Data - Sus scrofa genome):
rlibrary(ArchR)
library(TxDb.Sscrofa.UCSC.susScr11.refGene)
library(BSgenome.Sscrofa.UCSC.susScr11)
library(org.Ss.eg.db)
library(GenomicFeatures)

addArchRLocking(locking = TRUE)

geneAnnotation <- createGeneAnnotation(
TxDb = TxDb.Sscrofa.UCSC.susScr11.refGene,
OrgDb = org.Ss.eg.db
)
genomeAnnotation <- createGenomeAnnotation(genome = BSgenome.Sscrofa.UCSC.susScr11)

inputFiles <- c("/public/home/szzx/dengsx/0_project/brain_singlecell/bash/scATACseq/dnbc4tools_result/LW2_HM_scATACseq/output/fragments.tsv.gz")
names(inputFiles) <- c("LW2_HM")
addArchRThreads(threads = 1)

ArrowFiles <- createArrowFiles(
inputFiles = inputFiles,
sampleNames = names(inputFiles),
geneAnnotation = geneAnnotation,
genomeAnnotation = genomeAnnotation,
minTSS = 4,
minFrags = 1000,
addTileMat = TRUE,
addGeneScoreMat = TRUE
)

projHeme1 <- ArchRProject(
ArrowFiles = ArrowFiles,
outputDirectory = "ArchR_LW2_HM",
copyArrows = TRUE,
geneAnnotation = geneAnnotation,
genomeAnnotation = genomeAnnotation
)

projHeme1 <- saveArchRProject(ArchRProj = projHeme1, outputDirectory = "Save-ProjHeme1", load = TRUE)
projHeme1 <- loadArchRProject(path = "./Save-ProjHeme1")

addArchRLocking(locking = TRUE)

This fails on Ubuntu but works on Windows

projHeme1 <- addIterativeLSI(
ArchRProj = projHeme1,
useMatrix = "TileMatrix",
name = "IterativeLSI",
iterations = 2,
clusterParams = list(
resolution = c(0.2),
sampleCells = 10000,
n.start = 10
),
varFeatures = 25000,
dimsToUse = 1:30
)


**Project Summary Before Error:**

class: ArchRProject
outputDirectory: /public/home/szzx/dengsx/0_project/brain_singlecell/bash/ArchR/test2/ArchR_LW2_HM
samples(1): LW2_HM
sampleColData names(1): ArrowFiles
cellColData names(11): Sample TSSEnrichment ... nFrags nDiFrags
numberOfCells(1): 19440
medianTSS(1): 6.04
medianFrags(1): 11516


**Error Message:**

2026-01-06 11:42:53.285473 : ERROR Found in .computeLSI for
LogFile = ArchRLogs/ArchR-addIterativeLSI-f9c674756b3d-Date-2026-01-06_Time-11-42-07.285761.log
<subscriptOutOfBoundsError in allLSI[cn, , drop = FALSE]: subscript out of bounds>



2026-01-06 11:42:53.295232 : ERROR Found in .LSIPartialMatrix for
LogFile = ArchRLogs/ArchR-addIterativeLSI-f9c674756b3d-Date-2026-01-06_Time-11-42-07.285761.log
<simpleError in .logError(e, fn = ".computeLSI", info = "", errorList = errorList, logFile = logFile): Exiting See Error Above>



**Observations:**
1. The tutorial data (human hg19 genome) works perfectly on Ubuntu
2. My own data (pig susScr11 genome) fails on Ubuntu but works on Windows
3. The error occurs in the `.computeLSI` function with "subscript out of bounds"
4. Arrow file creation succeeds without issues
5. The project has 19,440 cells after filtering (original: 2,309,467 cells)


Any help would be greatly appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions