cuSBF
Loading...
Searching...
No Matches
fastx_dense_batch.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <type_traits>
4
6#include <cusbf/error.hpp>
7#include <cusbf/Fastx.hpp>
8
9namespace cusbf::detail {
10
12template <typename FastxReaderType>
17) {
18 if constexpr (std::is_same_v<std::decay_t<FastxReaderType>, FastxBufferReader>) {
19 const auto range = CUSBF_TRY(
20 reader.appendNextRecord(record, chunk.sequence_buffer(), chunk.external_sequence_slot())
21 );
22 if (!range) {
23 return false;
24 }
25 chunk.push_range(*range);
26 return true;
27 }
28
29 const bool has_record = CUSBF_TRY(reader.nextRecord(record));
30 if (!has_record) {
31 return false;
32 }
33 chunk.appendRecord(record.sequence);
34 return true;
35}
36
37} // namespace cusbf::detail
Accumulates parsed FASTX records into a dense RecordBatchView.
Definition Fastx.hpp:46
FASTA/FASTQ parser over a contiguous in-memory buffer.
#define CUSBF_TRY(expr)
Propagates a cusbf::Result failure from the enclosing function (GNU statement expression).
Definition error.hpp:246
consteval bool separatorPositionAlwaysEncodesInvalid(char *input, uint64_t separatorPosition, uint64_t index)
Recursively tests whether placing the separator byte at any position in an input of valid bytes alway...
Definition Alphabet.cuh:37
Result< bool > collect_next_fastx_record(FastxReaderType &reader, FastxRecord &record, DenseRecordBatchBuilder &chunk)
Appends the next FASTX record from reader into chunk.
Fallible API result: cuda::std::expected<T, Error> with cuSBF factories.
Definition error.hpp:152
A single sequence record extracted from a FASTA/FASTQ stream.
Definition Fastx.hpp:253