Skip to content

Commit

Permalink
In GtcToVcf, set infinite values to missing ('.') in the VCF. (#1777)
Browse files Browse the repository at this point in the history
In GtcToVcf, set infinite values to missing ('.') in the VCF.
In VcfToAdpc, if value is a '?' (which was what had been encoded for infinite) treat as missing.
  • Loading branch information
gbggrant authored Feb 17, 2022
1 parent 1d4dc0b commit a03ed41
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main/java/picard/arrays/GtcToVcf.java
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ public Genotype getGenotype(final String sampleName,
}

public static String formatFloatForVcf(final float value) {
if (Float.isNaN(value)) {
if (Float.isNaN(value) || Float.isInfinite(value)) {
return DOT;
}
return df.format(value);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/picard/arrays/VcfToAdpc.java
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ private int getUnsignedShortAttributeAsInt(final Genotype genotype, final String

private Float getFloatAttribute(final Genotype genotype, final String key) {
final Object value = genotype.getAnyAttribute(key);
if (value != null) {
if ((value != null) && (!value.equals("?"))) {
return Float.parseFloat(value.toString());
}
return null;
Expand Down

0 comments on commit a03ed41

Please sign in to comment.