SHORE API
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
shore::twodex Class Reference

Range index class. More...

Classes

struct  build_spec
 Parameters for index creation. More...
 
struct  bytecount
 Helper for keeping track of the number of bytes read. More...
 
struct  header
 Index header record. More...
 

Public Types

enum  D2Type {
  D2_SIZE, D2_INCLUSIVE, D2_EXCLUSIVE, D2_MAPLIST,
  D2_CIGAR
}
 
enum  QueryMode { QRY_OVERLAPPING, QRY_INCLUDING, QRY_INCLUDED }
 Mode of the query. More...
 

Public Member Functions

 twodex (const std::string &indexfile, const QueryMode qm=QRY_OVERLAPPING)
 Constructor, load an index file.
 
void set_querymode (const QueryMode qm)
 
const headerget_header () const
 
void query (std::set< size_t > &res, const std::pair< long, long > &r) const
 
void query (std::set< size_t > &res, const shore::genomic_range &r) const
 
std::pair< long, long > range_enc (const shore::genomic_range &r) const
 
int test (const shore::genomic_range &r1, const shore::genomic_range &r2) const
 
int test (const shore::genomic_range &r1, const std::pair< long, long > &r2) const
 

Static Public Member Functions

static void build (const std::string &fn, const std::string &colspec, const size_t blocksize, const size_t maxgap, const D2Type d2type, const char commentchar, std::ostream *const log=0)
 Create an index for a file. More...
 
static void build (const std::string &fn, const build_spec &bs, std::ostream *const log=0)
 
static void parse_xend (long *const xend, const long pos, const D2Type d2type, const std::string &d2, shore::alignment_helper &ah)
 Helper for getting the exclusive end position.
 
static int test (const std::pair< long, long > &r1, const std::pair< long, long > &r2, const QueryMode querymode)
 test r1 vs r2 More...
 

Detailed Description

Range index class.

Member Enumeration Documentation

Mode of the query.

Enumerator
QRY_OVERLAPPING 

Query for overlapping ranges.

QRY_INCLUDING 

Query for ranges that include the query.

QRY_INCLUDED 

Query for ranges that are included by the query.

Member Function Documentation

static void shore::twodex::build ( const std::string &  fn,
const std::string &  colspec,
const size_t  blocksize,
const size_t  maxgap,
const D2Type  d2type,
const char  commentchar,
std::ostream *const  log = 0 
)
static

Create an index for a file.

Parameters
fnInput file; the output file will be named <fn_without_compression_suffix>.2dex
colspecInput file column specification: <seqname><position><end|size|...>
blocksizeBlock size determining the index resolution in bytes.
maxgapMaximum sequence gap allowed in a block.
d2typeType of the second dimension of the range: end|size|...
commentcharCharacter that indicates a comment line.
logLog output stream pointer, may be nullptr.
static int shore::twodex::test ( const std::pair< long, long > &  r1,
const std::pair< long, long > &  r2,
const QueryMode  querymode 
)
static

test r1 vs r2

Returns
0 match according to querymode
1 no match, but matches to r2 may occur later in a sorted file
-1 no match, and no further matches to r2 if the file is sorted

The documentation for this class was generated from the following file: