mapgd  0.4
A program for the Maximum-likelihood analysis of population genomic data.
 All Data Structures Functions Variables Friends Groups Pages
Public Member Functions | Static Public Attributes | Static Private Member Functions | Private Attributes | Static Private Attributes
File_index Class Reference

An interface that transforms pairs of name and position keys into record numbers. More...

#include <file_index.h>

Inheritance diagram for File_index:
Inheritance graph
[legend]
Collaboration diagram for File_index:
Collaboration graph
[legend]

Public Member Functions

 File_index (std::vector< std::string >)
 
bool bianary (void) const
 
id1_off_t get_offset (const std::string &, const id1_t &) const
 returns the number of rows until a row with id0, id1.
 
id1_t get_abs_pos (const std::string &, const id1_t &) const
 returns the record number corresponding to id0, id1.
 
id1_t get_abs_pos (const id0_t &, const id1_t &) const
 returns the record number corresponding to id0, id1.
 
id0_t get_id0 (const std::string &) const
 returns the id0 corresponding to string.
 
id0_t get_id0 (const id1_t &) const
 returns the id0 corresponding to rowid.
 
id1_t get_id1 (const id1_t &) const
 returns the id1 corresponding rowid.
 
std::string get_string (const id0_t &) const
 returns the string corresponding to id0.
 
void set_string (const id0_t &, const std::string &)
 sets the string corresponding to id0.
 
void set_size (const std::string &, const id1_t &)
 set the number of rows (bp) in the scaffold with string id id0.
 
void set_size (const id0_t &, const id1_t &)
 set the number of rows (bp) in the scaffold with numeric id id0.
 
void set_last_size (const id1_t &)
 set the number of rows in the most recently read scaffold.
 
void set_next_size (const id1_t &)
 set the number of rows in the next scaffold to be read.
 
const std::vector< std::string > get_names (void) const
 get a vector containing the name of each scaffold.
 
size_t get_names_size (void) const
 get the length of the vector containing the name of each scaffold.
 
const std::vector< id1_t > get_sizes (void) const
 get a vector containing the sizes of each scaffold.
 
id1_t get_size (const id0_t &) const
 get the size of scaffold blarg.
 
id1_t get_size (const std::string &) const
 get the size of scaffold blarg.
 
id1_t get_cumulative_size (const id0_t &) const
 get the sum of all size less than or equal to id0.
 
id1_t get_cumulative_size (const std::string &) const
 get the sum of all size less than or equal to id0.
 
id1_t get_reference_size (void) const
 get the sum of all size.
 
id1_t get_last_size (void)
 get the size of the last scaffold which has been read from. returns map_file::noid on error.
 
id1_t get_next_size (void)
 get the size of the next scaffold to be read. returns map_file::noid on error.
 
int read_index (std::istream &)
 read in a File_index (strictly text mode).
 
std::istream & from_sam_header (std::istream &)
 read in a file index from a sam header.
 
int add_id (const std::string &, const id1_t &)
 add an new id at the end of the index.
 
int write_index (std::ostream &)
 write out a File_index
 
File_indexoperator= (const File_index &)
 not implemented. Do not use.
 
bool is_open (void) const
 
std::string header (void) const
 
size_t size (void) const
 The size of the class in bytes.
 
void write (std::ostream &) const
 use the << operator to write File_index.
 
void read (std::istream &)
 use the >> operator to read File_index.
 
const std::string get_file_name () const
 
const std::string get_table_name () const
 
const bool get_binary () const
 
const std::string sql_header (void) const
 returns the string needed to create an SQL table.
 
const std::string sql_column_names (void) const
 returns the column names (SQL).
 
const std::string sql_values (void) const
 returns the column values (SQL).
 
void sql_read (std::istream &) override
 binds data to sqlite3_stmt.
 
- Public Member Functions inherited from Data
void read_binary (std::istream &str)
 
void write_binary (std::ostream &str) const
 
 Data (std::vector< std::string > &)
 
virtual const bool indexed () const
 

Static Public Attributes

static const std::string file_name =".idx"
 
static const std::string table_name ="REGIONS"
 
static const bool binary =false
 Returns the destination table name.
 
- Static Public Attributes inherited from Data
static const std::string file_name =".txt"
 The read function must be defined in the child class. More...
 
static const std::string table_name ="NONE"
 The read function must be defined in the child class. More...
 

Static Private Member Functions

static Datacreate (const std::vector< std::string > &Columns)
 

Private Attributes

std::map< std::string, id0_t > id0_str_
 a hash table to store pairs of strings and the id representing them.
 
std::vector< std::string > id0_
 the keys to the hash table id0_str_.
 
std::vector< id1_t > size_
 the number of bp per scaffold.
 
std::vector< id1_t > cumulative_size_
 the cumulative number of bp per scaffold.
 
id0_t last_id0_
 the last numerical id returned by an decodeid0 quarry. Initialized to 0-1.
 
std::string last_id0_str_
 the last string id returned by an decodeid0 quarry. Initialized to "".
 
bool open_
 TODO: Is this ever used?
 
size_t byte_size_
 

Static Private Attributes

static const Registration registered =Registration(File_index::table_name, File_index::create)
 

Additional Inherited Members

- Static Public Member Functions inherited from Data
static Datanew_from_str (const std::string &, const std::vector< std::string > &)
 Constructs an instance of the class Registered w/ string.
 

Detailed Description

An interface that transforms pairs of name and position keys into record numbers.


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