Package vcf
Class FilterUtil
- java.lang.Object
-
- vcf.FilterUtil
-
public final class FilterUtil extends java.lang.Object
ClassFilterUtil
contains static methods for constructing marker filters.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Filter<Marker>
idFilter(java.util.Collection<java.lang.String> exclude)
Returns a filter that accepts all markers which do not have an identifier or chromomsome position present in the specified collection.static Filter<Marker>
markerFilter(java.io.File excludeMarkersFile)
Returns a filter that excludes markers that have an identifier or genome coordinates that matches a line of the specified file, or returnsnull
if theexcludeMarkersFile
parameter isnull
.static boolean
markerIsInSet(Marker marker, java.util.Set<java.lang.String> set)
Returnstrue
if the specified marker has an identifier is in the specified set, or if ("marker.chrom()" + ":" + "marker.pos()") is in the specified set, and returnsfalse
otherwise.static Filter<java.lang.String>
sampleFilter(java.io.File excludeSamplesFile)
Returns a filter that excludes samples that have an identifier that matches a line of the specified file, or returnsnull
if theexcludeSamplesFile
parameter isnull
-
-
-
Method Detail
-
markerFilter
public static Filter<Marker> markerFilter(java.io.File excludeMarkersFile)
Returns a filter that excludes markers that have an identifier or genome coordinates that matches a line of the specified file, or returnsnull
if theexcludeMarkersFile
parameter isnull
. Genome coordinates must be in "CHROM:POS" format.- Parameters:
excludeMarkersFile
- a file that contains an identifier or genome coordinate of one excluded marker on each line- Returns:
- a filter that excludes markers that have an identifier
or genome coordinates that matches a line of the specified file,
or
null
if theexcludeMarkersFile
parameter isnull
- Throws:
java.lang.IllegalArgumentException
- if the specified file does not existjava.lang.IllegalArgumentException
- if the specified file is a directoryjava.lang.IllegalArgumentException
- if any line of the specified file contains two non-white-space characters separated by one or more white-space characters
-
sampleFilter
public static Filter<java.lang.String> sampleFilter(java.io.File excludeSamplesFile)
Returns a filter that excludes samples that have an identifier that matches a line of the specified file, or returnsnull
if theexcludeSamplesFile
parameter isnull
- Parameters:
excludeSamplesFile
- a file which contains an identifier of one excluded sample on each line- Returns:
- a filter that excludes samples that have an identifier
that matches a line of the specified file, or
null
if theexcludeSamplesFile
parameter isnull
- Throws:
java.lang.IllegalArgumentException
- if the specified file does not existjava.lang.IllegalArgumentException
- if the specified file is a directoryjava.lang.IllegalArgumentException
- if any line of the specified file contains two non-white-space characters separated by one or more white-space characters
-
markerIsInSet
public static boolean markerIsInSet(Marker marker, java.util.Set<java.lang.String> set)
Returnstrue
if the specified marker has an identifier is in the specified set, or if ("marker.chrom()" + ":" + "marker.pos()") is in the specified set, and returnsfalse
otherwise.- Parameters:
marker
- a markerset
- a set of marker identifiers and chromosome positions in "CHROM:POS" format- Returns:
true
if the specified marker has an identifier is in the specified set or if ("marker.chrom()" + ":" + "marker.pos()") is in the specified set- Throws:
java.lang.NullPointerException
- ifmarker == null || set == null
-
idFilter
public static Filter<Marker> idFilter(java.util.Collection<java.lang.String> exclude)
Returns a filter that accepts all markers which do not have an identifier or chromomsome position present in the specified collection. A marker is excluded ifexclude.contains(marker.id(j)) == true
for any0 <= j < marker.nIds()
or ifexclude.contains(marker.chrom() + ":" + marker.pos()) == true
.- Parameters:
exclude
- a collection of marker identifiers and chromosome positions in "CHROM:POS" format- Returns:
- a filter that accepts all markers which do not have an identifier or chromomsome position present in the specified collection
- Throws:
java.lang.NullPointerException
- ifexclude == null
-
-