00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
#ifndef __Index_AMOS_HH
00011 #define __Index_AMOS_HH 1
00012
00013
#include "universals_AMOS.hh"
00014
#include <utility>
00015
00016
00017
00018
00019
namespace AMOS {
00020
00021
00032
00033 class Index_t :
public Universal_t
00034 {
00035
00036
private:
00037
00038 std::pair<NCode_t, NCode_t> type_m;
00039 HASHMAP::hash_multimap<ID_t, ID_t> index_m;
00040
00041
00042
protected:
00043
00044
00045
virtual void readRecord (std::istream & fix, std::istream & var);
00046
00047
00048
00049
virtual void writeRecord (std::ostream & fix, std::ostream & var)
const;
00050
00051
00052
public:
00053
00054
static const NCode_t NCODE;
00056
00057
00058
typedef HASHMAP::hash_multimap<ID_t, ID_t>
::iterator iterator;
00060
00061
typedef HASHMAP::hash_multimap<ID_t, ID_t>
::const_iterator const_iterator;
00063
00064
00065
00070 Index_t ( )
00071 {
00072 type_m . first = type_m . second =
NULL_NCODE;
00073 }
00074
00075
00076
00079 Index_t (
NCode_t a,
NCode_t b)
00080 {
00081 type_m . first = a;
00082 type_m . second = b;
00083 }
00084
00085
00086
00089 Index_t (
const Index_t & source)
00090 {
00091 *
this = source;
00092 }
00093
00094
00095
00098 ~Index_t ( )
00099 {
00100
00101 }
00102
00103
00104
00112 iterator begin ( )
00113 {
00114
return index_m .
begin( );
00115 }
00116
00117
00118
00119 const_iterator begin ( )
const
00120
{
00121
return index_m .
begin( );
00122 }
00123
00124
00125
00137
void buildContigFeature (
const std::string bankname);
00138
00139
00140
00152
void buildContigScaffold (
const std::string bankname);
00153
00154
00155
00167
void buildReadContig (
const std::string bankname);
00168
00169
00170
00182
void buildReadLibrary (
const std::string bankname);
00183
00184
00185
00195
void buildReadMate (
const std::string bankname);
00196
00197
00198
00210
void buildScaffoldFeature (
const std::string bankname);
00211
00212
00213
00221 iterator end ( )
00222 {
00223
return index_m .
end( );
00224 }
00225
00226
00227
00228 const_iterator end ( )
const
00229
{
00230
return index_m .
end( );
00231 }
00232
00233
00234
00239 bool empty ( )
const
00240
{
00241
return index_m .
empty( );
00242 }
00243
00244
00245
00246 virtual void clear ( )
00247 {
00248
Universal_t::clear( );
00249
00250 type_m . first = type_m . second =
NULL_NCODE;
00251 index_m .
clear( );
00252 }
00253
00254
00255
00260 Size_t count (
ID_t key)
const
00261
{
00262
return index_m .
count (key);
00263 }
00264
00265
00266
00267 virtual NCode_t getNCode ( )
const
00268
{
00269
return Index_t::NCODE;
00270 }
00271
00272
00273
00278 Size_t getSize ( )
const
00279
{
00280
return index_m . size( );
00281 }
00282
00283
00284
00292 std::pair<NCode_t, NCode_t>
getType( )
const
00293
{
00294
return type_m;
00295 }
00296
00297
00298
00308 void insert (
ID_t key,
ID_t value)
00309 {
00310
insert (std::make_pair(key, value));
00311 }
00312
00313
00314
00315 void insert (std::pair<ID_t, ID_t> iids)
00316 {
00317 index_m .
insert (iids);
00318 }
00319
00320
00321
00326 bool isMulti (
ID_t key)
const
00327
{
00328
return (
count (key) > 1);
00329 }
00330
00331
00332
00342 ID_t lookup (
ID_t key)
const
00343
{
00344
return (index_m . find (key)) -> second;
00345 }
00346
00347
00348
00359 std::pair<iterator, iterator>
lookupAll (
ID_t key)
00360 {
00361
return index_m . equal_range (key);
00362 }
00363
00364
00365
00366 std::pair<const_iterator, const_iterator>
lookupAll (
ID_t key)
const
00367
{
00368
return index_m . equal_range (key);
00369 }
00370
00371
00372
00373
virtual void readMessage (
const Message_t & msg);
00374
00375
00376
00385 Size_t remove (
ID_t key)
00386 {
00387
return index_m . erase (key);
00388 }
00389
00390
00391
00397 void remove (
iterator itr)
00398 {
00399 index_m . erase (itr);
00400 }
00401
00402
00403
00412 void setType (std::pair<NCode_t, NCode_t> type)
00413 {
00414 type_m = type;
00415 }
00416
00417
00418
00419 void setType (
NCode_t a,
NCode_t b)
00420 {
00421
setType (std::make_pair (a, b));
00422 }
00423
00424
00425
00426
virtual void writeMessage (
Message_t & msg)
const;
00427
00428 };
00429
00430 }
00431
00432
#endif // #ifndef __Index_AMOS_HH