Package vcf
Class RefIt
- java.lang.Object
-
- vcf.RefIt
-
- All Implemented Interfaces:
FileIt<RefGTRec>
,SampleFileIt<RefGTRec>
,java.io.Closeable
,java.lang.AutoCloseable
,java.util.Iterator<RefGTRec>
public class RefIt extends java.lang.Object implements SampleFileIt<RefGTRec>
Class
RefIt
represents an iterator whosenext()
method returns an object storing data from a VCF record with phased, non-missing genotypes.Instances of class
RefIt
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.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Stops reading data elements and releases any system resources that are held by this object.static RefIt
create(FileIt<java.lang.String> it)
Create and returns a newRefIt
instance from the specified iterator.static RefIt
create(FileIt<java.lang.String> it, Filter<java.lang.String> sampleFilter, Filter<Marker> markerFilter)
Create and returns a newRefIt
instance from the specified objects.static RefIt
create(FileIt<java.lang.String> it, Filter<java.lang.String> sampleFilter, Filter<Marker> markerFilter, int bufferSize)
Create and returns a newRefIt
instance from the specified objects.java.io.File
file()
Returns the file from which the data are read, ornull
if the data are read from standard input or if the data source is unknown.boolean
hasNext()
Returnstrue
if the iteration has more elements, and returnsfalse
otherwise.RefGTRec
next()
Returns the next element in the iteration.void
remove()
Theremove
method is not supported by this iterator.Samples
samples()
Returns the list of samples.java.lang.String
toString()
Returns a string representation ofthis
.
-
-
-
Method Detail
-
create
public static RefIt create(FileIt<java.lang.String> it)
Create and returns a newRefIt
instance from the specified iterator.- Parameters:
it
- an iterator that returns lines of a VCF file- Returns:
- a new
RefIt
instance - Throws:
java.lang.IllegalArgumentException
- if a format error is detected in a line of a VCF file returned byit
java.lang.NullPointerException
- ifit == null
-
create
public static RefIt create(FileIt<java.lang.String> it, Filter<java.lang.String> sampleFilter, Filter<Marker> markerFilter)
Create and returns a newRefIt
instance from the specified objects.- Parameters:
it
- an iterator that returns lines of a VCF filesampleFilter
- a sample filter ornull
markerFilter
- a marker filter ornull
- Returns:
- a new
RefIt
instance - Throws:
java.lang.IllegalArgumentException
- if a format error is detected in a line of a VCF file returned byit
java.lang.IllegalArgumentException
- ifbufferSize < 1
java.lang.NullPointerException
- ifit == null
-
create
public static RefIt create(FileIt<java.lang.String> it, Filter<java.lang.String> sampleFilter, Filter<Marker> markerFilter, int bufferSize)
Create and returns a newRefIt
instance from the specified objects.- Parameters:
it
- an iterator that returns lines of a VCF filesampleFilter
- a sample filter ornull
markerFilter
- a marker filter ornull
bufferSize
- the number of VCF records stored in a buffer- Returns:
- a new
RefIt
instance - Throws:
java.lang.IllegalArgumentException
- if a format error is detected in a line of a VCF file returned byit
java.lang.IllegalArgumentException
- ifbufferSize < 1
java.lang.NullPointerException
- ifit == null
-
close
public void close()
Description copied from interface:FileIt
Stops reading data elements and releases any system resources that are held by this object. Buffered data elements may remain accessible via thehasNext()
andnext()
methods after invokingclose()
. After invokingclose()
, further invocations ofclose()
have no effect.
-
hasNext
public boolean hasNext()
Returnstrue
if the iteration has more elements, and returnsfalse
otherwise.- Specified by:
hasNext
in interfacejava.util.Iterator<RefGTRec>
- Returns:
true
if the iteration has more elements
-
next
public RefGTRec next()
Returns the next element in the iteration.- Specified by:
next
in interfacejava.util.Iterator<RefGTRec>
- Returns:
- the next element in the iteration
- Throws:
java.util.NoSuchElementException
- if the iteration has no more elements
-
remove
public void remove()
Theremove
method is not supported by this iterator.- Specified by:
remove
in interfacejava.util.Iterator<RefGTRec>
- Throws:
java.lang.UnsupportedOperationException
- if this method is invoked
-
file
public java.io.File file()
Description copied from interface:FileIt
Returns the file from which the data are read, ornull
if the data are read from standard input or if the data source is unknown.
-
samples
public Samples samples()
Description copied from interface:SampleFileIt
Returns the list of samples.- Specified by:
samples
in interfaceSampleFileIt<RefGTRec>
- Returns:
- the list of samples
-
toString
public java.lang.String toString()
Description copied from interface:FileIt
Returns a string representation ofthis
. The exact details of the representation are unspecified and subject to change.
-
-