Class
FaiIndex
Data type for storing FAI indices.
FaiIndex
Include Headers
seqan/seq_io.h
Data Members
FaiIndexThe FaiIndex class only provides the default constructor.
Functions
buildCreate FaiIndex from FASTA file.
clearReset a FaiIndex object to the state after default construction.
getIdByNameReturn id (numeric index in the file) of a sequence in a FAI file.
numSeqsReturn number of sequences known to an FaiIndex.
readRead a FAI index.
readRegionLoad the infix of a sequence from a FaiIndex.
readSequenceLoad a whole sequence from an FaiIndex.
sequenceLengthReturn length of the sequence with the given id in the FaiIndex.
sequenceNameReturn the name of the sequence with the given id in the FaiIndex.
writeWrite out an FaiIndex object.
Examples
Build a FAI index from argv[1].
#include <seqan/seq_io.h>
 
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.
#include <seqan/seq_io.h>
 
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
 

Page built @2013/07/11 09:12:16