Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

Commit

Permalink
Bug fix in GT field creation when dealing with Java - reported
Browse files Browse the repository at this point in the history
#161

Fixed CI golden output that if correct would have caught this bug :(
  • Loading branch information
kgururaj committed Feb 15, 2018
1 parent eab417a commit 9f8aa21
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
7 changes: 7 additions & 0 deletions src/main/cpp/include/vcf/vcf.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,13 @@ inline T get_bcf_gt_missing_value() { return static_cast<T>(bcf_gt_missing); }
template<>
inline std::string get_bcf_gt_missing_value<std::string>() { return ""; }

//GT missing value - purely for compilation to proceed with std::string
template<class T>
inline T get_bcf_gt_no_call_allele_index() { return static_cast<T>(-1); }

//string specialization
template<>
inline std::string get_bcf_gt_no_call_allele_index<std::string>() { return ""; }

//for float, equality is not an adequate check
template<>
Expand Down
2 changes: 1 addition & 1 deletion src/main/cpp/src/genomicsdb/variant_field_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ bool VariantFieldHandler<DataType>::collect_and_extend_fields(const Variant& var
(use_vector_end_only || (is_GT_field && !use_missing_values_only_not_vector_end))
? get_bcf_vector_end_value<DataType>()
: ((is_GT_field && use_missing_values_only_not_vector_end)
? get_bcf_gt_missing_value<DataType>() //why? htsjdk does not handle a record where GT is missing in 1 sample, present in another
? get_bcf_gt_no_call_allele_index<DataType>() //why? htsjdk does not handle a record where GT is missing in 1 sample, present in another. So, set GT value to no-call
: get_bcf_missing_value<DataType>());
++num_elements_inserted;
++extended_field_vector_idx;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@
##contig=<ID=NC_007605,length=171823>
##reference=file:///seq/references/Homo_sapiens_assembly19/v1/Homo_sapiens_assembly19.fasta
#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT HG00141 HG01958 HG01530 NA12878
1 12141 . C <NON_REF> . . END=12144 GT:DP:GQ:MIN_DP:PL 0:2:0:0:0,0 0 0 0
1 12145 . C <NON_REF> . . END=12277 GT:DP:GQ:MIN_DP:PL 0:2:0:0:0,0 0/0:3:0:0:0,0,0 0 0
1 12278 . C <NON_REF> . . END=12295 GT:DP:GQ:MIN_DP:PL 0:2:0:0:0,0 0 0 0
1 17384 . TGG T,TG,<NON_REF> . . BaseQRankSum=1.07;ClippingRankSum=-1.067e+00;DP=9;MQ=55.72;MQ0=0;MQRankSum=0.056 GT:AD:DP:GQ:PL:SB 0 0 0 0/1/0:6,2,3,0:8:40:40,0,197,58,203,262,123,456,789,12,0,1,2,3,4,5,6,7,8,9:0,0,0,0
1 12141 . C <NON_REF> . . END=12144 GT:DP:GQ:MIN_DP:PL 0:2:0:0:0,0 . . .
1 12145 . C <NON_REF> . . END=12277 GT:DP:GQ:MIN_DP:PL 0:2:0:0:0,0 0/0:3:0:0:0,0,0 . .
1 12278 . C <NON_REF> . . END=12295 GT:DP:GQ:MIN_DP:PL 0:2:0:0:0,0 . . .
1 17384 . TGG T,TG,<NON_REF> . . BaseQRankSum=1.07;ClippingRankSum=-1.067e+00;DP=9;MQ=55.72;MQ0=0;MQRankSum=0.056 GT:AD:DP:GQ:PL:SB . . . 0/1/0:6,2,3,0:8:40:40,0,197,58,203,262,123,456,789,12,0,1,2,3,4,5,6,7,8,9:0,0,0,0
1 17385 . G A,T,*,<NON_REF> . . BaseQRankSum=-2.074e+00;ClippingRankSum=-1.859e+00;DP=285;MQ=31.72;MQ0=3;MQRankSum=-4.320e-01;RAW_MQ=2.50;ReadPosRankSum=5.000e-03 GT:AD:DP:GQ:PGT:PID:PL:SB 0/1/0:58,22,17,17,17:80:99:0|1:17385_G_A:504,0,9807,678,1870,2548,123,456,789,12,1870,2548,123,456,789,12,456,789,12,12,1870,2548,123,456,789,12,456,789,12,12,456,789,12,12,12:58,0,22,0 2/2:0,37,120,37,37:120:99:0|1:17385_G_T:3336,4536,7349,358,958,0,4536,7349,958,7349,4536,7349,958,7349,7349:0,0,0,0 0/1:40,36,0,0,0:76:99:.:.:1018,0,1116,1137,1224,2361,1137,1224,2361,2361,1137,1224,2361,2361,2361:9,31,13,23 0/4/0:6,0,0,3,0:8:40:.:.:40,0,6,9,0,6,9,6,9,9,203,3,8,3,8,8,456,5,5,12,0,6,9,6,9,9,3,8,8,5,6,9,9,8,9:0,0,0,0
1 17386 . G *,<NON_REF> . . DP=9 GT:AD:DP:GQ:PL:SB 0 0 0 0/2/0:6,3,0:8:40:40,203,456,12,0,3,5,6,8,9:0,0,0,0
1 17386 . G *,<NON_REF> . . DP=9 GT:AD:DP:GQ:PL:SB . . . 0/2/0:6,3,0:8:40:40,203,456,12,0,3,5,6,8,9:0,0,0,0

0 comments on commit 9f8aa21

Please sign in to comment.