Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gl-916 add pipeline version to metrics #1515

Merged
merged 13 commits into from
Jun 1, 2020
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class ArraysCallingMetricAccumulator implements VariantProcessor.Accumulator<Arr
private Integer p95Green;
private Integer p95Red;
private String scannerName;
private String pipelineVersion;

/**
* A map of sample names to metrics. If .get() for a not-yet-existing sample name, a metric is generated, inserted into the map,
Expand Down Expand Up @@ -76,14 +77,15 @@ class ArraysCallingMetricAccumulator implements VariantProcessor.Accumulator<Arr
detail.P95_GREEN = p95Green;
detail.P95_RED = p95Red;
detail.SCANNER_NAME = scannerName;
detail.PIPELINE_VERSION = pipelineVersion;
return detail;
}, true);

ArraysCallingMetricAccumulator(DbSnpBitSetUtil.DbSnpBitSets dbsnp) {
this.dbsnp = dbsnp;
}

public void setup(final VCFHeader vcfHeader) {
public void setup(final VCFHeader vcfHeader, final String pipelineVersion) {
pshapiro4broad marked this conversation as resolved.
Show resolved Hide resolved
this.sampleAlias = InfiniumVcfFields.getValueFromVcfOtherHeaderLine(vcfHeader, InfiniumVcfFields.SAMPLE_ALIAS);
this.analysisVersionNumber = InfiniumVcfFields.getOptionalIntegerFromVcfOtherHeaderLine(vcfHeader, InfiniumVcfFields.ANALYSIS_VERSION_NUMBER);
this.chipTypeName = InfiniumVcfFields.getValueFromVcfOtherHeaderLine(vcfHeader, InfiniumVcfFields.ARRAY_TYPE);
Expand All @@ -103,6 +105,7 @@ public void setup(final VCFHeader vcfHeader) {
this.p95Green = InfiniumVcfFields.getIntegerFromVcfOtherHeaderLine(vcfHeader, InfiniumVcfFields.P_95_GREEN);
this.p95Red = InfiniumVcfFields.getIntegerFromVcfOtherHeaderLine(vcfHeader, InfiniumVcfFields.P_95_RED);
this.scannerName = InfiniumVcfFields.getValueFromVcfOtherHeaderLine(vcfHeader, InfiniumVcfFields.SCANNER_NAME);
this.pipelineVersion = pipelineVersion;

vcfHeader.getGenotypeSamples().forEach(sampleName -> sampleMetricsMap.get(sampleName));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,14 @@ public class CollectArraysVariantCallingMetrics extends CommandLineProgram {
"<h4>Usage example:</h4>" +
"<pre>" +
"java -jar picard.jar CollectArraysVariantCallingMetrics \\<br />" +
// TODO - ADD example
nikellepetrillo marked this conversation as resolved.
Show resolved Hide resolved
" INPUT=genotyping_arrays.vcf \\<br />" +
" OUTPUT=outputBaseName" +
"</pre>";

@Argument(doc = "The pipeline version used to create these metrics", optional = true)
public String PIPELINE_VERSION;

@Argument(shortName = StandardOptionDefinitions.INPUT_SHORT_NAME, doc = "Input vcf file for analysis")
public File INPUT;

Expand Down Expand Up @@ -106,7 +110,7 @@ protected int doWork() {
VariantProcessor.Builder
.generatingAccumulatorsBy(() -> {
ArraysCallingMetricAccumulator accumulator = new ArraysCallingMetricAccumulator(dbsnp);
accumulator.setup(vcfHeader);
accumulator.setup(vcfHeader, PIPELINE_VERSION);
return accumulator;
})
.combiningResultsBy(ArraysCallingMetricAccumulator.Result::merge)
Expand Down Expand Up @@ -438,6 +442,12 @@ public static class ArraysVariantCallingDetailMetrics extends CollectArraysVaria
@MergeByAssertEquals
public String SCANNER_NAME;

/**
* The version of the pipeline used for this sample
*/
@MergeByAssertEquals
public String PIPELINE_VERSION;

/**
* Hidden fields not propagated to the metrics file.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public void testCollectArraysVariantCallingMetricsOverkillTest(final String chip

final CollectArraysVariantCallingMetrics collectArraysVariantCallingMetrics = new CollectArraysVariantCallingMetrics();
collectArraysVariantCallingMetrics.INPUT = vcfFile;
collectArraysVariantCallingMetrics.PIPELINE_VERSION = "foo";
collectArraysVariantCallingMetrics.DBSNP = dbSnpFile;
collectArraysVariantCallingMetrics.OUTPUT = outputBaseFile;
collectArraysVariantCallingMetrics.NUM_PROCESSORS = 1;
Expand Down Expand Up @@ -135,6 +136,7 @@ public void testCollectArraysVariantCallingMetricsOverkillTest(final String chip
Assert.assertEquals(metrics.AUTOCALL_CALL_RATE, (float) metrics.NUM_AUTOCALL_CALLS / metrics.NUM_NON_FILTERED_ASSAYS, 0.0001);

Assert.assertEquals(metrics.NUM_SINGLETONS, 7);
Assert.assertEquals(metrics.PIPELINE_VERSION, "foo");
});

Assert.assertEquals(detailMetrics.size(), 1, "Did not parse the desired number of detail metrics.");
Expand Down Expand Up @@ -243,6 +245,7 @@ public void testCollectArraysVariantCallingMetricsTwoSamples() throws IOExceptio
Assert.assertEquals(metrics.AUTOCALL_CALL_RATE, (float) metrics.NUM_AUTOCALL_CALLS / metrics.NUM_NON_FILTERED_ASSAYS, 0.0001);

Assert.assertEquals(metrics.NUM_SINGLETONS, 1);
Assert.assertNull(metrics.PIPELINE_VERSION);
});

Assert.assertEquals(detailMetrics.size(), 2, "Did not parse the desired number of detail metrics.");
Expand Down