Skip to content
Snippets Groups Projects

Return an error if consensus peaks overlap

Merged Rim Moussa requested to merge overlapping-peak-fix into master
1 file
+ 14
0
Compare changes
  • Side-by-side
  • Inline
+ 14
0
@@ -499,6 +499,20 @@ overlapPeaksAndTFBS <- function(GRN, nCores = 2, forceRerun = FALSE) {
# Construct GRanges
consensus.gr = .constructGRanges(GRN@data$peaks$consensusPeaks, seqlengths = seqlengths, genomeAssembly)
consensus.gr.reduced = reduce(consensus.gr) # overlap the peaks
if (length(consensus.gr.reduced) < length(consensus.gr)){
message = paste0("Overlapping peaks have been identified. This is not supported by the package.")
# use the code below if you wish to return the peakIDs for the overlapping peaks:
# overlap.matrix = findOverlaps(setdiff(consensus.gr.reduced, consensus.gr), consensus.gr, maxgap=0) %>%
# mutate(filtered=TRUE) %>%
# spread(subjectHits, filtered, fill = FALSE)
# overlap.peakIDs = apply(overlap.matrix[,-1],1,function(x){return (paste(consensus.gr$peakID[unlist(x)], collapse=";"))})
.checkAndLogWarningsAndErrors(NULL, message, isWarning = FALSE)
}
res.l = .execInParallelGen(nCores, returnAsList = TRUE, listNames = GRN@config$allTF,
iteration = 1:length(GRN@config$allTF),
verbose = FALSE,
Loading