Skip to content

Commit

Permalink
Merge 2452039 into 4178499
Browse files Browse the repository at this point in the history
  • Loading branch information
andredsim committed Aug 23, 2023
2 parents 4178499 + 2452039 commit f605007
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions R/bambu_utilityFunctions.R
Original file line number Diff line number Diff line change
Expand Up @@ -184,24 +184,27 @@ handleWarnings <- function(readClassList, verbose){
sampleNames = c()
for(i in seq_along(readClassList)){
readClassSe = readClassList[[i]]
if (is.character(readClassSe))
readClassSe <- readRDS(file = readClassSe)
warnings[[i]] = metadata(readClassSe)$warnings
if (is.character(readClassSe)){
readClassSe <- readRDS(file = readClassSe)}
warnings[[i]] = NA
if(!is.null(metadata(readClassSe)$warnings)){
warnings[[i]] = metadata(readClassSe)$warnings}
sampleNames = c(sampleNames, colnames(readClassList[[i]]))
}
names(warnings) = sampleNames

if(verbose & any(lengths(warnings)>0)){
if(verbose & any(!is.na(warnings))){
message("--- per sample warnings during read class construction ---")
for(i in seq_along(warnings)){
if(lengths(warnings)[i]>0){
message("Warnings for: ", sampleNames[i])
sapply(warnings[[i]], message)
}
warnings.tmp = warnings[!is.na(warnings)]
for(i in seq_along(warnings.tmp)){
message("Warnings for: ", names(warnings.tmp)[i])
sapply(warnings.tmp[[i]], message)
}
} else {
message("Detected ", sum(lengths(warnings)), " warnings across the samples during ",
"read class construction. Access warnings with metadata(bambuOutput)$warnings")
warningCount = sum(lengths(warnings[!is.na(warnings)]))
if(warningCount > 0){
message("Detected ", warningCount, " warnings across the samples during ",
"read class construction. Access warnings with metadata(bambuOutput)$warnings")}
}
return(warnings)
}
Expand Down

0 comments on commit f605007

Please sign in to comment.