Search in sources :

Example 1 with SVKmer

use of org.broadinstitute.hellbender.tools.spark.sv.SVKmer in project gatk by broadinstitute.

the class ContainsKmerReadFilterTest method before.

@BeforeMethod
public void before() {
    final String kmerRef = "ATCGAGCGCTAGCGATGGCGCGCGATCGCGCTAGCGCGCTAGC";
    final SVKmerizer kmerizer = new SVKmerizer(kmerRef.getBytes(), kSize, new SVKmerShort(kSize));
    final ArrayList<SVKmer> kmerList = new ArrayList<>();
    while (kmerizer.hasNext()) {
        kmerList.add(kmerizer.next());
    }
    kmerSet = new HopscotchSet<>(kmerList);
}
Also used : SVKmer(org.broadinstitute.hellbender.tools.spark.sv.SVKmer) SVKmerShort(org.broadinstitute.hellbender.tools.spark.sv.SVKmerShort) ArrayList(java.util.ArrayList) SVKmerizer(org.broadinstitute.hellbender.tools.spark.sv.SVKmerizer) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 2 with SVKmer

use of org.broadinstitute.hellbender.tools.spark.sv.SVKmer in project gatk by broadinstitute.

the class PathSeqFilterSpark method doKmerFiltering.

@SuppressWarnings("unchecked")
private JavaRDD<GATKRead> doKmerFiltering(final JavaSparkContext ctx, final JavaRDD<GATKRead> reads) {
    final PipelineOptions options = getAuthenticatedGCSOptions();
    Input input = new Input(BucketUtils.openFile(KMER_LIB_PATH));
    Kryo kryo = new Kryo();
    kryo.setReferences(false);
    Set<SVKmer> kmerLibSet = (HopscotchSet<SVKmer>) kryo.readClassAndObject(input);
    return reads.filter(new ContainsKmerReadFilterSpark(ctx.broadcast(kmerLibSet), KMER_SIZE));
}
Also used : ContainsKmerReadFilterSpark(org.broadinstitute.hellbender.tools.spark.sv.ContainsKmerReadFilterSpark) Input(com.esotericsoftware.kryo.io.Input) HopscotchSet(org.broadinstitute.hellbender.tools.spark.utils.HopscotchSet) SVKmer(org.broadinstitute.hellbender.tools.spark.sv.SVKmer) PipelineOptions(com.google.cloud.dataflow.sdk.options.PipelineOptions) Kryo(com.esotericsoftware.kryo.Kryo)

Example 3 with SVKmer

use of org.broadinstitute.hellbender.tools.spark.sv.SVKmer in project gatk by broadinstitute.

the class PathSeqKmerSparkIntegrationTest method test.

@SuppressWarnings("unchecked")
@Test(groups = "spark")
public void test() throws Exception {
    final File expectedFile = getTestFile("kmer.hss");
    final File ref = getTestFile("hg19mini.fasta");
    final File output = createTempFile("test", ".hss");
    if (!output.delete()) {
        Assert.fail();
    }
    final ArgumentsBuilder args = new ArgumentsBuilder();
    args.addFileArgument("reference", ref);
    args.addOutput(output);
    this.runCommandLine(args.getArgsArray());
    Input input_expected = new Input(FileUtils.openInputStream(expectedFile));
    Input input_test = new Input(FileUtils.openInputStream(output));
    Kryo kryo = new Kryo();
    kryo.setReferences(false);
    Set<SVKmer> expectedKmerLib = (HopscotchSet<SVKmer>) kryo.readClassAndObject(input_expected);
    Set<SVKmer> testKmerLib = (HopscotchSet<SVKmer>) kryo.readClassAndObject(input_test);
    Assert.assertEquals(expectedKmerLib, testKmerLib);
}
Also used : Input(com.esotericsoftware.kryo.io.Input) HopscotchSet(org.broadinstitute.hellbender.tools.spark.utils.HopscotchSet) SVKmer(org.broadinstitute.hellbender.tools.spark.sv.SVKmer) ArgumentsBuilder(org.broadinstitute.hellbender.utils.test.ArgumentsBuilder) File(java.io.File) Kryo(com.esotericsoftware.kryo.Kryo) Test(org.testng.annotations.Test) CommandLineProgramTest(org.broadinstitute.hellbender.CommandLineProgramTest)

Aggregations

SVKmer (org.broadinstitute.hellbender.tools.spark.sv.SVKmer)3 Kryo (com.esotericsoftware.kryo.Kryo)2 Input (com.esotericsoftware.kryo.io.Input)2 HopscotchSet (org.broadinstitute.hellbender.tools.spark.utils.HopscotchSet)2 PipelineOptions (com.google.cloud.dataflow.sdk.options.PipelineOptions)1 File (java.io.File)1 ArrayList (java.util.ArrayList)1 CommandLineProgramTest (org.broadinstitute.hellbender.CommandLineProgramTest)1 ContainsKmerReadFilterSpark (org.broadinstitute.hellbender.tools.spark.sv.ContainsKmerReadFilterSpark)1 SVKmerShort (org.broadinstitute.hellbender.tools.spark.sv.SVKmerShort)1 SVKmerizer (org.broadinstitute.hellbender.tools.spark.sv.SVKmerizer)1 ArgumentsBuilder (org.broadinstitute.hellbender.utils.test.ArgumentsBuilder)1 BeforeMethod (org.testng.annotations.BeforeMethod)1 Test (org.testng.annotations.Test)1