@@ -62,7 +62,7 @@ bambu.processReads <- function(reads, annotations, genomeSequence,
6262 min.exonOverlap <- isoreParameters [[" min.exonOverlap" ]]
6363
6464 if (processByBam ){ # TODO (JG) [rewrite-processByBam] processByBam can be default to TRUE, possibly remove the part below to combine read classes across files. redundant, difficult to maintain?
65- readClassList <- bplapply(seq_along(reads ), function (i ) { # ### HERE ####
65+ readClassList <- bplapply(seq_along(reads ), function (i ) { # TODO (JG) [rewrite-processByBam] index is hardcoded to 1 and not used here, and also not used in function below
6666 bambu.processReadsByFile(bam.file = reads [i ],
6767 genomeSequence = genomeSequence ,annotations = annotations ,
6868 stranded = stranded , min.readCount = min.readCount ,
@@ -140,13 +140,13 @@ bambu.processReadsByFile <- function(bam.file, genomeSequence, annotations,
140140 if (verbose ) message(names(bam.file )[1 ])
141141 readGrgList <- prepareDataFromBam(bam.file [[1 ]], verbose = verbose , yieldSize = yieldSize , use.names = trackReads , demultiplexed = demultiplexed , cleanReads = cleanReads , dedupUMI = dedupUMI )
142142 if (verbose ) message(paste0(" Number of alignments/reads: " ,length(readGrgList )))
143- warnings <- c()
143+ warnings <- c() # TODO (JG) [warnings] need to be implemented
144144 if (! is.null(barcodesToFilter ) & ! isFALSE(demultiplexed ))
145145 readGrgList <- readGrgList [! (mcols(readGrgList )$ CB %in% barcodesToFilter )]
146146 warnings <- seqlevelCheckReadsAnnotation(readGrgList , annotations )
147147 if (verbose & length(warnings ) > 0 ) warning(paste(warnings ,collapse = " \n " ))
148148 # check seqlevels for consistency, drop ranges not present in genomeSequence
149- refSeqLevels <- seqlevels(genomeSequence )
149+ refSeqLevels <- seqlevels(genomeSequence )
150150 if (! all(seqlevels(readGrgList ) %in% refSeqLevels )) {
151151 refSeqLevels <- intersect(refSeqLevels , seqlevels(readGrgList ))
152152 if (! all(seqlevels(annotations ) %in% refSeqLevels )& (! (length(annotations )== 0 ))) {
@@ -166,7 +166,7 @@ bambu.processReadsByFile <- function(bam.file, genomeSequence, annotations,
166166 readGrgList <- keepSeqlevels(readGrgList , value = refSeqLevels ,
167167 pruning.mode = " coarse" )
168168 # reassign Ids after seqlevels are dropped
169- mcols(readGrgList )$ id <- seq_along(readGrgList )
169+ mcols(readGrgList )$ id <- seq_along(readGrgList ) # TODO (JG) [unused-code] this line is redundant with the line below
170170 }
171171 # removes reads that are outside genome coordinates
172172 badReads <- which(max(end(ranges(readGrgList )))>
@@ -187,7 +187,7 @@ bambu.processReadsByFile <- function(bam.file, genomeSequence, annotations,
187187 if (! isFALSE(demultiplexed )){
188188 mcols(readGrgList )$ sampleID <- as.numeric(mcols(readGrgList )$ CB )
189189 } else {
190- mcols(readGrgList )$ sampleID <- index
190+ mcols(readGrgList )$ sampleID <- index # TODO (JG) [rewrite-processByBam]index option can be removed if t seems to be hardcoded to 1, as this option can't be changed?
191191 }
192192
193193 # construct read classes for each chromosome seperately
@@ -407,7 +407,7 @@ lowMemoryConstructReadClasses <- function(readGrgList, genomeSequence,
407407# ' Check seqlevels for reads and annotations
408408# ' @importFrom GenomeInfoDb seqlevels
409409# ' @noRd
410- seqlevelCheckReadsAnnotation <- function (reads , annotations ){
410+ seqlevelCheckReadsAnnotation <- function (reads , annotations ){ # TODO (JG) [validate-input] should this be done by reading annotations and bam file for chromosome style match? instead of here? downstream of checkinput section we can assume all is correc then?
411411 warnings <- c()
412412 if (length(intersect(seqlevels(reads ),
413413 seqlevels(annotations ))) == 0 )
@@ -425,7 +425,7 @@ seqlevelCheckReadsAnnotation <- function(reads, annotations){
425425# ' Split read class files
426426# ' @importFrom dplyr Matrix
427427# ' @noRd
428- splitReadClassFiles = function (readClassFile ){
428+ splitReadClassFiles = function (readClassFile ){ # TODO (JG) [bambu-modules] this is only used in assignDist, move there? what is this function doing
429429 distTable <- metadata(metadata(readClassFile )$ readClassDist )$ distTable
430430 eqClasses <- distTable %> % group_by(eqClassById ) %> %
431431 distinct(eqClassById , readCount ,GENEID , totalWidth , firstExonWidth , .keep_all = TRUE )
@@ -473,7 +473,7 @@ splitReadClassFiles = function(readClassFile){
473473# ' Split read class files by RC
474474# ' @importFrom Matrix
475475# ' @noRd
476- splitReadClassFilesByRC <- function (readClassFile ){
476+ splitReadClassFilesByRC <- function (readClassFile ){ # TODO (JG) [bambu-modules] this is only used in bambu, part of clustering. Should not be here
477477 counts.table <- tableFunction(rowData(readClassFile )$ sampleIDs )
478478 counts <- sparseMatrix(
479479 i = rep(seq_along(counts.table ), lengths(counts.table )),
@@ -489,6 +489,6 @@ splitReadClassFilesByRC <- function(readClassFile){
489489# Call count: 2 calls, 1 files
490490# ' table sample IDs list column
491491# ' @noRd
492- tableFunction <- function (xList ){
492+ tableFunction <- function (xList ){ # TODO (JG) [bambu-modules] this is only used as part of clustering, should move with the above function
493493 return (lapply(xList , function (x ) table(x )))
494494}
0 commit comments