FastqReader
in package
implements
FastqReaderInterface
A standalone, persistence-independent text reader, in the same spirit as Domain\Cloning's GffFeatureReader : FASTQ has no entry delimiters DatabaseParserFactory could recognize, and no Doctrine entity to persist into. A record is an identifier line ("@..."), its sequence, a separator line ("+...") and its quality string. Most files write the sequence and the quality on one line each, but the original Sanger format let both wrap over several lines, and readers are expected to accept it (Cock et al., Nucleic Acids Res. 2010, 38:1767) : the sequence runs until the "+" line, the quality until it is as long as the sequence. A quality line may itself start with "@" or "+", so a quality line is only taken while it keeps the quality no longer than the sequence ; a quality left short is reported, and the next line read as the next record. A record that does not fit this shape, or whose sequence/quality content is rejected by FastqRecord's own validation, is skipped and reported in FastqImportResult::getWarnings() rather than thrown, exactly like GffFeatureReader treats a malformed GFF3 line. Blank lines between records are ignored.
Qualities are read as Phred+33 (see FastqRecord). A file whose every quality symbol is "@" (ASCII 64) or above, some of them past "J" (Phred 41, the top of Illumina 1.8+), looks like the older Phred+64 encoding (Illumina 1.3 to 1.7) : its records are still read, but a warning says their scores would be 31 too high. Class FastqReader
Tags
Table of Contents
Interfaces
- FastqReaderInterface
- Interface FastqReaderInterface - reads a FASTQ file into FastqRecord instances.
Methods
- read() : FastqImportResult
- nextHeader() : int
- After a malformed record, the index of the next line that may open a record.
- opensARecord() : bool
- Tells whether a line opening on "@" is the header of the next record rather than a quality line that happens to start with "@" : a header is followed by sequence lines, then by the "+" line. A quality too short for its sequence would otherwise swallow that header.
Methods
read()
public
read(array<string|int, string> $aLines) : FastqImportResult
Parameters
- $aLines : array<string|int, string>
Return values
FastqImportResultnextHeader()
After a malformed record, the index of the next line that may open a record.
private
nextHeader(array<string|int, string> $aLines, int $i) : int
Parameters
- $aLines : array<string|int, string>
- $i : int
Return values
intopensARecord()
Tells whether a line opening on "@" is the header of the next record rather than a quality line that happens to start with "@" : a header is followed by sequence lines, then by the "+" line. A quality too short for its sequence would otherwise swallow that header.
private
opensARecord(array<string|int, mixed> $aLines, int $i) : bool
Parameters
- $aLines : array<string|int, mixed>
- $i : int
-
The index of the line to examine