-
Notifications
You must be signed in to change notification settings - Fork 596
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use overlaps partitioner in HaplotypeCaller
Broadcast HCEngine Make GenotypingEngine and IndexedSet Kryo-serializable
- Loading branch information
Showing
5 changed files
with
136 additions
and
29 deletions.
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
src/main/java/org/broadinstitute/hellbender/tools/DownsampleableSparkReadShard.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package org.broadinstitute.hellbender.tools; | ||
|
||
|
||
import java.io.Serializable; | ||
import java.util.Iterator; | ||
import org.broadinstitute.hellbender.engine.Shard; | ||
import org.broadinstitute.hellbender.engine.ShardBoundary; | ||
import org.broadinstitute.hellbender.utils.SimpleInterval; | ||
import org.broadinstitute.hellbender.utils.Utils; | ||
import org.broadinstitute.hellbender.utils.downsampling.ReadsDownsampler; | ||
import org.broadinstitute.hellbender.utils.downsampling.ReadsDownsamplingIterator; | ||
import org.broadinstitute.hellbender.utils.read.GATKRead; | ||
|
||
/** | ||
* A simple shard implementation intended to be used for splitting reads by partition in Spark tools | ||
*/ | ||
public final class DownsampleableSparkReadShard implements Shard<GATKRead>, Serializable { | ||
private static final long serialVersionUID = 1L; | ||
|
||
private final ShardBoundary boundaries; | ||
private final Iterable<GATKRead> reads; | ||
private ReadsDownsampler downsampler; | ||
|
||
public DownsampleableSparkReadShard(final ShardBoundary boundaries, final Iterable<GATKRead> reads){ | ||
this.boundaries = Utils.nonNull(boundaries); | ||
this.reads = Utils.nonNull(reads); | ||
} | ||
|
||
/** | ||
* Reads in this shard will be downsampled using this downsampler before being returned. | ||
* | ||
* @param downsampler downsampler to use (may be null, which signifies that no downsampling is to be performed) | ||
*/ | ||
public void setDownsampler(final ReadsDownsampler downsampler) { | ||
this.downsampler = downsampler; | ||
} | ||
|
||
@Override | ||
public SimpleInterval getInterval() { | ||
return boundaries.getInterval(); | ||
} | ||
|
||
@Override | ||
public SimpleInterval getPaddedInterval() { | ||
return boundaries.getPaddedInterval(); | ||
} | ||
|
||
@Override | ||
public Iterator<GATKRead> iterator() { | ||
Iterator<GATKRead> readsIterator = reads.iterator(); | ||
|
||
if ( downsampler != null ) { | ||
readsIterator = new ReadsDownsamplingIterator(readsIterator, downsampler); | ||
} | ||
|
||
return readsIterator; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters