From a07076b066d252567d0310ec361b0207913f0f51 Mon Sep 17 00:00:00 2001 From: Dror Kessler Date: Wed, 1 May 2024 11:04:30 +0300 Subject: [PATCH] X_FILTERED_COUNT semantics adjusted --- .../featuremapping/FlowFeatureMapper.java | 5 +- .../walkers/featuremapping/SNVMapper.java | 55 +++++++++---------- .../snv_feature_mapper_output.vcf | 4 +- .../snv_feature_mapper_output.vcf.idx | 2 +- .../snv_feature_mapper_qc_failed_output.vcf | 4 +- ...nv_feature_mapper_qc_failed_output.vcf.idx | 2 +- ..._feature_mapper_report_all_alts_output.vcf | 4 +- ...ture_mapper_report_all_alts_output.vcf.idx | 2 +- .../snv_feature_mapper_smq_all_output.vcf | 4 +- .../snv_feature_mapper_smq_all_output.vcf.idx | 2 +- .../snv_feature_mapper_smq_output.vcf | 4 +- .../snv_feature_mapper_smq_output.vcf.idx | 2 +- .../snv_feature_mapper_tag_adjs_output.vcf | 4 +- ...snv_feature_mapper_tag_adjs_output.vcf.idx | 2 +- 14 files changed, 47 insertions(+), 49 deletions(-) diff --git a/src/main/java/org/broadinstitute/hellbender/tools/walkers/featuremapping/FlowFeatureMapper.java b/src/main/java/org/broadinstitute/hellbender/tools/walkers/featuremapping/FlowFeatureMapper.java index 2014ce3030e..19783e1984f 100644 --- a/src/main/java/org/broadinstitute/hellbender/tools/walkers/featuremapping/FlowFeatureMapper.java +++ b/src/main/java/org/broadinstitute/hellbender/tools/walkers/featuremapping/FlowFeatureMapper.java @@ -337,7 +337,7 @@ public VCFHeader makeVCFHeader(final SAMSequenceDictionary sequenceDictionary, f headerInfo.add(new VCFInfoHeaderLine(VCF_MAPQ, 1, VCFHeaderLineType.Integer, "Read mapqe")); headerInfo.add(new VCFInfoHeaderLine(VCF_CIGAR, 1, VCFHeaderLineType.String, "Read CIGAR")); headerInfo.add(new VCFInfoHeaderLine(VCF_READ_COUNT, 1, VCFHeaderLineType.Integer, "Number of reads containing this location")); - headerInfo.add(new VCFInfoHeaderLine(VCF_FILTERED_COUNT, 1, VCFHeaderLineType.Integer, "Number of reads containing this location that agree with reference according to fitler")); + headerInfo.add(new VCFInfoHeaderLine(VCF_FILTERED_COUNT, 1, VCFHeaderLineType.Integer, "Number of reads containing this location that pass the adjacent base filter")); headerInfo.add(new VCFInfoHeaderLine(VCF_FC1, 1, VCFHeaderLineType.Integer, "Number of M bases different on read from references")); headerInfo.add(new VCFInfoHeaderLine(VCF_FC2, 1, VCFHeaderLineType.Integer, "Number of features before score threshold filter")); headerInfo.add(new VCFInfoHeaderLine(VCF_LENGTH, 1, VCFHeaderLineType.Integer, "Read length")); @@ -475,7 +475,8 @@ private void enrichFeature(final MappedFeature fr) { for ( ReadContext rc : readQueue ) { if ( rc.read.contains(loc) ) { fr.readCount++; - if ( mapper.noFeatureButFilterAt(rc.read, rc.referenceContext, fr.start) == FeatureMapper.FilterStatus.Filtered ) { + FeatureMapper.FilterStatus fs = mapper.noFeatureButFilterAt(rc.read, rc.referenceContext, fr.start); + if ( (fs == FeatureMapper.FilterStatus.Filtered) || (fs == FeatureMapper.FilterStatus.NoFeatureAndFiltered) ) { fr.filteredCount++; } } diff --git a/src/main/java/org/broadinstitute/hellbender/tools/walkers/featuremapping/SNVMapper.java b/src/main/java/org/broadinstitute/hellbender/tools/walkers/featuremapping/SNVMapper.java index 3f23cb5a6e6..e67f5ee570e 100644 --- a/src/main/java/org/broadinstitute/hellbender/tools/walkers/featuremapping/SNVMapper.java +++ b/src/main/java/org/broadinstitute/hellbender/tools/walkers/featuremapping/SNVMapper.java @@ -277,40 +277,37 @@ public FilterStatus noFeatureButFilterAt(GATKRead read, ReferenceContext referen readOfs += delta; refOfs += delta; - if ( bases[readOfs] == ref[refOfs] ) { - - // check that this is really a SNV (must be surrounded by identical ref) - boolean surrounded = true; - for ( int i = 0 ; i < surroundBefore && surrounded ; i++ ) { - final int bIndex = readOfs-1-i; - final int rIndex = refOfs-1-i; - if ( bIndex < 0 || bIndex >= bases.length || rIndex < 0 || rIndex >= ref.length ) { - surrounded = false; - continue; - } - if ( bases[bIndex] != ref[rIndex] ) { - surrounded = false; - } + final boolean noFeature = bases[readOfs] == ref[refOfs]; + + // check that this is really a SNV (must be surrounded by identical ref) + boolean surrounded = true; + for ( int i = 0 ; i < surroundBefore && surrounded ; i++ ) { + final int bIndex = readOfs-1-i; + final int rIndex = refOfs-1-i; + if ( bIndex < 0 || bIndex >= bases.length || rIndex < 0 || rIndex >= ref.length ) { + surrounded = false; + continue; } - for (int i = 0; i < surroundAfter && surrounded ; i++ ) { - final int bIndex = readOfs+1+i; - final int rIndex = refOfs+1+i; - if ( bIndex < 0 || bIndex >= bases.length || rIndex < 0 || rIndex >= ref.length ) { - surrounded = false; - continue; - } - if ( bases[bIndex] != ref[rIndex] ) { - surrounded = false; - } + if ( bases[bIndex] != ref[rIndex] ) { + surrounded = false; } - if ( !surrounded ) { + } + for (int i = 0; i < surroundAfter && surrounded ; i++ ) { + final int bIndex = readOfs+1+i; + final int rIndex = refOfs+1+i; + if ( bIndex < 0 || bIndex >= bases.length || rIndex < 0 || rIndex >= ref.length ) { + surrounded = false; continue; } + if ( bases[bIndex] != ref[rIndex] ) { + surrounded = false; + } + } + if ( !surrounded ) { + continue; + } - // this is it! no feature but filtered in - return FilterStatus.NoFeatureAndFiltered; - } else - return FilterStatus.Filtered; + return noFeature ? FilterStatus.NoFeatureAndFiltered : FilterStatus.Filtered; } else { diff --git a/src/test/resources/large/featureMapping/snv_feature_mapper_output.vcf b/src/test/resources/large/featureMapping/snv_feature_mapper_output.vcf index 7cc4f1950cd..15420a30c69 100644 --- a/src/test/resources/large/featureMapping/snv_feature_mapper_output.vcf +++ b/src/test/resources/large/featureMapping/snv_feature_mapper_output.vcf @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b5f7a63955d57c04eac81f19140ea3483f93943e0a4fdb0990e636f3c08fbda1 -size 5722270 +oid sha256:fec49990080a8d7a21c3d5639c2bcba83a67c5a88d48bc58127fd6c51c10987a +size 5727362 diff --git a/src/test/resources/large/featureMapping/snv_feature_mapper_output.vcf.idx b/src/test/resources/large/featureMapping/snv_feature_mapper_output.vcf.idx index d88a936098d..51f9292562f 100644 --- a/src/test/resources/large/featureMapping/snv_feature_mapper_output.vcf.idx +++ b/src/test/resources/large/featureMapping/snv_feature_mapper_output.vcf.idx @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:35aac2c14df674d928a33d0faa938baecb3f67aa60d9a49f4f6f0f290683dc4c +oid sha256:2048ce82810a5752d6fb1de9e6e9c2166bc0cf0981cc63a82f4fd06d4bf81275 size 120113 diff --git a/src/test/resources/large/featureMapping/snv_feature_mapper_qc_failed_output.vcf b/src/test/resources/large/featureMapping/snv_feature_mapper_qc_failed_output.vcf index 0d5f50fceed..19530e544e0 100644 --- a/src/test/resources/large/featureMapping/snv_feature_mapper_qc_failed_output.vcf +++ b/src/test/resources/large/featureMapping/snv_feature_mapper_qc_failed_output.vcf @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:405fb1bf62168e22c504e0e4ae0d9d6b9ab4f7ac32ff18dcd77f071618d964da -size 5051930 +oid sha256:5868392f6e82af04e84a960f99f958f3f30e2476af3997bf5ad9db70a727961f +size 5057024 diff --git a/src/test/resources/large/featureMapping/snv_feature_mapper_qc_failed_output.vcf.idx b/src/test/resources/large/featureMapping/snv_feature_mapper_qc_failed_output.vcf.idx index d31b3036198..f19964be546 100644 --- a/src/test/resources/large/featureMapping/snv_feature_mapper_qc_failed_output.vcf.idx +++ b/src/test/resources/large/featureMapping/snv_feature_mapper_qc_failed_output.vcf.idx @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7aba6151d662570d8e4a25cbb4717c65009c2d217375a287667b1f47c2db9925 +oid sha256:94675097a7732fb42d58bbb4c4beed366a5a92b68b106b5f827d9d7d1d1f479e size 120123 diff --git a/src/test/resources/large/featureMapping/snv_feature_mapper_report_all_alts_output.vcf b/src/test/resources/large/featureMapping/snv_feature_mapper_report_all_alts_output.vcf index c1f47301f09..438ff402e44 100644 --- a/src/test/resources/large/featureMapping/snv_feature_mapper_report_all_alts_output.vcf +++ b/src/test/resources/large/featureMapping/snv_feature_mapper_report_all_alts_output.vcf @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1196abbe9d96b3d48dfae5a37991aaacaf2474a4bcae5c36cfae58378f8c1429 -size 21938650 +oid sha256:2bb077a1ed1632cf48ea3ee710c1d3517b86c679070e07880e8fffe0ed0acafb +size 22013893 diff --git a/src/test/resources/large/featureMapping/snv_feature_mapper_report_all_alts_output.vcf.idx b/src/test/resources/large/featureMapping/snv_feature_mapper_report_all_alts_output.vcf.idx index 93e3ec2e7f9..3306703bc4e 100644 --- a/src/test/resources/large/featureMapping/snv_feature_mapper_report_all_alts_output.vcf.idx +++ b/src/test/resources/large/featureMapping/snv_feature_mapper_report_all_alts_output.vcf.idx @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:93e8a05eece74ee9760982366b0234cc2d4ee4ac25eb7e26f89b0a106958e235 +oid sha256:aa90be0835317f993e082e9543aa17e83b8f0ba29c2faa18314de0017356eb23 size 134797 diff --git a/src/test/resources/large/featureMapping/snv_feature_mapper_smq_all_output.vcf b/src/test/resources/large/featureMapping/snv_feature_mapper_smq_all_output.vcf index 840e53f8408..075cdd31993 100644 --- a/src/test/resources/large/featureMapping/snv_feature_mapper_smq_all_output.vcf +++ b/src/test/resources/large/featureMapping/snv_feature_mapper_smq_all_output.vcf @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4245184ac90c7dc1a0968285ddb0878c2a9d46f27b8cc1dd71b11074fd477d6e -size 6755057 +oid sha256:56033f5f98ef9999741c7f8a0c140045bd42558194a4512f3c4742f8a24e4aab +size 6760184 diff --git a/src/test/resources/large/featureMapping/snv_feature_mapper_smq_all_output.vcf.idx b/src/test/resources/large/featureMapping/snv_feature_mapper_smq_all_output.vcf.idx index ad3b14238db..c29140ecdb9 100644 --- a/src/test/resources/large/featureMapping/snv_feature_mapper_smq_all_output.vcf.idx +++ b/src/test/resources/large/featureMapping/snv_feature_mapper_smq_all_output.vcf.idx @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bdad1cfb039ec6d61f74a739d889adb65a1920a7a06c1e114522e7f229aacf84 +oid sha256:0df79aee9e4be92defe36b7d40f21615a6883c32f99e7df35cbb8c407639d363 size 120121 diff --git a/src/test/resources/large/featureMapping/snv_feature_mapper_smq_output.vcf b/src/test/resources/large/featureMapping/snv_feature_mapper_smq_output.vcf index 6d79e8e0d16..32a060c9c5e 100644 --- a/src/test/resources/large/featureMapping/snv_feature_mapper_smq_output.vcf +++ b/src/test/resources/large/featureMapping/snv_feature_mapper_smq_output.vcf @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:694325ff66b4f1184593f22b5fc3171f6609e55286763c49b66fe7bc2f68275f -size 5778235 +oid sha256:a38048e71ea5b01195bf52b38d07cef3f38e91e80b76f2737165e2e84e78bf1e +size 5783362 diff --git a/src/test/resources/large/featureMapping/snv_feature_mapper_smq_output.vcf.idx b/src/test/resources/large/featureMapping/snv_feature_mapper_smq_output.vcf.idx index 7bca4d3cd51..340b9475475 100644 --- a/src/test/resources/large/featureMapping/snv_feature_mapper_smq_output.vcf.idx +++ b/src/test/resources/large/featureMapping/snv_feature_mapper_smq_output.vcf.idx @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0a3dac7c3980303af8f127a4cfcc98343f7e9a8be4755327237f4cdc155c99f2 +oid sha256:6f5755a11e3577ed97ed8ccddded2135a0de1b5bbbdd247087bd355a5f4c6770 size 120117 diff --git a/src/test/resources/large/featureMapping/snv_feature_mapper_tag_adjs_output.vcf b/src/test/resources/large/featureMapping/snv_feature_mapper_tag_adjs_output.vcf index fba9eee5e7a..ae8d2a47b9b 100644 --- a/src/test/resources/large/featureMapping/snv_feature_mapper_tag_adjs_output.vcf +++ b/src/test/resources/large/featureMapping/snv_feature_mapper_tag_adjs_output.vcf @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:61ce347a59b8a814c5af0bc08f242590feffbd7fc010cbc948cba94f35d6437d -size 250644 +oid sha256:511e7b3faded9b68fddb05098ad681965c8ac3d69a7c0879e1e404e0d7ac0992 +size 250675 diff --git a/src/test/resources/large/featureMapping/snv_feature_mapper_tag_adjs_output.vcf.idx b/src/test/resources/large/featureMapping/snv_feature_mapper_tag_adjs_output.vcf.idx index 2b60e131497..888d93a2b15 100644 --- a/src/test/resources/large/featureMapping/snv_feature_mapper_tag_adjs_output.vcf.idx +++ b/src/test/resources/large/featureMapping/snv_feature_mapper_tag_adjs_output.vcf.idx @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c9876e614b5e5d9e3ffb1d85207149210e931a241821c832b3f3efc095b59710 +oid sha256:d0e3cb83a487006e075466405dc48dc2e4f5eaa222597361ac77f2cb0d2648cf size 118520