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

Commit

Permalink
Interpret FORMAT/SQ as Float (#93)
Browse files Browse the repository at this point in the history
Closes: #93
Related-Issue: #93
Projected-Results-Impact: none
  • Loading branch information
holtgrewe committed Jan 16, 2023
1 parent f68d82e commit 1940b1d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 3 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## v0.31 (work in progress)

- Interpret `FORMAT/SQ` as Float (#93).

## v0.30

- Adding support for MELT (#91).
Expand All @@ -15,7 +17,7 @@
- Write out `FORMAT/SQ` in the case that is present and `FORMAT/GQ` is not (#84).
If neither is set, then write out `0`.
Write out `0` for `AD` and `DP` as well if missing.
This improves compatibility with Manta.
This improves compatibility with DRAGEN.
- Suppress BND records that point to non-allow-listed contigs (#85).
This is required for processing Manta and Delly2 results, for example.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -829,8 +829,12 @@ private String buildGenotypeValue(VariantContext ctx, int alleleNo) {
}
final int[] ad = ctx.getGenotype(sample).getAD();
int gq = ctx.getGenotype(sample).getGQ();
double sq = -1.0;
if (gq == -1) {
gq = Integer.parseInt((String) ctx.getGenotype(sample).getExtendedAttribute("SQ", "0"));
sq = Double.parseDouble((String) ctx.getGenotype(sample).getExtendedAttribute("SQ", "0"));
if (sq == 0.0) {
gq = 0; // write out as int
}
}
int dp = ctx.getGenotype(sample).getDP();
if (dp == -1) {
Expand All @@ -855,7 +859,7 @@ private String buildGenotypeValue(VariantContext ctx, int alleleNo) {
",",
tripleQuote("gq"),
":",
String.valueOf(gq),
(gq == -1 ? String.valueOf(sq) : String.valueOf(gq)),
"}"));
}
return "{" + Joiner.on(",").join(mappings) + "}";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ void testWithSingleton(boolean gzipOutput) throws IOException {
+ "GRCh37\t1\t1\t808928\t808928\t591\tC\tT\tsnv\t.\t.\t{}\t{\"\"\"HG00102\"\"\":{\"\"\"gt\"\"\":\"\"\"1/1\"\"\",\"\"\"ad\"\"\":65,\"\"\"dp\"\"\":65,\"\"\"gq\"\"\":99}}\t1\t0\t0\t0\t0\tFALSE\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t148398\tNM_152486.2\tTRUE\t.\t.\t{\"intergenic_variant\"}\t52193\tENSG00000187634\tENST00000420190.1\tTRUE\t.\t.\t{\"intergenic_variant\"}\t51332\n"
+ "GRCh37\t1\t1\t877769\t877769\t591\tC\tT\tsnv\t.\t.\t{}\t{\"\"\"HG00102\"\"\":{\"\"\"gt\"\"\":\"\"\"1/1\"\"\",\"\"\"ad\"\"\":65,\"\"\"dp\"\"\":65,\"\"\"gq\"\"\":99}}\t1\t0\t0\t0\t0\tFALSE\t1.364E-5\t0\t1\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t148398\tNM_152486.2\tTRUE\tc.986-21C>T\tp.=\t{\"coding_transcript_intron_variant\"}\t21\tENSG00000187634\tENST00000341065.4\tTRUE\tc.709-21C>T\tp.=\t{\"coding_transcript_intron_variant\"}\t21\n"
+ "GRCh37\t1\t1\t981952\t981952\t592\tC\tT\tsnv\t.\t.\t{}\t{\"\"\"HG00102\"\"\":{\"\"\"gt\"\"\":\"\"\"1/1\"\"\",\"\"\"ad\"\"\":3,\"\"\"dp\"\"\":3,\"\"\"gq\"\"\":9}}\t1\t0\t0\t0\t0\tTRUE\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t148398\tNM_152486.2\tTRUE\t.\t.\t{\"intergenic_variant\"}\t101991\tENSG00000187634\tENST00000341065.4\tTRUE\t.\t.\t{\"intergenic_variant\"}\t101997\n"
+ "GRCh37\t1\t1\t981953\t981953\t592\tC\tT\tsnv\t.\t.\t{}\t{\"\"\"HG00102\"\"\":{\"\"\"gt\"\"\":\"\"\"1/1\"\"\",\"\"\"ad\"\"\":3,\"\"\"dp\"\"\":3,\"\"\"gq\"\"\":9}}\t1\t0\t0\t0\t0\tFALSE\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t148398\tNM_152486.2\tTRUE\t.\t.\t{\"intergenic_variant\"}\t101992\tENSG00000187634\tENST00000341065.4\tTRUE\t.\t.\t{\"intergenic_variant\"}\t101998\n";
+ "GRCh37\t1\t1\t981953\t981953\t592\tC\tT\tsnv\t.\t.\t{}\t{\"\"\"HG00102\"\"\":{\"\"\"gt\"\"\":\"\"\"1/1\"\"\",\"\"\"ad\"\"\":3,\"\"\"dp\"\"\":3,\"\"\"gq\"\"\":9.0}}\t1\t0\t0\t0\t0\tFALSE\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t148398\tNM_152486.2\tTRUE\t.\t.\t{\"intergenic_variant\"}\t101992\tENSG00000187634\tENST00000341065.4\tTRUE\t.\t.\t{\"intergenic_variant\"}\t101998\n";
runTest(
"bwa.gatk_hc.HG00102.vcf.gz",
null,
Expand Down

0 comments on commit 1940b1d

Please sign in to comment.