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.
-
-
Field Summary
Fields Modifier and Type Field Description static int
MAX_EM_BUFFER_SIZE
The default number ofGTRec
objects that are stored in a buffer.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Terminates the iteration and releases any system resources that are held by this object.static RefIt
create(FileIt<java.lang.String> strIt)
Create and returns a newRefIt
instance from the specified iterator.static RefIt
create(FileIt<java.lang.String> strIt, 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 are computed data.boolean
hasNext()
Returnstrue
if the iteration has more elements, and returnsfalse
otherwise.RefGTRec
next()
Returns the next element in the iteration.static RefGTRec
recodeIfLowFreq(RefGTRec rec)
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
.
-
-
-
Field Detail
-
MAX_EM_BUFFER_SIZE
public static final int MAX_EM_BUFFER_SIZE
The default number ofGTRec
objects that are stored in a buffer.- See Also:
- Constant Field Values
-
-
Method Detail
-
create
public static RefIt create(FileIt<java.lang.String> strIt)
Create and returns a newRefIt
instance from the specified iterator.- Parameters:
strIt
- 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 bystrIt
java.lang.NullPointerException
- ifstrIt == null
-
create
public static RefIt create(FileIt<java.lang.String> strIt, Filter<java.lang.String> sampleFilter, Filter<Marker> markerFilter, int bufferSize)
Create and returns a newRefIt
instance from the specified objects.- Parameters:
strIt
- an iterator that returns lines of a VCF filesampleFilter
- a sample filter ornull
markerFilter
- a marker filter ornull
bufferSize
- the buffer size- Returns:
- a new
RefIt
instance - Throws:
java.lang.IllegalArgumentException
- if a format error is detected in a line of a VCF file returned bystrItt
java.lang.IllegalArgumentException
- ifbufferSize < 1
java.lang.NullPointerException
- ifstrIt == null
-
close
public void close()
Description copied from interface:FileIt
Terminates 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()
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 are computed data.
-
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.
-
-