IndexedFastaReader

#include <pbbam/IndexedFastaReader.h>
class PacBio::BAM::IndexedFastaReader

The IndexedFastaReader class provides random-access to FASTA file data.

Constructors & Related Methods

IndexedFastaReader()
IndexedFastaReader(const std::string &filename)
IndexedFastaReader(const IndexedFastaReader &src)
IndexedFastaReader &operator=(const IndexedFastaReader &rhs)
~IndexedFastaReader()

Unnamed Group

std::string Subsequence(const std::string &id, Position begin, Position end) const

Fetches FASTA sequence for desired interval.

name Sequence Access

Return
sequence string at desired interval
Parameters
  • id: reference sequence name
  • begin: start position
  • end: end position
Exceptions
  • std::runtime_error: on failure to fetch sequence

std::string Subsequence(const GenomicInterval &interval) const

Fetches FASTA sequence for desired interval.

Return
sequence string at desired interval
Parameters
  • interval: desired interval
Exceptions
  • std::runtime_error: on failure to fetch sequence

std::string Subsequence(const char *htslibRegion) const

Fetches FASTA sequence for desired interval.

Return
sequence string at desired interval
Parameters
  • htslibRegion: htslib/samtools-formatted REGION string representing the desired interval
Exceptions
  • std::runtime_error: on failure to fetch sequence

std::string ReferenceSubsequence(const BamRecord &bamRecord, const Orientation orientation = Orientation::GENOMIC, const bool gapped = false, const bool exciseSoftClips = false) const

Fetches FASTA sequence corresponding to a BamRecord, oriented and gapped as requested.

For example, “native” orientation and “gapped” will return the reference sequence with gaps inserted, as would align against the read in “native” orientation.

Return
sequence string over the record’s interval
Parameters
  • bamRecord: input BamRecord to derive interval/CIGAR data
  • orientation: orientation of output
  • gapped: if true, gaps/padding will be inserted, per record’s CIGAR info.
  • exciseSoftClips: if true, any soft-clipped positions will be removed from query ends
Exceptions
  • std::runtime_error: on failure to fetch sequence

File Attributes

bool HasSequence(const std::string &name) const

Return
true if FASTA file contains a sequence matching name

std::string Name(const size_t idx) const

Return
the names of the sequence at a specific index in the FASTA file

std::vector<std::string> Names() const

Return
the names of all sequences stored in the FASTA file

int NumSequences() const

Return
number of sequences stored in FASTA file

int SequenceLength(const std::string &name) const

Return
length of FASTA sequence
Exceptions
  • std::runtime_error: if length could not be determined