private void createInheritanceMap(){ inheritance = new EnumMap<GenotypeType,EnumMap<GenotypeType,EnumMap<GenotypeType,Integer>>>(GenotypeType.class); for(GenotypeType mType : GenotypeType.values()){ inheritance.put(mType, new EnumMap<GenotypeType,EnumMap<GenotypeType,Integer>>(GenotypeType.class)); for(GenotypeType dType : GenotypeType.values()){ inheritance.get(mType).put(dType, new EnumMap<GenotypeType,Integer>(GenotypeType.class)); for(GenotypeType cType : GenotypeType.values()){ inheritance.get(mType).get(dType).put(cType, 0); } } } }
private void buildMatrices(){ for(final GenotypeType mother : GenotypeType.values()){ mvCountMatrix.put(mother,new EnumMap<GenotypeType,EnumMap<GenotypeType,Integer>>(GenotypeType.class)); for(final GenotypeType father : GenotypeType.values()){ mvCountMatrix.get(mother).put(father,new EnumMap<GenotypeType, Integer>(GenotypeType.class)); for(final GenotypeType child : GenotypeType.values()){ mvCountMatrix.get(mother).get(father).put(child, getCombinationMVCount(mother, father, child)); } } } }
private void buildMatrices(){ mvCountMatrix = new EnumMap<GenotypeType,EnumMap<GenotypeType,EnumMap<GenotypeType,Integer>>>(GenotypeType.class); transmissionMatrix = new EnumMap<GenotypeType,EnumMap<GenotypeType,EnumMap<GenotypeType,TrioPhase>>>(GenotypeType.class); for(GenotypeType mother : GenotypeType.values()){ mvCountMatrix.put(mother,new EnumMap<GenotypeType,EnumMap<GenotypeType,Integer>>(GenotypeType.class)); transmissionMatrix.put(mother,new EnumMap<GenotypeType,EnumMap<GenotypeType,TrioPhase>>(GenotypeType.class)); for(GenotypeType father : GenotypeType.values()){ mvCountMatrix.get(mother).put(father,new EnumMap<GenotypeType, Integer>(GenotypeType.class)); transmissionMatrix.get(mother).put(father,new EnumMap<GenotypeType,TrioPhase>(GenotypeType.class)); for(GenotypeType child : GenotypeType.values()){ mvCountMatrix.get(mother).get(father).put(child, getCombinationMVCount(mother, father, child)); transmissionMatrix.get(mother).get(father).put(child,new TrioPhase(mother,father,child)); } } } }
public int getnCompGenotypes(GenotypeType type) { int nGeno = 0; for ( GenotypeType evaltype : GenotypeType.values() ) nGeno += genotypeCounts[evaltype.ordinal()][type.ordinal()]; return nGeno; }
public int getnEvalGenotypes(GenotypeType type) { int nGeno = 0; for ( GenotypeType comptype : GenotypeType.values() ) nGeno += genotypeCounts[type.ordinal()][comptype.ordinal()]; return nGeno; }
private void calculateGenotypeCounts() { if ( genotypeCounts == null ) { genotypeCounts = new int[GenotypeType.values().length]; for ( final Genotype g : getGenotypes() ) { genotypeCounts[g.getType().ordinal()]++; } } }
private void calculateGenotypeCounts() { if ( genotypeCounts == null ) { genotypeCounts = new int[GenotypeType.values().length]; for ( final Genotype g : getGenotypes() ) { genotypeCounts[g.getType().ordinal()]++; } } }
private void calculateGenotypeCounts() { if ( genotypeCounts == null ) { genotypeCounts = new int[GenotypeType.values().length]; for ( final Genotype g : getGenotypes() ) { genotypeCounts[g.getType().ordinal()]++; } } }
private static double calculateNRS(int[][] concordanceCounts) { long confirmedVariant = 0; long unconfirmedVariant = 0; for ( GenotypeType truthState : Arrays.asList(GenotypeType.HET,GenotypeType.HOM_VAR) ) { for ( GenotypeType evalState : GenotypeType.values() ) { if ( evalState == GenotypeType.MIXED ) continue; if ( evalState.equals(GenotypeType.HET) || evalState.equals(GenotypeType.HOM_VAR) ) confirmedVariant += concordanceCounts[evalState.ordinal()][truthState.ordinal()]; else unconfirmedVariant += concordanceCounts[evalState.ordinal()][truthState.ordinal()]; } } long total = confirmedVariant + unconfirmedVariant; // note: if there are no observations (so the ratio is NaN) set this to 0% return total == 0l ? 0.0 : ( (double) confirmedVariant ) / ( (double) ( total ) ); }
@Test(enabled=true) public void testMultiSite() { int[][] sample1_expected = new int[GenotypeType.values().length][GenotypeType.values().length]; int[][] sample2_expected = new int[GenotypeType.values().length][GenotypeType.values().length]; for ( GenotypeType eType : GenotypeType.values() ) { for ( GenotypeType cType : GenotypeType.values() ) { Assert.assertEquals(sample1_expected[eType.ordinal()][cType.ordinal()],sample1_observed[eType.ordinal()][cType.ordinal()]); Assert.assertEquals(sample2_expected[eType.ordinal()][cType.ordinal()],sample2_observed[eType.ordinal()][cType.ordinal()]);
GATKReportTable concordanceCounts = new GATKReportTable("GenotypeConcordance_Counts","Per-sample concordance tables: comparison counts",2+GenotypeType.values().length*GenotypeType.values().length); GATKReportTable concordanceEvalProportions = new GATKReportTable("GenotypeConcordance_EvalProportions", "Per-sample concordance tables: proportions of genotypes called in eval",2+GenotypeType.values().length*GenotypeType.values().length); GATKReportTable concordanceCompProportions = new GATKReportTable("GenotypeConcordance_CompProportions", "Per-sample concordance tables: proportions of genotypes called in comp",2+GenotypeType.values().length*GenotypeType.values().length); GATKReportTable concordanceSummary = new GATKReportTable("GenotypeConcordance_Summary","Per-sample summary statistics: NRS, NRD, and OGC",2); GATKReportTable siteConcordance = new GATKReportTable("SiteConcordance_Summary","Site-level summary statistics",ConcordanceMetrics.SiteConcordanceType.values().length); for ( GenotypeType evalType : GenotypeType.values() ) { for ( GenotypeType compType : GenotypeType.values() ) { String rowKey = String.format("%s_%s_%s",entry.getKey(),evalType.toString(),compType.toString()); concordanceCounts.set(rowKey,"Sample",entry.getKey()); for ( GenotypeType evalType : GenotypeType.values() ) { for ( GenotypeType compType : GenotypeType.values() ) { String rowKey = String.format("%s_%s_%s",sampleKey,evalType.toString(),compType.toString()); concordanceCounts.set(rowKey,"Sample",sampleKey); concordanceEvalProportions.addColumn("Sample","%s"); concordanceSummary.addColumn("Sample","%s"); for ( GenotypeType evalType : GenotypeType.values() ) { for ( GenotypeType compType : GenotypeType.values() ) { String colKey = String.format("%s_%s", evalType.toString(), compType.toString()); concordanceCounts.addColumn(colKey,"%d"); concordanceCompProportions.set(entry.getKey(),"Sample",entry.getKey()); concordanceCounts.set(entry.getKey(),"Sample",entry.getKey()); for ( GenotypeType evalType : GenotypeType.values() ) { for ( GenotypeType compType : GenotypeType.values() ) { String colKey = String.format("%s_%s",evalType.toString(),compType.toString()); int count = table.get(evalType, compType);