Package vcf
Class VcfHeader
- java.lang.Object
-
- vcf.VcfHeader
-
public final class VcfHeader extends java.lang.Object
Class
VcfHeader
represents the Variant Call Format (VCF) meta-information lines and the Variant Call Format header line that precede the first Variant Call Format record.Instances of class
VcfHeader
are immutable.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
HEADER_PREFIX
A string equal to the first nine tab-delimited fields of a VCF header line that contains sample data.
-
Constructor Summary
Constructors Constructor Description VcfHeader(java.lang.String src, java.lang.String[] lines, boolean[] isDiploid)
Returns a VCF header object for the specified VCF meta information lines and header line.VcfHeader(java.lang.String src, java.lang.String[] lines, boolean[] isDiploid, Filter<java.lang.String> sampleFilter)
Returns a VCF header object for the specified VCF meta information lines and header line.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description VcfMetaInfo
metaInfoLine(int index)
Returns the specified VCF meta-information line.int
nHeaderFields()
Returns the number of fields in the VCF header line before sample exclusions.int
nMetaInfoLines()
Returns the number of VCF meta-information lines.int
nSamples()
Returns the number of samples after sample exclusions.int
nUnfilteredSamples()
Returns the number of samples before sample exclusions.java.lang.String[]
sampleIds()
Returnsthis.sample().ids()
.Samples
samples()
Return the list of samples after sample exclusions.java.lang.String
src()
Returns the source from which data are read.java.lang.String
toString()
Returns the VCF meta-information lines and the VCF header line after applying sample exclusions.int
unfilteredSampleIndex(int sample)
Returns the index of the specified sample in the original list of samples before sample exclusions.
-
-
-
Field Detail
-
HEADER_PREFIX
public static final java.lang.String HEADER_PREFIX
A string equal to the first nine tab-delimited fields of a VCF header line that contains sample data.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
VcfHeader
public VcfHeader(java.lang.String src, java.lang.String[] lines, boolean[] isDiploid)
Returns a VCF header object for the specified VCF meta information lines and header line. The header line must be the last line in the specifiedlines
array.- Parameters:
src
- a string describing the source of the VCF filelines
- the VCF meta-information and header linesisDiploid
- a boolean array whosek
-th value istrue
if thek
-th sample is diploid, and isfalse
if thek
-th sample is haploid- Throws:
java.lang.IllegalArgumentException
- if a format error is encountered in a meta-information line or header lines}java.lang.NullPointerException
- ifsrc==null || lines == null || isDiploid == nulle
-
VcfHeader
public VcfHeader(java.lang.String src, java.lang.String[] lines, boolean[] isDiploid, Filter<java.lang.String> sampleFilter)
Returns a VCF header object for the specified VCF meta information lines and header line. The header line must be the last line in the specifiedlines
array.- Parameters:
src
- a string describing the source of the VCF filelines
- the VCF meta-information and header linesisDiploid
- a boolean array whosek
-th value istrue
if thek
-th sample is diploid, and isfalse
if thek
-th sample is haploidsampleFilter
- a sample filter- Throws:
java.lang.IllegalArgumentException
- if a format error is encountered in a meta-information line or header lines}java.lang.NullPointerException
- ifsrc==null || lines == null || isDiploid == null
-
-
Method Detail
-
src
public java.lang.String src()
Returns the source from which data are read. The string representation of the source is undefined and subject to change.- Returns:
- the source from which data are read
-
nMetaInfoLines
public int nMetaInfoLines()
Returns the number of VCF meta-information lines. VCF meta-information lines are lines that precede the VCF header line. A VCF meta-information line must begin with "##".- Returns:
- the number of VCF meta-information lines
-
metaInfoLine
public VcfMetaInfo metaInfoLine(int index)
Returns the specified VCF meta-information line.- Parameters:
index
- a VCF meta-information line index- Returns:
- the specified VCF meta-information line
- Throws:
java.lang.IndexOutOfBoundsException
- ifindex < 0 || index >= this.nMetaInfoLines()
-
nHeaderFields
public int nHeaderFields()
Returns the number of fields in the VCF header line before sample exclusions.- Returns:
- the number of fields in the VCF header line before sample exclusions
-
nUnfilteredSamples
public int nUnfilteredSamples()
Returns the number of samples before sample exclusions.- Returns:
- the number of samples before sample exclusions
-
unfilteredSampleIndex
public int unfilteredSampleIndex(int sample)
Returns the index of the specified sample in the original list of samples before sample exclusions.- Parameters:
sample
- a sample index- Returns:
- the index of the specified sample in the original list of samples before sample exclusions
- Throws:
java.lang.IndexOutOfBoundsException
- ifsample < 0 || sample >= this.size()
-
nSamples
public int nSamples()
Returns the number of samples after sample exclusions.- Returns:
- the number of samples after sample exclusions
-
samples
public Samples samples()
Return the list of samples after sample exclusions.- Returns:
- the list of samples after sample exclusions
-
sampleIds
public java.lang.String[] sampleIds()
Returnsthis.sample().ids()
.- Returns:
this.sample().ids()
-
toString
public java.lang.String toString()
Returns the VCF meta-information lines and the VCF header line after applying sample exclusions.- Overrides:
toString
in classjava.lang.Object
- Returns:
- the VCF meta-information lines and the VCF header line after applying sample exclusions.
-
-