diff --git a/public/java/src/org/broadinstitute/sting/gatk/report/GATKReport.java b/public/java/src/org/broadinstitute/sting/gatk/report/GATKReport.java index 7edadfc4b..bec1ea543 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/report/GATKReport.java +++ b/public/java/src/org/broadinstitute/sting/gatk/report/GATKReport.java @@ -283,6 +283,41 @@ public class GATKReport { return output; } + /** + * The constructor for a simplified GATK Report. Simplified GATK report are designed for reports that do not need + * the advanced functionality of a full GATK Report. + *

+ * A simple GATK Report consists of: + *

+ * - A single table + * - No primary key ( it is hidden ) + *

+ * Optional: + * - Only untyped columns. As long as the data is an Object, it will be accepted. + * - Default column values being empty strings. + *

+ * Limitations: + *

+ * - A simple GATK report cannot contain multiple tables. + * - It cannot contain typed columns, which prevents arithmetic gathering. + * + * @param tableName The name of your simple GATK report table + * @param columns The names of the columns in your table + * @return a simplified GATK report + */ + public static GATKReport newSimpleReport(final String tableName, final List columns) { + GATKReportTable table = new GATKReportTable(tableName, "A simplified GATK table report", columns.size()); + + for (String column : columns) { + table.addColumn(column, ""); + } + + GATKReport output = new GATKReport(); + output.addTable(table); + + return output; + } + /** * This method provides an efficient way to populate a simplified GATK report. This method will only work on reports * that qualify as simplified GATK reports. See the newSimpleReport() constructor for more information. @@ -303,4 +338,27 @@ public class GATKReport { for ( int i = 0; i < values.length; i++ ) table.set(rowIndex, i, values[i]); } + + /** + * This method provides an efficient way to populate a simplified GATK report. This method will only work on reports + * that qualify as simplified GATK reports. See the newSimpleReport() constructor for more information. + * + * @param values the row of data to be added to the table. + * Note: the number of arguments must match the columns in the table. + */ + public void addRowList(final List values) { + if ( tables.size() != 1 ) + throw new ReviewedStingException("Cannot write a row to a complex GATK Report"); + + GATKReportTable table = tables.firstEntry().getValue(); + if ( table.getNumColumns() != values.size() ) + throw new ReviewedStingException("The number of arguments in writeRow() must match the number of columns in the table"); + + final int rowIndex = table.getNumRows(); + int idx = 0; + for ( Object value : values ) { + table.set(rowIndex,idx,value); + idx++; + } + } } diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/coverage/DepthOfCoverageWalker.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/coverage/DepthOfCoverageWalker.java index 833dce932..ef52014f3 100644 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/coverage/DepthOfCoverageWalker.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/coverage/DepthOfCoverageWalker.java @@ -405,15 +405,19 @@ public class DepthOfCoverageWalker extends LocusWalker 0 ) { + for(DoCOutputType.Partition partition: partitionTypes) { + if ( checkType(statsByInterval.get(0).getSecond().getCoverageByAggregationType(partition) ,partition) ) { + printIntervalStats(statsByInterval, + getCorrectStream(partition, DoCOutputType.Aggregation.interval, DoCOutputType.FileType.summary), + getCorrectStream(partition, DoCOutputType.Aggregation.interval, DoCOutputType.FileType.statistics), + partition); + } else { + throw new ReviewedStingException("Partition type "+partition.toString()+" had no entries. Please check that your .bam header has all appropriate partition types."); + } } + } else { + throw new UserException.CommandLineException("Cannot reduce by interval without interval list provided. Please provide a -L argument."); } onTraversalDone(mergeAll(statsByInterval));