oxbow.core.PyFastqScanner#
- class oxbow.core.PyFastqScanner(src, compressed=False)#
A FASTQ file scanner.
- Parameters:
src (str or file-like) – The path to the FASTQ file or a file-like object.
compressed (bool, optional [default: False]) – Whether the source is GZIP-compressed.
- __init__()#
Methods
__init__()Return the names of the fixed fields.
scan([fields, batch_size, limit])Scan the source as record batches.
scan_byte_ranges(byte_ranges[, fields, ...])Scan batches of records from specified byte ranges in the file.
scan_virtual_ranges(vpos_ranges[, fields, ...])Scan batches of records from virtual position ranges in a BGZF file.
schema([fields])Return the Arrow schema.
- field_names()#
Return the names of the fixed fields.
- scan(fields=None, batch_size=1024, limit=None)#
Scan the source as record batches.
- Parameters:
fields (list[str], optional) – Names of the fixed fields to project.
batch_size (int, optional [default: 1024]) – The number of records to include in each batch.
limit (int, optional) – The maximum number of records to scan. If None, records are scanned until EOF.
- Returns:
An iterator yielding Arrow record batches.
- Return type:
arro3 RecordBatchReader (pycapsule)
- scan_byte_ranges(byte_ranges, fields=None, batch_size=1024, limit=None)#
Scan batches of records from specified byte ranges in the file.
The byte positions must align with record boundaries.
- Parameters:
byte_ranges (list[tuple[int, int]]) – List of (start, end) byte position tuples to read from.
fields (list[str], optional) – Names of the fixed fields to project.
batch_size (int, optional [default: 1024]) – The number of records to include in each batch.
limit (int, optional) – The maximum number of records to scan. If None, all records in the specified ranges are scanned.
- Returns:
An iterator yielding Arrow record batches.
- Return type:
arro3 RecordBatchReader (pycapsule)
- scan_virtual_ranges(vpos_ranges, fields=None, batch_size=1024, limit=None)#
Scan batches of records from virtual position ranges in a BGZF file.
The virtual positions must align with record boundaries. That means that the compressed offset must point to the beginning of a BGZF block and the uncompressed offset must point to the beginning or end of a record decoded within the block.
- Parameters:
vpos_ranges (list[tuple[vpos, vpos]]) – List of virtual position ranges as pairs. Each virtual position can be given as either a packed virtual position (int), or an unpacked tuple of ints
(c, u)specifying the compressed and uncompressed offsets, respectively.fields (list[str], optional) – Names of the fixed fields to project.
batch_size (int, optional [default: 1024]) – The number of records to include in each batch.
limit (int, optional) – The maximum number of records to scan. If None, all records in the specified ranges are scanned.
- Returns:
An iterator yielding Arrow record batches.
- Return type:
arro3 RecordBatchReader (pycapsule)
- schema(fields=None)#
Return the Arrow schema.
- Parameters:
fields (list[str], optional) – Names of the fixed fields to project.
- Return type:
arro3 Schema (pycapsule)