From 9e32d3f774697aac6653cbe5f162105420aed954 Mon Sep 17 00:00:00 2001 From: Charles Shale Date: Wed, 6 Mar 2024 16:06:50 +1100 Subject: [PATCH] Sage: added artefact unit test, bumped version --- pom.xml | 2 +- .../hmftools/sage/evidence/ArtefactsTest.java | 35 ++++++++++++++++++- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 985fe90065..cd14453c11 100644 --- a/pom.xml +++ b/pom.xml @@ -84,7 +84,7 @@ 5.34 1.6 4.0.2 - 3.4.1 + 3.4.2 1.2.1 1.3 1.0 diff --git a/sage/src/test/java/com/hartwig/hmftools/sage/evidence/ArtefactsTest.java b/sage/src/test/java/com/hartwig/hmftools/sage/evidence/ArtefactsTest.java index 206831e93a..ff43cefa19 100644 --- a/sage/src/test/java/com/hartwig/hmftools/sage/evidence/ArtefactsTest.java +++ b/sage/src/test/java/com/hartwig/hmftools/sage/evidence/ArtefactsTest.java @@ -259,6 +259,39 @@ record = buildSamRecord(20, cigar, readContextBases, new String(readQualities)); assertEquals(lowQualBase, adjustedBaseQual); } + @Test + public void testSnvWithAdjacentInsert() + { + int pos = 115; + String leftFlank = "AAAATCAGGA"; + String rightFlank = "AAAGGCAGAA"; + + SimpleVariant variant = new SimpleVariant(CHR_1, pos, "G", "T"); + + int varIndex = 15; + String readContextBases = leftFlank + "CTGTTTTTTTTTTTTTTTTTTA" + rightFlank; + + IndexedBases indexBases = new IndexedBases( + pos, varIndex, leftFlank.length(), + readContextBases.length() - rightFlank.length() - 1, rightFlank.length(), readContextBases.getBytes()); + + ArtefactContext artefactContext = ArtefactContext.buildContext(variant, indexBases); + assertNotNull(artefactContext); + + int readLength = readContextBases.length(); + String cigar = format("%dM", readLength); + byte[] readQualities = buildDefaultBaseQuals(readLength); + + byte lowQualBase = 10; + readQualities[varIndex-1] = lowQualBase; + SAMRecord record = buildSamRecord(20, cigar, readContextBases, new String(readQualities)); + record.setReadNegativeStrandFlag(true); + + byte adjustedBaseQual = artefactContext.findApplicableBaseQual(record, varIndex); + + assertEquals(lowQualBase, adjustedBaseQual); + } + @Test public void testSnvBeforeInsert() { @@ -281,7 +314,7 @@ public void testSnvBeforeInsert() ReadContext readContext = new ReadContext(pos, "", 0, "", indexBases, false); IndexedBases indexedRefBases = new IndexedBases(100, 0, refBases.getBytes()); - QualityCalculator qualityCalculator = new QualityCalculator(TEST_CONFIG, RECALIBRATION, indexedRefBases); + QualityCalculator qualityCalculator = new QualityCalculator(TEST_CONFIG.Quality, RECALIBRATION, indexedRefBases); ReadContextCounter rcCounter = new ReadContextCounter( 1, variant, readContext, VariantTier.PANEL, 100, 0,