Package htsjdk.samtools.fastq
Class FastqReader
java.lang.Object
htsjdk.samtools.fastq.FastqReader
- All Implemented Interfaces:
Closeable,AutoCloseable,Iterable<FastqRecord>,Iterator<FastqRecord>
public class FastqReader
extends Object
implements Iterator<FastqRecord>, Iterable<FastqRecord>, Closeable
Reads a FASTQ file with four lines per record.
WARNING: Despite the fact that this class implements Iterable, calling iterator() method does not
start iteration from the beginning of the file. Developers should probably not call iterator()
directly. It is provided so that this class can be used in Java for-each loop.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static enumEnum of the types of lines we see in Fastq. -
Constructor Summary
ConstructorsConstructorDescriptionFastqReader(BufferedReader reader) FastqReader(File file) FastqReader(File file, boolean skipBlankLines) ConstructorFastqReader(File file, BufferedReader reader) FastqReader(File file, BufferedReader reader, boolean skipBlankLines) Constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckLine(String line, FastqReader.LineType kind) Checks that the line is neither null (representing EOF) or empty (blank line in file).voidclose()protected StringGenerates an error message with line number information.getFile()intbooleanhasNext()iterator()WARNING: Despite the fact that this class implements Iterable, calling iterator() method does not start iteration from the beginning of the file.next()voidremove()toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
FastqReader
-
FastqReader
Constructor- Parameters:
file- of FASTQ to read read. Will be opened with htsjdk.samtools.util.IOUtil.openFileForBufferedReadingskipBlankLines- should we skip blank lines ?
-
FastqReader
-
FastqReader
Constructor- Parameters:
file- Name of FASTQ being read, or null if not known.reader- input reader . Will be closed by the close methodskipBlankLines- should we skip blank lines ?
-
FastqReader
-
-
Method Details
-
hasNext
public boolean hasNext()- Specified by:
hasNextin interfaceIterator<FastqRecord>
-
next
- Specified by:
nextin interfaceIterator<FastqRecord>
-
remove
public void remove()- Specified by:
removein interfaceIterator<FastqRecord>
-
iterator
WARNING: Despite the fact that this class implements Iterable, calling iterator() method does not start iteration from the beginning of the file. Developers should probably not call iterator() directly. It is provided so that this class can be used in Java for-each loop.- Specified by:
iteratorin interfaceIterable<FastqRecord>
-
getLineNumber
public int getLineNumber() -
getFile
- Returns:
- Name of FASTQ being read, or null if not known.
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
checkLine
Checks that the line is neither null (representing EOF) or empty (blank line in file). -
error
Generates an error message with line number information. -
toString
-