diff --git a/src/vcf/validate_optional_policy.cpp b/src/vcf/validate_optional_policy.cpp index 454129f7..4e2cf68f 100644 --- a/src/vcf/validate_optional_policy.cpp +++ b/src/vcf/validate_optional_policy.cpp @@ -124,7 +124,14 @@ namespace ebi void ValidateOptionalPolicy::check_body_entry_alt_gvcf_gt_value(ParsingState & state, Record const & record) const { if (util::contains(record.alternate_alleles, GVCF_NON_VARIANT_ALLELE) && record.format[0] == vcf::GT) { - for (auto & sample : record.samples) { + //with v44, there can be optional leading phasing info, remove it and use + bool checkprefix = state.source->version < Version::v44? false : true; + for (auto sample : record.samples) { + if (checkprefix && !sample.empty()) { + if (sample.at(0) == '/' || sample.at(0) == '|') { + sample.erase(0,1); + } + } if (sample_has_reference_in_all_alleles(sample)) { return; } diff --git a/test/input_files/v4.4/passed/passed_body_alt.vcf b/test/input_files/v4.4/passed/passed_body_alt.vcf index ff1e17de..687ab322 100644 --- a/test/input_files/v4.4/passed/passed_body_alt.vcf +++ b/test/input_files/v4.4/passed/passed_body_alt.vcf @@ -21,6 +21,7 @@ 1 1900 rs180734498 C AGT[1:100[ 100 PASS AN=2184;AC=249;AF=0.11;SVLEN=.;SVCLAIM=J GT:DS:GL 0|0:0.050:-0.13,-0.58,-3.62 0|1:1.000:-2.45,-0.00,-5.00 1 1900 rs180734498 C . 100 PASS AN=2184;AC=249;AF=0.11 GT:DS:GL 0|0:0.050:-0.13,-0.58,-3.62 0|1:1.000:-2.45,-0.00,-5.00 1 4370 . G <*> . . END=4383;SVLEN=. GT:DP:GQ:MIN:PL 0/0:25:60:23:0,60,900 0/0:25:45:25:0,42,630 +1 4371 . G <*> . . END=4383;SVLEN=. GT:DP:GQ:MIN:PL /0/0:25:60:23:0,60,900 |0/1:25:45:25:0,42,630 1 4389 . T TC,<*> 213.73 . . GT:DP:GQ:PL 0/1:23:99:51,0,36,93,92,86 0/0:24:52:0,52,95,66,95,97 1 4389 . C <*>, . . END=4388;SVLEN=.,1;SVCLAIM=.,D GT:DP:GQ 0/0:25:45 0/1:23:99 1 4390 . C *,<*> . . END=4390 GT:DP:GQ 0/0:26:0 0/0:25:60 diff --git a/test/vcf/optional_policy_test.cpp b/test/vcf/optional_policy_test.cpp index d0e7a07c..8226f9af 100644 --- a/test/vcf/optional_policy_test.cpp +++ b/test/vcf/optional_policy_test.cpp @@ -963,6 +963,20 @@ namespace ebi { "0/0" }, sources[1]})) ); + CHECK_NOTHROW( (optional_policy.optional_check_body_entry(parsing_state2, vcf::Record{ //gvcf with prefixed phasing + 1, + "chr1", + 123456, + { "id123" }, + "A", + { vcf::GVCF_NON_VARIANT_ALLELE }, + 1.0, + { vcf::PASS }, + { { vcf::END, "0" } }, + { vcf::GT }, + { "|0/0" }, + sources[1]})) ); + CHECK_NOTHROW( (optional_policy.optional_check_body_entry(parsing_state2, vcf::Record{ 1, "chr1", @@ -991,6 +1005,21 @@ namespace ebi { "0|1" }, sources[1]})), vcf::AlternateAllelesBodyError*); + + CHECK_THROWS_AS( (optional_policy.optional_check_body_entry(parsing_state2, vcf::Record{ //gvcf with prefixed phasing + 1, + "chr1", + 123456, + { "id123" }, + "A", + { vcf::GVCF_NON_VARIANT_ALLELE }, + 1.0, + { vcf::PASS }, + { { vcf::END, "0" } }, + { vcf::GT }, + { "/0|1" }, + sources[1]})), + vcf::AlternateAllelesBodyError*); } }