E
- the type parameterpublic class VcfIt<E extends MarkerContainer> extends java.lang.Object implements SampleFileIt<E>
Class VcfIt
represents an iterator whose next()
method returns an object storing data from a VCF record.
Instances of class VcfIt
are not thread-safe.
Methods of this class will terminate the Java Virtual Machine with an error message if an I/O error or file format error is detected.
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_BUFFER_SIZE
The default number of VCF records stored in a buffer, which is 1000.
|
static java.util.function.BiFunction<VcfHeader,java.lang.String,VcfEmission> |
toBitSetGT
A function mapping a string VCF record with GT format fields
to a
VcfEmission object. |
static java.util.function.BiFunction<VcfHeader,java.lang.String,VcfRecord> |
toGLRec
A function mapping a string VCF record with GL format fields
to a
VcfRecord object. |
static java.util.function.BiFunction<VcfHeader,java.lang.String,VcfRecord> |
toGTGLRec
A function mapping a string VCF record with GT or GL format fields
to a
VcfRecord object. |
Modifier and Type | Method and Description |
---|---|
void |
close()
Terminates the iteration and releases any system resources that
are held by this object.
|
static <R extends VcfEmission> |
create(FileIt<java.lang.String> strIt,
java.util.function.BiFunction<VcfHeader,java.lang.String,R> recMapper)
Create and returns a new
VcfIt instance from the specified
objects. |
static <R extends VcfEmission> |
create(FileIt<java.lang.String> strIt,
Filter<java.lang.String> sampleFilter,
java.util.function.BiFunction<VcfHeader,java.lang.String,R> recMapper)
Create and returns a new
VcfIt instance from the specified
objects. |
static <R extends VcfEmission> |
create(FileIt<java.lang.String> strIt,
Filter<java.lang.String> sampleFilter,
Filter<Marker> markerFilter,
java.util.function.BiFunction<VcfHeader,java.lang.String,R> recMapper)
Create and returns a new
VcfIt instance from the specified
objects. |
static <R extends VcfEmission> |
create(FileIt<java.lang.String> strIt,
Filter<java.lang.String> sampleFilter,
Filter<Marker> markerFilter,
java.util.function.BiFunction<VcfHeader,java.lang.String,R> recMapper,
int bufferSize)
Create and returns a new
VcfIt instance from the specified
objects. |
java.io.File |
file()
Returns the file from which the data are read, or
null if the data are read from standard input or are
computed data. |
boolean |
hasNext()
Returns
true if the iteration has more elements, and returns
false otherwise. |
E |
next()
Returns the next element in the iteration.
|
void |
remove()
The
remove method is not supported by this iterator. |
Samples |
samples()
Returns the list of samples.
|
java.lang.String |
toString()
Returns a string representation of
this . |
public static final int DEFAULT_BUFFER_SIZE
public static final java.util.function.BiFunction<VcfHeader,java.lang.String,VcfRecord> toGTGLRec
VcfRecord
object.public static final java.util.function.BiFunction<VcfHeader,java.lang.String,VcfRecord> toGLRec
VcfRecord
object.public static final java.util.function.BiFunction<VcfHeader,java.lang.String,VcfEmission> toBitSetGT
VcfEmission
object.public static <R extends VcfEmission> VcfIt<R> create(FileIt<java.lang.String> strIt, java.util.function.BiFunction<VcfHeader,java.lang.String,R> recMapper)
VcfIt
instance from the specified
objects.R
- the type returned by the returned VcfIt
strIt
- an iterator that returns lines of a VCF filerecMapper
- a function mapping string VCF records to
VcfEmission
objectsVcfIt
instancejava.lang.IllegalArgumentException
- if a format error is detected in a
line of a VCF file returned by strIt
java.lang.NullPointerException
- if
strIt == null || recMapper == null
public static <R extends VcfEmission> VcfIt<R> create(FileIt<java.lang.String> strIt, Filter<java.lang.String> sampleFilter, java.util.function.BiFunction<VcfHeader,java.lang.String,R> recMapper)
VcfIt
instance from the specified
objects.R
- the type returned by the returned VcfIt
strIt
- an iterator that returns lines of a VCF filesampleFilter
- a sample filter or null
recMapper
- a function mapping string VCF records to
VcfEmission
objectsVcfIt
instancejava.lang.IllegalArgumentException
- if a format error is detected in a
line of a VCF file returned by strIt
java.lang.NullPointerException
- if
strIt == null || recMapper == null
public static <R extends VcfEmission> VcfIt<R> create(FileIt<java.lang.String> strIt, Filter<java.lang.String> sampleFilter, Filter<Marker> markerFilter, java.util.function.BiFunction<VcfHeader,java.lang.String,R> recMapper)
VcfIt
instance from the specified
objects.R
- the type returned by the returned VcfIt
strIt
- an iterator that returns lines of a VCF filesampleFilter
- a sample filter or null
markerFilter
- a marker filter or null
recMapper
- a function mapping string VCF records to
VcfEmission
objectsVcfIt
instancejava.lang.IllegalArgumentException
- if a format error is detected in a
line of a VCF file returned by strIt
java.lang.NullPointerException
- if
strIt == null || recMapper == null
public static <R extends VcfEmission> VcfIt<R> create(FileIt<java.lang.String> strIt, Filter<java.lang.String> sampleFilter, Filter<Marker> markerFilter, java.util.function.BiFunction<VcfHeader,java.lang.String,R> recMapper, int bufferSize)
VcfIt
instance from the specified
objects.R
- the type returned by the returned VcfIt
strIt
- an iterator that returns lines of a VCF filesampleFilter
- a sample filter or null
markerFilter
- a marker filter or null
recMapper
- a function mapping string VCF records to
VcfEmission
objectsbufferSize
- the buffer sizeVcfIt
instancejava.lang.IllegalArgumentException
- if a format error is detected in a
line of a VCF file returned by strIt
java.lang.IllegalArgumentException
- if bufferSize < 1
java.lang.NullPointerException
- if
strIt == null || recMapper == null
public void close()
FileIt
close
, further
invocations of close()
have no effect.close
in interface FileIt<E extends MarkerContainer>
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
public boolean hasNext()
true
if the iteration has more elements, and returns
false
otherwise.hasNext
in interface java.util.Iterator<E extends MarkerContainer>
true
if the iteration has more elementspublic E next()
next
in interface java.util.Iterator<E extends MarkerContainer>
java.util.NoSuchElementException
- if the iteration has no more elements.public void remove()
remove
method is not supported by this iterator.remove
in interface java.util.Iterator<E extends MarkerContainer>
java.lang.UnsupportedOperationException
- if this method is invokedpublic java.io.File file()
FileIt
null
if the data are read from standard input or are
computed data.file
in interface FileIt<E extends MarkerContainer>
null
if the data are read from standard input or are
computed datapublic Samples samples()
SampleFileIt
samples
in interface SampleFileIt<E extends MarkerContainer>
public java.lang.String toString()
FileIt
this
. The exact
details of the representation are unspecified and subject to change.toString
in interface FileIt<E extends MarkerContainer>
toString
in class java.lang.Object
this