Class
FaiIndex
Data type for storing FAI indices.
Include Headers
seqan/seq_io.h
Functions
Create FaiIndex from FASTA file. | |
Reset a FaiIndex object to the state after default construction. | |
Return id (numeric index in the file) of a sequence in a FAI file. | |
Return number of sequences known to an FaiIndex. | |
Read a FAI index. | |
Load the infix of a sequence from a FaiIndex. | |
Load a whole sequence from an FaiIndex. | |
Return length of the sequence with the given id in the FaiIndex. | |
Return the name of the sequence with the given id in the FaiIndex. | |
Write out an FaiIndex object. |
Examples
Build a FAI index from argv[1] .
seqan::FaiIndex faiIndex;
int res = build(faiIndex, "path/to/file.fasta");
if (res != 0)
std::cerr << "ERROR: Could not build the index!\n";
Load index, get sequence infix and a whole sequence for the sequence chr1 from FASTA file.
sean::FaiIndex faiIndex;
int res = read(faiIndex, "path/to/file.fasta");
if (res != 0)
std::cerr << "ERROR: Could not load FAI index path/to/file.fasta.fai\n";
unsigned idx = 0;
if (!getIdByName(faiIndex, "chr1", idx))
std::cerr << "ERROR: FAI index does not know about chr1.\n";
// Load first 1000 characters of chr1.
seqan::CharString seqChr1Prefix;
if (readRegion(seqChr1Prefix, faiIdx, idx, 0, 1000) != 0)
std::cerr << "ERROR: Could not load chr1.\n";
// Load all of chr1.
seqan::CharString seqChr1;
if (readSequence(seqChr1, faiIdx, idx) != 0)
std::cerr << "ERROR: Could not load chr1.\n";
SeqAn - Sequence Analysis Library - www.seqan.de