diff --git a/src/main/java/org/broadinstitute/hellbender/tools/variantdb/arrays/ArrayCalculateMetrics.java b/src/main/java/org/broadinstitute/hellbender/tools/variantdb/arrays/ArrayCalculateMetrics.java index 6b12bba9f4c..4e091e3871a 100644 --- a/src/main/java/org/broadinstitute/hellbender/tools/variantdb/arrays/ArrayCalculateMetrics.java +++ b/src/main/java/org/broadinstitute/hellbender/tools/variantdb/arrays/ArrayCalculateMetrics.java @@ -44,7 +44,7 @@ public class ArrayCalculateMetrics extends GATKTool { public enum HeaderFieldEnum { probe_id, - hwe_pval, + excess_het, call_rate, invariant } @@ -72,14 +72,19 @@ public void traverse() { for ( final GenericRecord row : reader ) { List thisRow = new ArrayList<>(); // data in row should never be null - long probeId = (Long) row.get(0); + long probeId = (Long) row.get(GenotypeCountsSchema.PROBE_ID_INDEX); thisRow.add(String.valueOf(probeId)); - GenotypeCounts genotypeCounts = new GenotypeCounts((Long) row.get(1), (Long) row.get(2), (Long) row.get(3)); - long noCalls = (Long) row.get(4); + long combined_hom_var = (Long) row.get(GenotypeCountsSchema.HOM_VAR_INDEX) + + (Long) row.get(GenotypeCountsSchema.HET_1_2_INDEX) + + (Long) row.get(GenotypeCountsSchema.HOM_VAR_2_2_INDEX); + + GenotypeCounts genotypeCounts = new GenotypeCounts((Long) row.get(GenotypeCountsSchema.HOM_REF_INDEX), + (Long) row.get(GenotypeCountsSchema.HET_INDEX), combined_hom_var); + long noCalls = (Long) row.get(GenotypeCountsSchema.NO_CALL_INDEX); int sampleCount = (int) genotypeCounts.getRefs() + (int) genotypeCounts.getHets() + (int) genotypeCounts.getHoms() + (int) noCalls; - double excessHetPval = ExcessHet.calculateEH(genotypeCounts, sampleCount).getRight(); - thisRow.add(String.format("%.0f", excessHetPval)); + double excessHet = ExcessHet.calculateEH(genotypeCounts, sampleCount).getRight(); + thisRow.add(String.format("%.0f", excessHet)); double callRate = 1.0 - ((double) noCalls / sampleCount); thisRow.add(String.format("%.3f", callRate)); diff --git a/src/main/java/org/broadinstitute/hellbender/tools/variantdb/arrays/tables/GenotypeCountsSchema.java b/src/main/java/org/broadinstitute/hellbender/tools/variantdb/arrays/tables/GenotypeCountsSchema.java index ef3db87cd2e..471d6bd52f6 100644 --- a/src/main/java/org/broadinstitute/hellbender/tools/variantdb/arrays/tables/GenotypeCountsSchema.java +++ b/src/main/java/org/broadinstitute/hellbender/tools/variantdb/arrays/tables/GenotypeCountsSchema.java @@ -9,7 +9,18 @@ public class GenotypeCountsSchema { public static final String HOM_REF_COUNT = "hom_ref"; public static final String HET_COUNT = "het"; public static final String HOM_VAR_COUNT = "hom_var"; + public static final String HET_1_2_COUNT = "het_1_2"; + public static final String HOM_VAR_2_2_COUNT = "hom_var_2_2"; public static final String NO_CALL_COUNT = "no_call"; - public static final List GENOTYPE_COUNTS_FIELDS = Arrays.asList(PROBE_ID, HOM_REF_COUNT, HET_COUNT, HOM_VAR_COUNT, NO_CALL_COUNT); + public static final int PROBE_ID_INDEX = 0; + public static final int HOM_REF_INDEX = 1; + public static final int HET_INDEX = 2; + public static final int HOM_VAR_INDEX = 3; + public static final int HET_1_2_INDEX = 4; + public static final int HOM_VAR_2_2_INDEX = 5; + public static final int NO_CALL_INDEX = 6; + + + public static final List GENOTYPE_COUNTS_FIELDS = Arrays.asList(PROBE_ID, HOM_REF_COUNT, HET_COUNT, HOM_VAR_COUNT, HET_1_2_COUNT, HOM_VAR_2_2_COUNT, NO_CALL_COUNT); }