Skip to content

Commit

Permalink
tranche filtering in java
Browse files Browse the repository at this point in the history
  • Loading branch information
lucidtronix committed Jun 11, 2018
1 parent 1a7b0b7 commit 9195390
Show file tree
Hide file tree
Showing 10 changed files with 277 additions and 250 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ protected void onStartup() {

@Override
protected Object doWork() {
final Resource pythonScriptResource = new Resource("training.py", FilterVariantTranches.class);
final Resource pythonScriptResource = new Resource("training.py", CNNVariantTrain.class);
List<String> arguments = new ArrayList<>(Arrays.asList(
"--data_dir", inputTensorDir,
"--output_dir", outputDir,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ protected void onStartup() {

@Override
protected Object doWork() {
final Resource pythonScriptResource = new Resource("training.py", FilterVariantTranches.class);
final Resource pythonScriptResource = new Resource("training.py", CNNVariantWriteTensors.class);
List<String> arguments = new ArrayList<>(Arrays.asList(
"--reference_fasta", reference,
"--input_vcf", inputVcf,
Expand Down

Large diffs are not rendered by default.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,10 @@ public void testTranches() {
args.add("FilterVariantTranches")
.addArgument(StandardArgumentDefinitions.VARIANT_LONG_NAME, trancheVCF)
.addArgument(StandardArgumentDefinitions.OUTPUT_LONG_NAME, outputVCF.getAbsolutePath())
.addArgument("snp-truth-vcf", snpTruthVCF)
.addArgument("indel-truth-vcf", indelTruthVCF)
.addArgument("resource", snpTruthVCF)
.addArgument("resource", indelTruthVCF)
.addArgument("tranche", "99.0")
.addArgument("tranche", "95.0")
.addArgument("max-sites", "2000")
.addArgument("info-key", "VQSLOD");

new Main().instanceMain(args.getArgsArray());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
package org.broadinstitute.hellbender.tools.walkers.vqsr;

import org.broadinstitute.hellbender.CommandLineProgramTest;
import org.broadinstitute.hellbender.utils.test.ArgumentsBuilder;
import org.broadinstitute.hellbender.utils.test.IntegrationTestSpec;
import org.broadinstitute.hellbender.cmdline.StandardArgumentDefinitions;

import org.testng.annotations.Test;

import java.util.Arrays;
import java.io.IOException;

public class FilterVariantTranchesIntegrationTest extends CommandLineProgramTest {


/**
* Run the tool on a small test VCF.
*/
@Test
public void testTrancheFiltering() throws IOException {
final String trancheVCF = largeFileTestDir + "VQSR/g94982_20_1m_10m_python_2dcnn.vcf.gz";
final String indelTruthVCF = largeFileTestDir + "VQSR/ALL.wgs.indels_mills_devine_hg19_leftAligned_collapsed_double_hit.sites.20.1M-10M.vcf";
final String snpTruthVCF = largeFileTestDir + "VQSR/Omni25_sites_1525_samples.b37.20.1M-10M.vcf";
final ArgumentsBuilder argsBuilder = new ArgumentsBuilder();
argsBuilder.addArgument(StandardArgumentDefinitions.VARIANT_LONG_NAME, trancheVCF)
.addArgument(StandardArgumentDefinitions.OUTPUT_LONG_NAME, "%s")
.addArgument("resource", snpTruthVCF)
.addArgument("resource", indelTruthVCF)
.addArgument("tranche", "99.0")
.addArgument("info-key", "MIX_SMALL_2D_W_DROPOUT")
.addArgument(StandardArgumentDefinitions.ADD_OUTPUT_VCF_COMMANDLINE, "false");

final IntegrationTestSpec spec = new IntegrationTestSpec(argsBuilder.toString(),
Arrays.asList(largeFileTestDir + "VQSR/expected/g94982_20_1m_10m_tranched_99.vcf"));
spec.executeTest("testTrancheFiltering", this);
}

@Test
public void testTrancheFilteringDuplicate() throws IOException {
final String trancheVCF = largeFileTestDir + "VQSR/g94982_20_1m_10m_python_2dcnn.vcf.gz";
final String indelTruthVCF = largeFileTestDir + "VQSR/ALL.wgs.indels_mills_devine_hg19_leftAligned_collapsed_double_hit.sites.20.1M-10M.vcf";
final String snpTruthVCF = largeFileTestDir + "VQSR/Omni25_sites_1525_samples.b37.20.1M-10M.vcf";
final ArgumentsBuilder argsBuilder = new ArgumentsBuilder();
argsBuilder.addArgument(StandardArgumentDefinitions.VARIANT_LONG_NAME, trancheVCF)
.addArgument(StandardArgumentDefinitions.OUTPUT_LONG_NAME, "%s")
.addArgument("resource", snpTruthVCF)
.addArgument("resource", indelTruthVCF)
.addArgument("tranche", "99.0")
.addArgument("tranche", "99.0")
.addArgument("info-key", "MIX_SMALL_2D_W_DROPOUT")
.addArgument(StandardArgumentDefinitions.ADD_OUTPUT_VCF_COMMANDLINE, "false");

final IntegrationTestSpec spec = new IntegrationTestSpec(argsBuilder.toString(),
Arrays.asList(largeFileTestDir + "VQSR/expected/g94982_20_1m_10m_tranched_99.vcf"));
spec.executeTest("testTrancheFilteringDuplicate", this);
}

@Test
public void testTrancheFilteringTranches() throws IOException {
final String trancheVCF = largeFileTestDir + "VQSR/g94982_20_1m_10m_python_2dcnn.vcf.gz";
final String indelTruthVCF = largeFileTestDir + "VQSR/ALL.wgs.indels_mills_devine_hg19_leftAligned_collapsed_double_hit.sites.20.1M-10M.vcf";
final String snpTruthVCF = largeFileTestDir + "VQSR/Omni25_sites_1525_samples.b37.20.1M-10M.vcf";
final ArgumentsBuilder argsBuilder = new ArgumentsBuilder();
argsBuilder.addArgument(StandardArgumentDefinitions.VARIANT_LONG_NAME, trancheVCF)
.addArgument(StandardArgumentDefinitions.OUTPUT_LONG_NAME, "%s")
.addArgument("resource", snpTruthVCF)
.addArgument("resource", indelTruthVCF)
.addArgument("tranche", "95.0")
.addArgument("tranche", "99.0")
.addArgument("tranche", "99.9")
.addArgument("info-key", "MIX_SMALL_2D_W_DROPOUT")
.addArgument(StandardArgumentDefinitions.ADD_OUTPUT_VCF_COMMANDLINE, "false");

final IntegrationTestSpec spec = new IntegrationTestSpec(argsBuilder.toString(),
Arrays.asList(largeFileTestDir + "VQSR/expected/g94982_20_1m_10m_tranched_95_99_99.9.vcf"));
spec.executeTest("testTrancheFilteringTranches", this);
}

@Test
public void testTrancheFilteringTranchesOrder() throws IOException {
final String trancheVCF = largeFileTestDir + "VQSR/g94982_20_1m_10m_python_2dcnn.vcf.gz";
final String indelTruthVCF = largeFileTestDir + "VQSR/ALL.wgs.indels_mills_devine_hg19_leftAligned_collapsed_double_hit.sites.20.1M-10M.vcf";
final String snpTruthVCF = largeFileTestDir + "VQSR/Omni25_sites_1525_samples.b37.20.1M-10M.vcf";
final ArgumentsBuilder argsBuilder = new ArgumentsBuilder();
argsBuilder.addArgument(StandardArgumentDefinitions.VARIANT_LONG_NAME, trancheVCF)
.addArgument(StandardArgumentDefinitions.OUTPUT_LONG_NAME, "%s")
.addArgument("resource", snpTruthVCF)
.addArgument("resource", indelTruthVCF)
.addArgument("tranche", "99.9")
.addArgument("tranche", "95.0")
.addArgument("tranche", "99.0")
.addArgument("info-key", "MIX_SMALL_2D_W_DROPOUT")
.addArgument(StandardArgumentDefinitions.ADD_OUTPUT_VCF_COMMANDLINE, "false");

final IntegrationTestSpec spec = new IntegrationTestSpec(argsBuilder.toString(),
Arrays.asList(largeFileTestDir + "VQSR/expected/g94982_20_1m_10m_tranched_95_99_99.9.vcf"));
spec.executeTest("testTrancheFilteringTranchesOrder", this);
}

}
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown

0 comments on commit 9195390

Please sign in to comment.