Fixed issue with GenotypeConcordance being initialized incorrectly when the first seen comptrack had no samples.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@5102 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
kiran 2011-01-28 01:12:27 +00:00
parent 58f0ecff89
commit 3e9f185dad
3 changed files with 36 additions and 17 deletions

View File

@ -24,11 +24,21 @@ public class GATKReport {
tables.put(tableName, table); tables.put(tableName, table);
} }
/**
* Return true if table with a given name exists
*
* @param tableName the name of the table
* @return true if the table exists, false otherwise
*/
public boolean hasTable(String tableName) {
return tables.containsKey(tableName);
}
/** /**
* Return a table with a given name * Return a table with a given name
* *
* @param tableName the name of the table * @param tableName the name of the table
* @return the name of the table * @return the table object
*/ */
public GATKReportTable getTable(String tableName) { public GATKReportTable getTable(String tableName) {
return tables.get(tableName); return tables.get(tableName);

View File

@ -747,8 +747,10 @@ public class NewVariantEvalWalker extends RodWalker<Integer, Integer> implements
String subTableName = ve.getClass().getSimpleName() + "." + field.getName(); String subTableName = ve.getClass().getSimpleName() + "." + field.getName();
String subTableDesc = datamap.get(field).description(); String subTableDesc = datamap.get(field).description();
GATKReportTable table;
if (!report.hasTable(subTableName)) {
report.addTable(subTableName, subTableDesc); report.addTable(subTableName, subTableDesc);
GATKReportTable table = report.getTable(subTableName); table = report.getTable(subTableName);
table.addPrimaryKey("entry", false); table.addPrimaryKey("entry", false);
table.addColumn(subTableName, subTableName); table.addColumn(subTableName, subTableName);
@ -763,6 +765,9 @@ public class NewVariantEvalWalker extends RodWalker<Integer, Integer> implements
String c = (String) o; String c = (String) o;
table.addColumn(c, 0.0); table.addColumn(c, 0.0);
} }
} else {
table = report.getTable(subTableName);
}
for (int row = 0; row < t.getRowKeys().length; row++) { for (int row = 0; row < t.getRowKeys().length; row++) {
String r = (String) t.getRowKeys()[row]; String r = (String) t.getRowKeys()[row];

View File

@ -258,11 +258,18 @@ public class GenotypeConcordance extends VariantEvaluator {
qualityScoreHistograms = new QualityScoreHistograms(); qualityScoreHistograms = new QualityScoreHistograms();
} }
if ( alleleCountStats == null && eval != null && validation != null ) { if ( alleleCountStats == null && eval != null && validation != null && validation.getSampleNames().size() > 0) {
alleleCountStats = new ACStats(eval,validation,Genotype.Type.values().length); alleleCountStats = new ACStats(eval,validation,Genotype.Type.values().length);
alleleCountSummary = new ACSummaryStats(eval, validation); alleleCountSummary = new ACSummaryStats(eval, validation);
} }
if ( alleleCountStats != null ) {
// for ( int i = 0; i <= 2*validation.getGenotypes().size(); i++ ) {
// concordanceStats.put(String.format("compAC%d",i), new long[nGenotypeTypes][nGenotypeTypes]);
// rowKeys[1+2*evalvc.getGenotypes().size()+i] = String.format("compAC%d",i);
// }
}
if (sampleStats == null) { if (sampleStats == null) {
if (eval != null) { if (eval != null) {
// initialize the concordance table // initialize the concordance table
@ -321,10 +328,7 @@ public class GenotypeConcordance extends VariantEvaluator {
sampleStats.incrValue(sample, truth, called); sampleStats.incrValue(sample, truth, called);
if ( evalAC != null && validationAC != null) { if ( evalAC != null && validationAC != null) {
alleleCountStats.incrValue(evalAC,truth,called); alleleCountStats.incrValue(evalAC,truth,called);
alleleCountStats.incrValue(validationAC,truth,called);
//System.err.println(evalAC + " " + validationAC);
//alleleCountStats.incrValue(validationAC,truth,called);
} }
} }
} }