Package vcf
Class RefIt
java.lang.Object
vcf.RefIt
- All Implemented Interfaces:
FileIt<RefGTRec>
,SampleFileIt<RefGTRec>
,Closeable
,AutoCloseable
,Iterator<RefGTRec>
Class RefIt
represents an iterator whose next()
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
Modifier and TypeMethodDescriptionvoid
close()
Stops reading data elements and releases any system resources that are held by this object.static RefIt
Create and returns a newRefIt
instance from the specified iterator.static RefIt
Create and returns a newRefIt
instance from the specified objects.static RefIt
Create and returns a newRefIt
instance from the specified objects.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.next()
Returns the next element in the iteration.void
remove()
Theremove
method is not supported by this iterator.samples()
Returns the list of samples.toString()
Returns a string representation ofthis
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Method Details
-
create
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:
IllegalArgumentException
- if a format error is detected in a line of a VCF file returned byit
NullPointerException
- ifit == null
-
create
public static RefIt create(FileIt<String> it, Filter<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:
IllegalArgumentException
- if a format error is detected in a line of a VCF file returned byit
IllegalArgumentException
- ifbufferSize < 1
NullPointerException
- ifit == null
-
create
public static RefIt create(FileIt<String> it, Filter<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:
IllegalArgumentException
- if a format error is detected in a line of a VCF file returned byit
IllegalArgumentException
- ifbufferSize < 1
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. -
next
Returns the next element in the iteration.- Specified by:
next
in interfaceIterator<RefGTRec>
- Returns:
- the next element in the iteration
- Throws:
NoSuchElementException
- if the iteration has no more elements
-
remove
public void remove()Theremove
method is not supported by this iterator.- Specified by:
remove
in interfaceIterator<RefGTRec>
- Throws:
UnsupportedOperationException
- if this method is invoked
-
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
Description copied from interface:SampleFileIt
Returns the list of samples.- Specified by:
samples
in interfaceSampleFileIt<RefGTRec>
- Returns:
- the list of samples
-
toString
Description copied from interface:FileIt
Returns a string representation ofthis
. The exact details of the representation are unspecified and subject to change.
-