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 8 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,6 +77,7 @@ 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);

Expand Down Expand Up @@ -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 = InfiniumVcfFields.getOptionalValueFromVcfOtherHeaderLine(vcfHeader, InfiniumVcfFields.PIPELINE_VERSION);

vcfHeader.getGenotypeSamples().forEach(sampleName -> sampleMetricsMap.get(sampleName));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@ 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(shortName = StandardOptionDefinitions.INPUT_SHORT_NAME, doc = "Input vcf file for analysis")
public File INPUT;

Expand Down Expand Up @@ -438,6 +440,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
6 changes: 6 additions & 0 deletions src/main/java/picard/arrays/GtcToVcf.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ public class GtcToVcf extends CommandLineProgram {
@Argument(doc = "The sample alias")
public String SAMPLE_ALIAS;

@Argument(doc = "The version of the pipeline used to generate this VCF", optional = true)
public String PIPELINE_VERSION;

@Argument(doc = "The analysis version of the data used to generate this VCF", optional = true)
public Integer ANALYSIS_VERSION_NUMBER;

Expand Down Expand Up @@ -538,6 +541,9 @@ private VCFHeader createVCFHeader(final Build37ExtendedIlluminaManifest manifest
if (EXPECTED_GENDER != null) {
lines.add(new VCFHeaderLine(InfiniumVcfFields.EXPECTED_GENDER, EXPECTED_GENDER));
}
if (PIPELINE_VERSION != null) {
lines.add(new VCFHeaderLine(InfiniumVcfFields.PIPELINE_VERSION, PIPELINE_VERSION.toString()));
nikellepetrillo marked this conversation as resolved.
Show resolved Hide resolved
}
//add control codes
final int measurementCount = gtcFile.getRawControlXIntensities().length / ArraysControlInfo.CONTROL_INFO.length;
for (int i = 0; i < ArraysControlInfo.CONTROL_INFO.length; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public class InfiniumVcfFields {
public static final String P_95_RED = "p95Red";
public static final String P_95_GREEN = "p95Green";
public static final String SCANNER_NAME = "scannerName";
public static final String PIPELINE_VERSION = "pipelineVersion";

//FORMAT Fields
public static final String X = "X";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,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 +244,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
1 change: 1 addition & 0 deletions testdata/picard/arrays/7991775143_R01C01.vcf
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@
##p95Green=4251
##p95Red=5479
##picardVersion=Version:054660cc27c208419607db4f10ba598284dd545f
##pipelineVersion=foo
##reference=/cromwell_root/broad-references/hg19/v0/Homo_sapiens_assembly19.fasta
##sampleAlias=NA12878
##scannerName=N370
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@
##p95Green=4251
##p95Red=5479
##picardVersion=2.20.3-17-g8331bf3-SNAPSHOT
##pipelineVersion=foo
pshapiro4broad marked this conversation as resolved.
Show resolved Hide resolved
##reference=/seq/references/Homo_sapiens_assembly19/v1/Homo_sapiens_assembly19.fasta
##sampleAlias=NA12878
##scannerName=N370
Expand Down