Skip to content

Commit

Permalink
DEV-950: Refactor a bunch of things in gene disruption factory
Browse files Browse the repository at this point in the history
  • Loading branch information
kduyvesteyn committed Oct 31, 2019
1 parent 0f546ad commit eb6819a
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.hartwig.hmftools.common.numeric.Doubles;
import com.hartwig.hmftools.common.variant.structural.annotation.ReportableDisruption;

import org.apache.commons.lang3.tuple.Pair;
Expand Down Expand Up @@ -34,16 +35,17 @@ static List<ReportableGeneDisruption> convert(@NotNull List<ReportableDisruption
Math.min(primaryDisruptionLeft.undisruptedCopyNumber(), primaryDisruptionRight.undisruptedCopyNumber());

Double ploidyLeft = primaryDisruptionLeft.ploidy();
if (ploidyLeft != null && !ploidyLeft.equals(primaryDisruptionRight.ploidy())) {
Double ploidyRight = primaryDisruptionRight.ploidy();
if (ploidyLeft != null && ploidyRight != null && !Doubles.equal(ploidyLeft, ploidyRight)) {
LOGGER.warn("The disrupted copy number of a paired sv is not the same on {}", primaryDisruptionLeft.gene());
}
reportableDisruptions.add(ImmutableReportableGeneDisruption.builder()
.location(primaryDisruptionLeft.chromosome() + primaryDisruptionLeft.chrBand())
.gene(primaryDisruptionLeft.gene())
.type(primaryDisruptionLeft.type())
.range(rangeField(pairedDisruption))
.ploidy(primaryDisruptionLeft.ploidy() >= 0 ? primaryDisruptionLeft.ploidy() : 0)
.undisruptedCopyNumber(lowestUndisruptedCopyNumber >= 0 ? lowestUndisruptedCopyNumber : 0)
.ploidy(primaryDisruptionLeft.ploidy())
.undisruptedCopyNumber(Math.max(0, lowestUndisruptedCopyNumber))
.firstAffectedExon(primaryDisruptionLeft.exonUp())
.build());
} else {
Expand All @@ -52,9 +54,8 @@ static List<ReportableGeneDisruption> convert(@NotNull List<ReportableDisruption
.gene(primaryDisruptionLeft.gene())
.type(primaryDisruptionLeft.type())
.range(rangeField(pairedDisruption))
.ploidy(primaryDisruptionLeft.ploidy() >= 0 ? primaryDisruptionLeft.ploidy() : 0)
.undisruptedCopyNumber(
primaryDisruptionLeft.undisruptedCopyNumber() >= 0 ? primaryDisruptionLeft.undisruptedCopyNumber() : 0)
.ploidy(primaryDisruptionLeft.ploidy())
.undisruptedCopyNumber(Math.max(0, primaryDisruptionLeft.undisruptedCopyNumber()))
.firstAffectedExon(primaryDisruptionLeft.exonUp())
.build());
}
Expand Down

0 comments on commit eb6819a

Please sign in to comment.