Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updating ArrayCalculateMetrics for new genotype counts table #6843

Merged
merged 1 commit into from
Sep 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}