Skip to content

Commit 7e88470

Browse files
committed
add comment message to understand codes better
1 parent e2e300a commit 7e88470

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

R/bambu-extendAnnotations-utilityCombine.R

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ isore.combineTranscriptCandidates <- function(readClassList,
1919
min.readCount, min.readFractionByGene,
2020
min.txScore.multiExon, min.txScore.singleExon, verbose) %>% data.table()
2121
combinedSplicedTranscripts[,confidenceType := "highConfidenceJunctionReads"]
22-
if (min.txScore.singleExon == 1) {return(combinedSplicedTranscripts)}
22+
# when single exon min score is 1, skip unspliced transcripts combination
23+
# by right, estimated txScore will not reach 1
24+
if (min.txScore.singleExon == 1)
25+
return(combinedSplicedTranscripts)
2326
combinedUnsplicedTranscripts <-
2427
combineUnsplicedTranscriptModels(readClassList, bpParameters,
2528
stranded, min.readCount, min.readFractionByGene,
@@ -36,11 +39,11 @@ isore.combineTranscriptCandidates <- function(readClassList,
3639
combineSplicedTranscriptModels <- function(readClassList, bpParameters,
3740
min.readCount, min.readFractionByGene, min.txScore.multiExon,
3841
min.txScore.singleExon, verbose){
39-
bpParameters$progressbar = FALSE
42+
bpParameters$progressbar <- FALSE
4043
options(scipen = 999) #maintain numeric basepair locations not sci.notfi.
4144
start.ptm <- proc.time()
4245
n_sample <- length(readClassList)
43-
nGroups = max(ceiling(n_sample/10),min(bpworkers(bpParameters),
46+
nGroups <- max(ceiling(n_sample/10),min(bpworkers(bpParameters),
4447
round(n_sample/2)))
4548
indexList <- sample(rep(seq_len(nGroups), length.out=n_sample))
4649
indexList <- splitAsList(seq_len(n_sample), indexList)
@@ -135,7 +138,7 @@ combineFeatureTibble <- function(combinedFeatureTibble,
135138
maxTxScore.noFit, NSampleReadCount, NSampleReadProp,NSampleTxScore,
136139
starts_with('start'), starts_with('end'), starts_with('readCount'))
137140
} else {
138-
combinedTable = full_join(combinedFeatureTibble,
141+
combinedTable <- full_join(combinedFeatureTibble,
139142
featureTibbleSummarised, by = c('intronStarts', 'intronEnds', 'chr',
140143
'strand'), suffix=c('.combined','.new')) %>%
141144
mutate(NSampleReadCount=pmax0NA(NSampleReadCount.combined) +
@@ -215,7 +218,7 @@ combineUnsplicedTranscriptModels <-
215218
min.readFractionByGene, min.txScore.multiExon,
216219
min.txScore.singleExon, verbose){
217220
start.ptm <- proc.time()
218-
bpParameters$progressbar = FALSE
221+
bpParameters$progressbar <- FALSE
219222
newUnsplicedSeList <-
220223
bplapply(seq_along(readClassList), function(sample_id)
221224
extractNewUnsplicedRanges(readClassSe =
@@ -292,7 +295,7 @@ reduceUnsplicedRanges <- function(rangesList, stranded){
292295
makeUnsplicedTibble <- function(combinedNewUnsplicedSe,newUnsplicedSeList,
293296
colDataNames,min.readCount, min.readFractionByGene,
294297
min.txScore.multiExon, min.txScore.singleExon, bpParameters){
295-
bpParameters$progressbar = FALSE
298+
bpParameters$progressbar <- FALSE
296299
newUnsplicedTibble <- as_tibble(combinedNewUnsplicedSe) %>%
297300
rename(chr = seqnames) %>% select(chr, start, end, strand, row_id) %>%
298301
separate_rows(row_id, sep = "\\+")

0 commit comments

Comments
 (0)