diff --git a/pom.xml b/pom.xml index 3b1ec97e83..0387616e8c 100644 --- a/pom.xml +++ b/pom.xml @@ -61,7 +61,7 @@ 2.2 1.5 - 2.22 + 2.23 2.4.4 2.12.0 diff --git a/purity-ploidy-estimator/README.md b/purity-ploidy-estimator/README.md index 7248606f5d..29b33f948c 100644 --- a/purity-ploidy-estimator/README.md +++ b/purity-ploidy-estimator/README.md @@ -55,8 +55,8 @@ Argument | Default | Description run_dir | None | If provided, parameters `amber`, `cobalt` and `output_dir` are no longer mandatory and will have default values of /amber, /cobalt and /purple respectively unless overridden. threads | 2 | Number of threads to use. somatic_vcf | None | Optional location of somatic variants vcf. Sample name must match tumor parameter. GZ files supported. -structural_vcf | None | Optional location of structural variants vcf. Sample name must match tumor parameter. GZ files supported. -sv_recovery_vcf | None | Optional location of structural variants recovery vcf. Sample name must match tumor parameter. GZ files supported. +structural_vcf | None | Optional location of structural variants vcf. GZ files supported. +sv_recovery_vcf | None | Optional location of structural variants recovery vcf. GZ files supported. circos | None | Optional path to circos binary. When supplied, circos graphs will be written to /plot db_enabled | None | This parameter has no arguments. Optionally include if you wish to persist results to a database. Database initialization script can be found [here](https://github.com/hartwigmedical/hmftools/blob/master/patient-db/src/main/resources/generate_database.sql). db_user | None | Database username. Mandatory if db_enabled. @@ -502,6 +502,8 @@ Threads | Elapsed Time| CPU Time | Peak Mem ## Version History +- 2.23 + - Fixed bug where SV VCF samples were being sorted into alphabetical order. Now they will be in same order as input VCF. - 2.22 - Added new tool to annotate SNPs and INDELS in strelka output with AD field. Will **not** override existing AD values. - Example Usage: `java -Xmx4G -cp purple.jar com.hartwig.hmftools.purple.tools.AnnotateStrelkaWithAllelicDepth -in strelka.vcf -out strelka.annotated.vcf` diff --git a/purity-ploidy-estimator/src/main/java/com/hartwig/hmftools/purple/PurpleStructuralVariantSupplier.java b/purity-ploidy-estimator/src/main/java/com/hartwig/hmftools/purple/PurpleStructuralVariantSupplier.java index a911ecfddd..1c75cf2c70 100644 --- a/purity-ploidy-estimator/src/main/java/com/hartwig/hmftools/purple/PurpleStructuralVariantSupplier.java +++ b/purity-ploidy-estimator/src/main/java/com/hartwig/hmftools/purple/PurpleStructuralVariantSupplier.java @@ -16,6 +16,7 @@ import java.util.TreeSet; import java.util.function.Predicate; +import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.ListMultimap; import com.google.common.collect.Lists; import com.hartwig.hmftools.common.chromosome.Chromosome; @@ -82,7 +83,6 @@ class PurpleStructuralVariantSupplier { private static final Allele INCREASING_ALLELE = Allele.create(".N", false); private static final Allele DECREASING_ALLELE = Allele.create("N.", false); - private final String purpleVersion; private final String outputVCF; private final Optional header; private final TreeSet variantContexts; @@ -95,14 +95,12 @@ class PurpleStructuralVariantSupplier { header = Optional.empty(); variantContexts = new TreeSet<>(); outputVCF = Strings.EMPTY; - purpleVersion = "0"; } PurpleStructuralVariantSupplier(@NotNull final String version, @NotNull final String templateVCF, @NotNull final String outputVCF) { final VCFFileReader vcfReader = new VCFFileReader(new File(templateVCF), false); this.outputVCF = outputVCF; - purpleVersion = version; - header = Optional.of(generateOutputHeader(vcfReader.getFileHeader())); + header = Optional.of(generateOutputHeader(version, vcfReader.getFileHeader())); variantContexts = new TreeSet<>(new VCComparator(header.get().getSequenceDictionary())); for (VariantContext context : vcfReader) { variantContexts.add(context); @@ -294,8 +292,9 @@ public List variants() { } @NotNull - private VCFHeader generateOutputHeader(@NotNull final VCFHeader template) { - final VCFHeader outputVCFHeader = new VCFHeader(template.getMetaDataInInputOrder(), template.getSampleNamesInOrder()); + @VisibleForTesting + static VCFHeader generateOutputHeader(@NotNull final String purpleVersion, @NotNull final VCFHeader template) { + final VCFHeader outputVCFHeader = new VCFHeader(template.getMetaDataInInputOrder(), template.getGenotypeSamples()); outputVCFHeader.addMetaDataLine(new VCFHeaderLine("purpleVersion", purpleVersion)); outputVCFHeader.addMetaDataLine(VCFStandardHeaderLines.getFormatLine("GT")); diff --git a/purity-ploidy-estimator/src/test/java/com/hartwig/hmftools/purple/PurpleStructuralVariantSupplierTest.java b/purity-ploidy-estimator/src/test/java/com/hartwig/hmftools/purple/PurpleStructuralVariantSupplierTest.java new file mode 100644 index 0000000000..04ca733db0 --- /dev/null +++ b/purity-ploidy-estimator/src/test/java/com/hartwig/hmftools/purple/PurpleStructuralVariantSupplierTest.java @@ -0,0 +1,24 @@ +package com.hartwig.hmftools.purple; + +import static org.junit.Assert.assertEquals; + +import java.util.Collections; + +import com.google.common.collect.Lists; + +import org.junit.Test; + +import htsjdk.variant.vcf.VCFHeader; + +public class PurpleStructuralVariantSupplierTest { + + @Test + public void testHeaderSamplesAreNotSorted() { + final VCFHeader outOfOrderHeader = new VCFHeader(Collections.emptySet(), Lists.newArrayList("BBBBB", "AAAAA")); + final VCFHeader victim = PurpleStructuralVariantSupplier.generateOutputHeader("2.23", outOfOrderHeader); + assertEquals(2, victim.getGenotypeSamples().size()); + assertEquals("BBBBB", victim.getGenotypeSamples().get(0)); + assertEquals("AAAAA", victim.getGenotypeSamples().get(1)); + } + +}