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.
Modifier and Type | Field and 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 and Description |
---|
VcfHeader(FileIt<java.lang.String> it)
Constructs a new
VcfHeader object from the VCF
meta-information lines and the VCF header line returned by the
specified FileIterator<String> . |
VcfHeader(FileIt<java.lang.String> it,
Filter<java.lang.String> sampleFilter)
Constructs a new
VcfHeader object from the VCF
meta-information lines and the VCF header line returned by the
specified FileIterator<String> . |
Modifier and Type | Method and Description |
---|---|
java.io.File |
file()
Returns the file from which data are read, or returns
null if the source is standard input. |
java.lang.String |
headerLine()
Returns the VCF header line.
|
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()
Returns
this.sample().ids() . |
Samples |
samples()
Return the list of samples after sample exclusions.
|
java.lang.String |
toString()
Returns the VCF meta-information lines and the VCF header line used to
construct
this . |
int |
unfilteredSampleIndex(int sample)
Returns the index of the specified sample in the the list original
list of samples before sample exclusions.
|
public static final java.lang.String HEADER_PREFIX
public VcfHeader(FileIt<java.lang.String> it)
VcfHeader
object from the VCF
meta-information lines and the VCF header line returned by the
specified FileIterator<String>
. This constructor will advance
the FileIterator<String>
to the point before the first VCF record
in the file. The VcfHeader
object will have no excluded samples.it
- an iterator that returns lines of VCF filejava.lang.IllegalArgumentException
- if any of the meta-information lines
returned by the specified FileIterator<String>
does not conform
to the VCF specificationjava.lang.IllegalArgumentException
- if the header lines returned by the
specified FileIterator<String>
does not conform to the VCF
specificationjava.lang.IllegalArgumentException
- if no header line is returned by the
specified FileIterator<String>
java.lang.NullPointerException
- if it == null
public VcfHeader(FileIt<java.lang.String> it, Filter<java.lang.String> sampleFilter)
VcfHeader
object from the VCF
meta-information lines and the VCF header line returned by the
specified FileIterator<String>
. This constructor will advance
the FileIterator<String>
to the point before the first VCF record in the file.it
- an iterator that returns lines of a VCF filesampleFilter
- a sample filter or null
java.lang.IllegalArgumentException
- if any of the meta-information lines
returned by the specified FileIterator<String>
does not conform
to the VCF specificationjava.lang.IllegalArgumentException
- if the header lines returned by the
specified FileIterator<String>
does not conform to the VCF
specificationjava.lang.IllegalArgumentException
- if no header line is returned by the
specified FileIterator<String>
java.lang.NullPointerException
- if it == null
public java.io.File file()
null
if the source is standard input.null
if the source is standard inputpublic int nMetaInfoLines()
public VcfMetaInfo metaInfoLine(int index)
index
- a VCF meta-information line indexjava.lang.IndexOutOfBoundsException
- if
index < 0 || index >= this.nMetaInfoLines()
public java.lang.String headerLine()
public int nHeaderFields()
public int nUnfilteredSamples()
public int unfilteredSampleIndex(int sample)
sample
- a sample indexjava.lang.IndexOutOfBoundsException
- if
sample < 0 || sample >= this.nSamples()
public int nSamples()
public Samples samples()
public java.lang.String[] sampleIds()
this.sample().ids()
.this.sample().ids()
public java.lang.String toString()
this
.toString
in class java.lang.Object
this