protected void printSummaryReport(List<Difference> sortedSummaries, SummaryReportParams params) { List<Difference> toShow = new ArrayList<Difference>(); int count = 0, count1 = 0; for (Difference diff : sortedSummaries) { if (diff.getCount() < params.minSumDiffToShow) // in order, so break as soon as the count is too low break; if (params.maxItemsToDisplay != 0 && count++ > params.maxItemsToDisplay) break; if (diff.getCount() == 1) { count1++; if (params.maxCountOneItems != 0 && count1 > params.maxCountOneItems) break; } toShow.add(diff); } // if we want it in descending order, reverse the list if (!params.descending) { Collections.reverse(toShow); } // now that we have a specific list of values we want to show, display them GATKReport report = new GATKReport(); final String tableName = "differences"; report.addTable( tableName, "Summarized differences between the master and test files. See http://www.broadinstitute.org/gsa/wiki/index.php/DiffEngine for more information", false); GATKReportTable table = report.getTable(tableName); table.addPrimaryKey("Difference", true); table.addColumn("NumberOfOccurrences", 0); table.addColumn("ExampleDifference", 0); for (Difference diff : toShow) { table.set(diff.getPath(), "NumberOfOccurrences", diff.getCount()); table.set(diff.getPath(), "ExampleDifference", diff.valueDiffString()); } GATKReport output = new GATKReport(table); output.print(params.out); }
public GATKReportTable generateReportTable(final String covariateNames) { GATKReportTable argumentsTable; if (SORT_BY_ALL_COLUMNS) { argumentsTable = new GATKReportTable( "Arguments", "Recalibration argument collection values used in this run", 2, GATKReportTable.TableSortingWay.SORT_BY_COLUMN); } else { argumentsTable = new GATKReportTable( "Arguments", "Recalibration argument collection values used in this run", 2); } argumentsTable.addColumn("Argument"); argumentsTable.addColumn(RecalUtils.ARGUMENT_VALUE_COLUMN_NAME); argumentsTable.addRowID("covariate", true); argumentsTable.set("covariate", RecalUtils.ARGUMENT_VALUE_COLUMN_NAME, covariateNames); argumentsTable.addRowID("no_standard_covs", true); argumentsTable.set( "no_standard_covs", RecalUtils.ARGUMENT_VALUE_COLUMN_NAME, DO_NOT_USE_STANDARD_COVARIATES); argumentsTable.addRowID("run_without_dbsnp", true); argumentsTable.set( "run_without_dbsnp", RecalUtils.ARGUMENT_VALUE_COLUMN_NAME, RUN_WITHOUT_DBSNP); argumentsTable.addRowID("solid_recal_mode", true); argumentsTable.set("solid_recal_mode", RecalUtils.ARGUMENT_VALUE_COLUMN_NAME, SOLID_RECAL_MODE); argumentsTable.addRowID("solid_nocall_strategy", true); argumentsTable.set( "solid_nocall_strategy", RecalUtils.ARGUMENT_VALUE_COLUMN_NAME, SOLID_NOCALL_STRATEGY); argumentsTable.addRowID("mismatches_context_size", true); argumentsTable.set( "mismatches_context_size", RecalUtils.ARGUMENT_VALUE_COLUMN_NAME, MISMATCHES_CONTEXT_SIZE); argumentsTable.addRowID("indels_context_size", true); argumentsTable.set( "indels_context_size", RecalUtils.ARGUMENT_VALUE_COLUMN_NAME, INDELS_CONTEXT_SIZE); argumentsTable.addRowID("mismatches_default_quality", true); argumentsTable.set( "mismatches_default_quality", RecalUtils.ARGUMENT_VALUE_COLUMN_NAME, MISMATCHES_DEFAULT_QUALITY); argumentsTable.addRowID("deletions_default_quality", true); argumentsTable.set( "deletions_default_quality", RecalUtils.ARGUMENT_VALUE_COLUMN_NAME, DELETIONS_DEFAULT_QUALITY); argumentsTable.addRowID("insertions_default_quality", true); argumentsTable.set( "insertions_default_quality", RecalUtils.ARGUMENT_VALUE_COLUMN_NAME, INSERTIONS_DEFAULT_QUALITY); argumentsTable.addRowID("maximum_cycle_value", true); argumentsTable.set( "maximum_cycle_value", RecalUtils.ARGUMENT_VALUE_COLUMN_NAME, MAXIMUM_CYCLE_VALUE); argumentsTable.addRowID("low_quality_tail", true); argumentsTable.set("low_quality_tail", RecalUtils.ARGUMENT_VALUE_COLUMN_NAME, LOW_QUAL_TAIL); argumentsTable.addRowID("default_platform", true); argumentsTable.set("default_platform", RecalUtils.ARGUMENT_VALUE_COLUMN_NAME, DEFAULT_PLATFORM); argumentsTable.addRowID("force_platform", true); argumentsTable.set("force_platform", RecalUtils.ARGUMENT_VALUE_COLUMN_NAME, FORCE_PLATFORM); argumentsTable.addRowID("quantizing_levels", true); argumentsTable.set( "quantizing_levels", RecalUtils.ARGUMENT_VALUE_COLUMN_NAME, QUANTIZING_LEVELS); argumentsTable.addRowID("recalibration_report", true); argumentsTable.set( "recalibration_report", RecalUtils.ARGUMENT_VALUE_COLUMN_NAME, existingRecalibrationReport == null ? "null" : existingRecalibrationReport.getAbsolutePath()); argumentsTable.addRowID("binary_tag_name", true); argumentsTable.set( "binary_tag_name", RecalUtils.ARGUMENT_VALUE_COLUMN_NAME, BINARY_TAG_NAME == null ? "null" : BINARY_TAG_NAME); return argumentsTable; }
/** * Output the finalized report * * @param result an integer that doesn't get used for anything */ public void onTraversalDone(Integer result) { logger.info("Finalizing variant report"); for (StateKey stateKey : evaluationContexts.keySet()) { NewEvaluationContext nec = evaluationContexts.get(stateKey); for (VariantEvaluator ve : nec.getEvaluationClassList().values()) { ve.finalizeEvaluation(); AnalysisModuleScanner scanner = new AnalysisModuleScanner(ve); Map<Field, DataPoint> datamap = scanner.getData(); for (Field field : datamap.keySet()) { try { field.setAccessible(true); if (field.get(ve) instanceof TableType) { TableType t = (TableType) field.get(ve); String subTableName = ve.getClass().getSimpleName() + "." + field.getName(); final DataPoint dataPointAnn = datamap.get(field); GATKReportTable table; if (!report.hasTable(subTableName)) { report.addTable(subTableName, dataPointAnn.description()); table = report.getTable(subTableName); table.addPrimaryKey("entry", false); table.addColumn(subTableName, subTableName); for (VariantStratifier vs : stratificationObjects) { table.addColumn(vs.getName(), "unknown"); } table.addColumn("row", "unknown"); for (Object o : t.getColumnKeys()) { String c; if (o instanceof String) { c = (String) o; } else { c = o.toString(); } table.addColumn(c, 0.0); } } else { table = report.getTable(subTableName); } for (int row = 0; row < t.getRowKeys().length; row++) { String r = (String) t.getRowKeys()[row]; for (VariantStratifier vs : stratificationObjects) { final String columnName = vs.getName(); table.set(stateKey.toString() + r, columnName, stateKey.get(columnName)); } for (int col = 0; col < t.getColumnKeys().length; col++) { String c; if (t.getColumnKeys()[col] instanceof String) { c = (String) t.getColumnKeys()[col]; } else { c = t.getColumnKeys()[col].toString(); } String newStateKey = stateKey.toString() + r; table.set(newStateKey, c, t.getCell(row, col)); table.set(newStateKey, "row", r); } } } else { GATKReportTable table = report.getTable(ve.getClass().getSimpleName()); for (VariantStratifier vs : stratificationObjects) { String columnName = vs.getName(); table.set(stateKey.toString(), columnName, stateKey.get(vs.getName())); } table.set(stateKey.toString(), field.getName(), field.get(ve)); } } catch (IllegalAccessException e) { throw new StingException("IllegalAccessException: " + e); } } } } report.print(out); }