Skip to content

Commit

Permalink
updating ArrayCalculateMetrics for new genotype counts table (#6843)
Browse files Browse the repository at this point in the history
  • Loading branch information
meganshand authored Sep 22, 2020
1 parent c79cd40 commit 889c38f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class ArrayCalculateMetrics extends GATKTool {

public enum HeaderFieldEnum {
probe_id,
hwe_pval,
excess_het,
call_rate,
invariant
}
Expand Down Expand Up @@ -72,14 +72,19 @@ public void traverse() {
for ( final GenericRecord row : reader ) {
List<String> 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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> 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<String> 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);
}

0 comments on commit 889c38f

Please sign in to comment.