-
Notifications
You must be signed in to change notification settings - Fork 577
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Port SelectVariants tool and dependent infrastructure.
- Loading branch information
Showing
93 changed files
with
13,639 additions
and
49 deletions.
There are no files selected for viewing
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
27 changes: 27 additions & 0 deletions
27
src/main/java/org/broadinstitute/hellbender/engine/filters/ExcludeIDsVariantFilter.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,27 @@ | ||
package org.broadinstitute.hellbender.engine.filters; | ||
|
||
import htsjdk.variant.variantcontext.VariantContext; | ||
import org.broadinstitute.hellbender.utils.Utils; | ||
|
||
import java.util.Set; | ||
import java.util.HashSet; | ||
|
||
/** | ||
* Exclude variants with any of these IDs. | ||
* Matching is done by case-sensitive exact match. | ||
*/ | ||
public final class ExcludeIDsVariantFilter implements VariantFilter { | ||
private static final long serialVersionUID = 1L; | ||
|
||
private final HashSet<String> excludeIDs = new HashSet<>(); | ||
|
||
public ExcludeIDsVariantFilter(Set<String> discardIDs) { | ||
Utils.nonNull(discardIDs); | ||
excludeIDs.addAll(discardIDs); | ||
} | ||
|
||
@Override | ||
public boolean test(final VariantContext vc) { | ||
return !excludeIDs.contains(vc.getID()); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/main/java/org/broadinstitute/hellbender/engine/filters/IncludeIDsVariantFilter.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,27 @@ | ||
package org.broadinstitute.hellbender.engine.filters; | ||
|
||
import htsjdk.variant.variantcontext.VariantContext; | ||
import org.broadinstitute.hellbender.utils.Utils; | ||
|
||
import java.util.Set; | ||
import java.util.HashSet; | ||
|
||
/** | ||
* Keep only variants with any of these IDs. | ||
* Matching is done by case-sensitive exact match. | ||
*/ | ||
public final class IncludeIDsVariantFilter implements VariantFilter { | ||
private final static long serialVersionUID = 1L; | ||
|
||
private final HashSet<String> includeIDs = new HashSet<>(); | ||
|
||
public IncludeIDsVariantFilter(Set<String> keepIDs) { | ||
Utils.nonNull(keepIDs); | ||
includeIDs.addAll(keepIDs); | ||
} | ||
|
||
@Override | ||
public boolean test(final VariantContext vc) { | ||
return includeIDs.contains(vc.getID()); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/main/java/org/broadinstitute/hellbender/engine/filters/IntervalVariantFilter.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,30 @@ | ||
package org.broadinstitute.hellbender.engine.filters; | ||
|
||
import htsjdk.samtools.util.Locatable; | ||
import htsjdk.variant.variantcontext.VariantContext; | ||
import org.broadinstitute.hellbender.utils.GenomeLoc; | ||
import org.broadinstitute.hellbender.utils.IntervalUtils; | ||
import org.broadinstitute.hellbender.utils.Utils; | ||
import org.broadinstitute.hellbender.utils.variant.GATKVariantContextUtils; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Keep only variants that overlap any of the supplied genomic intervals. | ||
*/ | ||
public final class IntervalVariantFilter implements VariantFilter { | ||
private static final long serialVersionUID = 1L; | ||
|
||
private final List<GenomeLoc> genomeLocs; | ||
|
||
public IntervalVariantFilter(List<GenomeLoc> intervals) { | ||
Utils.nonNull(intervals); | ||
genomeLocs = intervals; | ||
} | ||
|
||
@Override | ||
public boolean test( final VariantContext vc ) { | ||
final Locatable targetLoc = GATKVariantContextUtils.getLocation(vc); | ||
return genomeLocs.stream().anyMatch(loc -> IntervalUtils.overlaps(loc, targetLoc)); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/org/broadinstitute/hellbender/engine/filters/VariantTypesVariantFilter.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,26 @@ | ||
package org.broadinstitute.hellbender.engine.filters; | ||
|
||
import htsjdk.variant.variantcontext.VariantContext; | ||
import org.broadinstitute.hellbender.utils.Utils; | ||
|
||
import java.util.Set; | ||
|
||
/** | ||
* Keep only variants with any of these variant types. | ||
*/ | ||
public final class VariantTypesVariantFilter implements VariantFilter { | ||
private static final long serialVersionUID = 1L; | ||
|
||
private final Set<VariantContext.Type> sampleTypes; | ||
|
||
public VariantTypesVariantFilter(Set<VariantContext.Type> includeTypes) { | ||
Utils.nonNull(includeTypes); | ||
sampleTypes = includeTypes; | ||
} | ||
|
||
@Override | ||
public boolean test(final VariantContext vc) { | ||
final VariantContext.Type vcSampleType = vc.getType(); | ||
return sampleTypes.contains(vcSampleType); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/org/broadinstitute/hellbender/engine/samples/Affection.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,22 @@ | ||
package org.broadinstitute.hellbender.engine.samples; | ||
|
||
/** | ||
* Categorical sample trait for association and analysis | ||
* | ||
* Samples can have unknown status, be affected or unaffected by the | ||
* categorical trait, or they can be marked as actually having an | ||
* other trait value (stored in an associated value in the Sample class) | ||
* | ||
* @author Mark DePristo | ||
* @since Sept. 2011 | ||
*/ | ||
public enum Affection { | ||
/** Status is unknown */ | ||
UNKNOWN, | ||
/** Suffers from the disease */ | ||
AFFECTED, | ||
/** Unaffected by the disease */ | ||
UNAFFECTED, | ||
/** An "other" trait: value of the trait is stored elsewhere and is an arbitrary string */ | ||
OTHER | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/org/broadinstitute/hellbender/engine/samples/Gender.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,10 @@ | ||
package org.broadinstitute.hellbender.engine.samples; | ||
|
||
/** | ||
* ENUM of possible human genders: male, female, or unknown | ||
*/ | ||
public enum Gender { | ||
MALE, | ||
FEMALE, | ||
UNKNOWN | ||
} |
Oops, something went wrong.