Fix a NullPointerException that could occur in DoC if the user requested an interval summary but never provided a -L argument. This situation is now checked for and a UserError thrown instead. Also (after a great struggle) pushing some old VR3 code into the central repository which had been improperly pushed (e.g. with rsync rather than git push) into my repository on the server, and never migrated to unstable. In addition, minor convenience function added to the GATKReport that allows an entire row to be added, and a walker that parses out annotations from a tool called VariantEffectPredictor and summarizes annotations across transcripts, and consensus annotations.
This commit is contained in:
parent
4393adf9e7
commit
79ef3325bd
|
|
@ -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.
|
||||
* <p/>
|
||||
* A simple GATK Report consists of:
|
||||
* <p/>
|
||||
* - A single table
|
||||
* - No primary key ( it is hidden )
|
||||
* <p/>
|
||||
* Optional:
|
||||
* - Only untyped columns. As long as the data is an Object, it will be accepted.
|
||||
* - Default column values being empty strings.
|
||||
* <p/>
|
||||
* Limitations:
|
||||
* <p/>
|
||||
* - 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<String> 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<Object> 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++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -405,15 +405,19 @@ public class DepthOfCoverageWalker extends LocusWalker<Map<DoCOutputType.Partiti
|
|||
printGeneStats(statsByInterval);
|
||||
}
|
||||
|
||||
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.");
|
||||
if ( statsByInterval.size() > 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));
|
||||
|
|
|
|||
Loading…
Reference in New Issue