Skip to content

Commit

Permalink
Attempt to remove altcontigs if they somehow made it into the coverag…
Browse files Browse the repository at this point in the history
…e files.
  • Loading branch information
lima1 committed Feb 11, 2022
1 parent fe1a456 commit ed225cf
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
11 changes: 8 additions & 3 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Changes in version 2.2.0
------------------------

NEW FEATURES

o Added chunks parameter to Coverage.R and calculateBamCoverageByInterval
to reduce memory usage (#218)

Expand All @@ -11,15 +12,19 @@ SIGNIFICANT USER-VISIBLE CHANGES
calculate the minimum number of supporting reads (instead of assuming a
default BQ of 30). By default BQ is capped at 50 and variants below 25
are ignored. Set min.supporting.reads to 0 to turn this off (#206).
o More robust annotation of intervals with gene symbols
o More robust annotation of intervals with gene symbols
o Remove chrosomes not present in the centromeres GRanges object; useful
to remove altcontigs somehow present (should not happen with intervals
generated by IntervalFile.R)

BUGFIXES

o Fixed an issue with old R versions where factors were not converted to
strings, resulting in numbers instead of gene symbols
o Fix for a crash when there are no off-target reads in off-target regions
(#209).

(#209).
o Fixed parsing of base quality scores in Mutect 2.2


Changes in version 2.0.0
------------------------
Expand Down
14 changes: 14 additions & 0 deletions R/filterIntervals.R
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,20 @@ normalDB.min.coverage, normalDB.max.missing) {
intervalsUsed
}

.filterIntervalsCentromeres <- function(intervalsUsed, tumor, centromeres) {
if (is.null(centromeres)) return(intervalsUsed)
nBefore <- sum(intervalsUsed)
intervalsUsed <- intervalsUsed & seqnames(tumor) %in% seqlevels(centromeres)
nAfter <- sum(intervalsUsed)

if (nAfter < nBefore) {
flog.info("Removing %i intervals on non-standard chromosomes not listed in centromeres (%s).",
nBefore - nAfter,
paste(seqlevels(tumor)[!seqlevels(tumor) %in% seqlevels(centromeres)], collapse = ","))
}
intervalsUsed
}

.filterIntervalsTargetedBase <- function(intervalsUsed, tumor, min.targeted.base) {
if (is.null(min.targeted.base)) return(intervalsUsed)
nBefore <- sum(intervalsUsed)
Expand Down
9 changes: 6 additions & 3 deletions R/runAbsoluteCN.R
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,10 @@ runAbsoluteCN <- function(normal.coverage.file = NULL,
if (!is.null(interval.file)) {
tumor <- .addGCData(tumor, interval.file)
}
if (is.null(centromeres) && !missing(genome)) {
centromeres <- .getCentromerePositions(centromeres, genome,
if (is.null(tumor)) NULL else .getSeqlevelsStyle(tumor))
}

args.filterIntervals <- c(list(normal = normal, tumor = tumor,
log.ratio = log.ratio, seg.file = seg.file,
Expand All @@ -437,6 +441,7 @@ runAbsoluteCN <- function(normal.coverage.file = NULL,

# chr.hash is an internal data structure, so we need to do this separately.
intervalsUsed <- .filterIntervalsChrHash(intervalsUsed, tumor, chr.hash)
intervalsUsed <- .filterIntervalsCentromeres(intervalsUsed, tumor, centromeres)
intervalsUsed <- which(intervalsUsed)
if (length(tumor) != length(normal) ||
length(tumor) != length(log.ratio)) {
Expand Down Expand Up @@ -573,10 +578,8 @@ runAbsoluteCN <- function(normal.coverage.file = NULL,

flog.info("Sample sex: %s", sex)
flog.info("Segmenting data...")
segProvided <- readSegmentationFile(seg.file, sampleid, model.homozygous = model.homozygous)

centromeres <- .getCentromerePositions(centromeres, genome,
if (is.null(vcf)) NULL else .getSeqlevelsStyle(vcf))
segProvided <- readSegmentationFile(seg.file, sampleid, model.homozygous = model.homozygous)

args.segmentation <- c(list(normal = normal, tumor = tumor, log.ratio = log.ratio,
seg = segProvided, plot.cnv = plot.cnv,
Expand Down

0 comments on commit ed225cf

Please sign in to comment.