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);
}
/**
* 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
*
* @param tableName the name of the table
* @return the name of the table
* @return the table object
*/
public GATKReportTable getTable(String tableName) {
return tables.get(tableName);

View File

@ -747,21 +747,26 @@ public class NewVariantEvalWalker extends RodWalker<Integer, Integer> implements
String subTableName = ve.getClass().getSimpleName() + "." + field.getName();
String subTableDesc = datamap.get(field).description();
report.addTable(subTableName, subTableDesc);
GATKReportTable table = report.getTable(subTableName);
GATKReportTable table;
if (!report.hasTable(subTableName)) {
report.addTable(subTableName, subTableDesc);
table = report.getTable(subTableName);
table.addPrimaryKey("entry", false);
table.addColumn(subTableName, subTableName);
table.addPrimaryKey("entry", false);
table.addColumn(subTableName, subTableName);
for ( VariantStratifier vs : stratificationObjects ) {
String columnName = vs.getClass().getSimpleName();
for ( VariantStratifier vs : stratificationObjects ) {
String columnName = vs.getClass().getSimpleName();
table.addColumn(columnName, "unknown");
}
table.addColumn(columnName, "unknown");
}
for ( Object o : t.getColumnKeys() ) {
String c = (String) o;
table.addColumn(c, 0.0);
for ( Object o : t.getColumnKeys() ) {
String c = (String) o;
table.addColumn(c, 0.0);
}
} else {
table = report.getTable(subTableName);
}
for (int row = 0; row < t.getRowKeys().length; row++) {

View File

@ -258,11 +258,18 @@ public class GenotypeConcordance extends VariantEvaluator {
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);
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 (eval != null) {
// initialize the concordance table
@ -321,10 +328,7 @@ public class GenotypeConcordance extends VariantEvaluator {
sampleStats.incrValue(sample, truth, called);
if ( evalAC != null && validationAC != null) {
alleleCountStats.incrValue(evalAC,truth,called);
//System.err.println(evalAC + " " + validationAC);
//alleleCountStats.incrValue(validationAC,truth,called);
alleleCountStats.incrValue(validationAC,truth,called);
}
}
}