- java.lang.Object
-
- vcf.VcfIt<E>
-
- Type Parameters:
E- the type parameter
- All Implemented Interfaces:
FileIt<E>,SampleFileIt<E>,java.io.Closeable,java.lang.AutoCloseable,java.util.Iterator<E>
public class VcfIt<E extends GTRec> extends java.lang.Object implements SampleFileIt<E>
Class
VcfItrepresents an iterator whosenext()method returns an object storing data from a VCF record.Instances of class
VcfItare 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.
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_BUFFER_SIZEThe default number of VCF records stored in a buffer.static java.util.function.BiFunction<VcfHeader,java.lang.String,GTRec>toBitSetGTA function mapping a string VCF record with GT format fields to aGTRecobject.static java.util.function.BiFunction<VcfHeader,java.lang.String,GTRec>toGLRecA function mapping a string VCF record with GL format fields to aVcfRecordobject.static java.util.function.BiFunction<VcfHeader,java.lang.String,GTRec>toGTGLRecA function mapping a string VCF record with GT or GL format fields to aVcfRecordobject.static java.util.function.BiFunction<VcfHeader,java.lang.String,VcfRec>toVcfRecordA function mapping a string VCF record with GT or GL format fields to aVcfRecordobject.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Terminates the iteration and releases any system resources that are held by this object.static <R extends GTRec>
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)Create and returns a newVcfItinstance from the specified objects.static <R extends GTRec>
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)Create and returns a newVcfItinstance from the specified objects.static <R extends GTRec>
VcfIt<R>create(FileIt<java.lang.String> strIt, java.util.function.BiFunction<VcfHeader,java.lang.String,R> recMapper)Create and returns a newVcfItinstance from the specified objects.java.io.Filefile()Returns the file from which the data are read, ornullif the data are read from standard input or are computed data.booleanhasNext()Returnstrueif the iteration has more elements, and returnsfalseotherwise.Enext()Returns the next element in the iteration.voidremove()Theremovemethod is not supported by this iterator.Samplessamples()Returns the list of samples.java.lang.StringtoString()Returns a string representation ofthis.
-
-
-
Field Detail
-
DEFAULT_BUFFER_SIZE
public static final int DEFAULT_BUFFER_SIZE
The default number of VCF records stored in a buffer.- See Also:
- Constant Field Values
-
toBitSetGT
public static final java.util.function.BiFunction<VcfHeader,java.lang.String,GTRec> toBitSetGT
A function mapping a string VCF record with GT format fields to aGTRecobject.
-
toGLRec
public static final java.util.function.BiFunction<VcfHeader,java.lang.String,GTRec> toGLRec
A function mapping a string VCF record with GL format fields to aVcfRecordobject.
-
toGTGLRec
public static final java.util.function.BiFunction<VcfHeader,java.lang.String,GTRec> toGTGLRec
A function mapping a string VCF record with GT or GL format fields to aVcfRecordobject.
-
-
Method Detail
-
create
public static <R extends GTRec> VcfIt<R> create(FileIt<java.lang.String> strIt, java.util.function.BiFunction<VcfHeader,java.lang.String,R> recMapper)
Create and returns a newVcfItinstance from the specified objects.- Type Parameters:
R- the type returned by the returnedVcfIt- Parameters:
strIt- an iterator that returns lines of a VCF filerecMapper- a function mapping string VCF records toGTRecobjects- Returns:
- a new
VcfItinstance - Throws:
java.lang.IllegalArgumentException- if a format error is detected in a line of a VCF file returned bystrItjava.lang.NullPointerException- ifstrIt == null || mapFactory == null
-
create
public static <R extends GTRec> 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)
Create and returns a newVcfItinstance from the specified objects.- Type Parameters:
R- the type returned by the returnedVcfIt- Parameters:
strIt- an iterator that returns lines of a VCF filesampleFilter- a sample filter ornullmarkerFilter- a marker filter ornullrecMapper- a function mapping string VCF records toGTRecobjects- Returns:
- a new
VcfItinstance - Throws:
java.lang.IllegalArgumentException- if a format error is detected in a line of a VCF file returned bystrItjava.lang.NullPointerException- ifstrIt == null || mapFactory == null
-
create
public static <R extends GTRec> 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)
Create and returns a newVcfItinstance from the specified objects.- Type Parameters:
R- the type returned by the returnedVcfIt- Parameters:
strIt- an iterator that returns lines of a VCF filesampleFilter- a sample filter ornullmarkerFilter- a marker filter ornullrecMapper- a function mapping string VCF records toGTRecobjectsbufferSize- the requested buffer size- Returns:
- a new
VcfItinstance - Throws:
java.lang.IllegalArgumentException- if a format error is detected in a line of a VCF file returned bystrItjava.lang.IllegalArgumentException- ifbufferSize < 1java.lang.NullPointerException- ifstrIt == null || mapFactory == null
-
close
public void close()
Description copied from interface:FileItTerminates the iteration and releases any system resources that are held by this object. After invokingclose(), further invocations ofclose()have no effect.
-
hasNext
public boolean hasNext()
Returnstrueif the iteration has more elements, and returnsfalseotherwise.
-
next
public E next()
Returns the next element in the iteration.
-
remove
public void remove()
Theremovemethod is not supported by this iterator.
-
file
public java.io.File file()
Description copied from interface:FileItReturns the file from which the data are read, ornullif the data are read from standard input or are computed data.
-
samples
public Samples samples()
Description copied from interface:SampleFileItReturns the list of samples.- Specified by:
samplesin interfaceSampleFileIt<E extends GTRec>- Returns:
- the list of samples
-
toString
public java.lang.String toString()
Description copied from interface:FileItReturns a string representation ofthis. The exact details of the representation are unspecified and subject to change.
-
-