Skip to content

Commit bc3c527

Browse files
author
Josh Chiou
authored
Update GroupExport.R
Calculating tilesk for each chromosome separately reduces memory usage and is compatible with 1 bp resolution. Solution for #853
1 parent 05bdf29 commit bc3c527

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

R/GroupExport.R

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ getGroupBW <- function(
339339
availableChr <- .availableSeqnames(head(getArrowFiles(ArchRProj)))
340340
chromLengths <- getChromLengths(ArchRProj)
341341
chromSizes <- getChromSizes(ArchRProj)
342-
tiles <- unlist(slidingWindows(chromSizes, width = tileSize, step = tileSize))
342+
#tiles <- unlist(slidingWindows(chromSizes, width = tileSize, step = tileSize))
343343

344344
#H5 File Lock Check
345345
h5lock <- setArchRLocking()
@@ -363,6 +363,7 @@ getGroupBW <- function(
363363
cellsInArrow = cellsInArrow,
364364
availableChr = availableChr,
365365
chromLengths = chromLengths,
366+
chromSizes = chromSizes,
366367
normMethod = normMethod,
367368
normBy = normBy,
368369
ceiling = ceiling,
@@ -391,7 +392,8 @@ getGroupBW <- function(
391392
ArrowFiles = NULL,
392393
cellsInArrow = NULL,
393394
availableChr = NULL,
394-
chromLengths = NULL,
395+
chromLengths = NULL,
396+
chromSizes = NULL,
395397
tiles = NULL,
396398
ceiling = NULL,
397399
tileSize = 100,
@@ -430,7 +432,9 @@ getGroupBW <- function(
430432
}
431433
}
432434

433-
tilesk <- tiles[BiocGenerics::which(seqnames(tiles) %bcin% availableChr[k])]
435+
chromSizesk <- chromSizes[BiocGenerics::which(seqnames(chromSizes) %bcin% availableChr[k])]
436+
tilesk <- unlist(slidingWindows(chromSizesk, width = tileSize, step = tileSize))
437+
#tilesk <- tiles[BiocGenerics::which(seqnames(tiles) %bcin% availableChr[k])]
434438

435439
if(length(fragik) == 0){
436440

0 commit comments

Comments
 (0)