15 #include "stream_tools.h"
30 std::vector <std::string>
id0_;
50 static Data * create(
const std::vector <std::string> & Columns){
57 bool bianary(
void)
const {
return false;};
60 id1_off_t
get_offset (
const std::string &,
const id1_t &)
const;
63 id1_t
get_abs_pos (
const std::string &,
const id1_t &)
const;
66 id1_t
get_abs_pos (
const id0_t &,
const id1_t &)
const;
69 id0_t
get_id0 (
const std::string &)
const;
72 id0_t
get_id0 (
const id1_t &)
const;
75 id1_t
get_id1 (
const id1_t &)
const;
81 void set_string (
const id0_t &,
const std::string &);
84 void set_size (
const std::string &,
const id1_t &);
87 void set_size (
const id0_t &,
const id1_t &);
96 const std::vector <std::string>
get_names (
void)
const;
102 const std::vector <id1_t>
get_sizes (
void)
const;
105 id1_t
get_size (
const id0_t &)
const;
108 id1_t
get_size (
const std::string &)
const;
132 int add_id (
const std::string &,
const id1_t &);
140 bool is_open(
void)
const;
142 std::string header(
void)
const;
143 static const std::string file_name;
144 static const std::string table_name;
146 size_t size(
void)
const;
149 void write (std::ostream&)
const;
151 void read (std::istream&);
153 const std::string get_file_name()
const {
return File_index::file_name;};
154 const std::string get_table_name()
const {
return File_index::table_name;};
155 const bool get_binary()
const;
163 void sql_read(std::istream &)
override;
std::istream & from_sam_header(std::istream &)
read in a file index from a sam header.
Definition: file_index.cc:128
id1_t get_reference_size(void) const
get the sum of all size.
Definition: file_index.cc:121
const std::string sql_values(void) const
returns the column values (SQL).
Definition: file_index.cc:264
void set_last_size(const id1_t &)
set the number of rows in the most recently read scaffold.
const std::vector< id1_t > get_sizes(void) const
get a vector containing the sizes of each scaffold.
Definition: file_index.cc:193
std::string last_id0_str_
the last string id returned by an decodeid0 quarry. Initialized to "".
Definition: file_index.h:42
id1_t get_last_size(void)
get the size of the last scaffold which has been read from. returns map_file::noid on error...
void set_size(const std::string &, const id1_t &)
set the number of rows (bp) in the scaffold with string id id0.
size_t size(void) const
The size of the class in bytes.
Definition: file_index.cc:248
std::map< std::string, id0_t > id0_str_
a hash table to store pairs of strings and the id representing them.
Definition: file_index.h:27
An interface that transforms pairs of name and position keys into record numbers. ...
Definition: file_index.h:23
void write(std::ostream &) const
use the << operator to write File_index.
Definition: file_index.cc:211
void set_next_size(const id1_t &)
set the number of rows in the next scaffold to be read.
id1_off_t get_offset(const std::string &, const id1_t &) const
returns the number of rows until a row with id0, id1.
int write_index(std::ostream &)
write out a File_index
Definition: file_index.cc:176
void read(std::istream &)
use the >> operator to read File_index.
Definition: file_index.cc:222
std::vector< id1_t > cumulative_size_
the cumulative number of bp per scaffold.
Definition: file_index.h:36
size_t get_names_size(void) const
get the length of the vector containing the name of each scaffold.
Definition: file_index.cc:205
id1_t get_cumulative_size(const id0_t &) const
get the sum of all size less than or equal to id0.
Definition: file_index.cc:104
id1_t get_abs_pos(const std::string &, const id1_t &) const
returns the record number corresponding to id0, id1.
Definition: file_index.cc:50
const std::string sql_column_names(void) const
returns the column names (SQL).
Definition: file_index.cc:259
id0_t last_id0_
the last numerical id returned by an decodeid0 quarry. Initialized to 0-1.
Definition: file_index.h:39
int read_index(std::istream &)
read in a File_index (strictly text mode).
id1_t get_id1(const id1_t &) const
returns the id1 corresponding rowid.
Definition: file_index.cc:73
id1_t get_next_size(void)
get the size of the next scaffold to be read. returns map_file::noid on error.
const std::string sql_header(void) const
returns the string needed to create an SQL table.
Definition: file_index.cc:254
id1_t get_size(const id0_t &) const
get the size of scaffold blarg.
Definition: file_index.cc:95
bool open_
TODO: Is this ever used?
Definition: file_index.h:45
A class which registers a child of Data in Data::new_data_.
Definition: data.h:222
A class which can be written as flat text file or into an SQL database.
Definition: data.h:34
const std::vector< std::string > get_names(void) const
get a vector containing the name of each scaffold.
Definition: file_index.cc:199
void sql_read(std::istream &) override
binds data to sqlite3_stmt.
Definition: file_index.cc:284
File_index & operator=(const File_index &)
not implemented. Do not use.
Definition: file_index.cc:28
std::vector< id1_t > size_
the number of bp per scaffold.
Definition: file_index.h:33
void set_string(const id0_t &, const std::string &)
sets the string corresponding to id0.
std::string get_string(const id0_t &) const
returns the string corresponding to id0.
Definition: file_index.cc:56
std::vector< std::string > id0_
the keys to the hash table id0_str_.
Definition: file_index.h:30
static const bool binary
Returns the destination table name.
Definition: file_index.h:145
int add_id(const std::string &, const id1_t &)
add an new id at the end of the index.
Definition: file_index.cc:164
id0_t get_id0(const std::string &) const
returns the id0 corresponding to string.
Definition: file_index.cc:62