gatb.core-API-0.0.0
BankAlbum Class Reference

Genomic bank file made of a list of other bank files URI. More...

#include <BankAlbum.hpp>

Inheritance diagram for BankAlbum:
Inheritance graph

Public Member Functions

 BankAlbum (const std::string &name, bool deleteIfExists=false)
 
 BankAlbum (const std::string &name, const std::vector< IBank * > &banks)
 
 BankAlbum (const std::vector< std::string > &filenames)
 
std::string getId ()
 
IBankaddBank (const std::string &bankUri)
 
IBankaddBank (const std::string &directory, const std::string &bankName, bool output_fastq=false, bool output_gz=false)
 
void remove ()
 
- Public Member Functions inherited from BankComposite
 BankComposite ()
 
 BankComposite (const std::vector< IBank * > &banks)
 
virtual ~BankComposite ()
 
std::string getId ()
 
std::string getIdNb (int i)
 
int64_t estimateNbItemsBanki (int i)
 
void addBank (IBank *bank)
 
tools::dp::Iterator< Sequence > * iterator ()
 
int64_t getNbItems ()
 
void insert (const Sequence &item)
 
void flush ()
 
u_int64_t getSize ()
 
void estimate (u_int64_t &number, u_int64_t &totalSize, u_int64_t &maxSize)
 
size_t getCompositionNb ()
 
const std::vector< IBank * > getBanks () const
 
size_t getNbBanks () const
 
template<typename Functor >
void iterateBanks (Functor fct)
 
tools::dp::Iterator< IBank * > * iteratorBanks ()
 
void remove ()
 
- Public Member Functions inherited from AbstractBank
 AbstractBank ()
 
int64_t estimateNbItems ()
 
u_int64_t estimateSequencesSize ()
 
u_int64_t getEstimateThreshold ()
 
void setEstimateThreshold (u_int64_t nbSeq)
 
void finalize ()
 
- Public Member Functions inherited from Iterable< Sequence >
void iterate (Functor f)
 
virtual Sequence * getItems (Sequence *&buffer)
 
virtual size_t getItems (Sequence *&buffer, size_t start, size_t nb)
 
- Public Member Functions inherited from ISmartPointer
virtual ~ISmartPointer ()
 
- Public Member Functions inherited from Bag< Sequence >
virtual void insert (const Sequence &item)=0
 
virtual void insert (const std::vector< Sequence > &items, size_t length=0)
 
virtual void insert (const Sequence *items, size_t length)
 
- Public Member Functions inherited from SmartPointer
void use ()
 
void forget ()
 

Static Public Member Functions

static const char * name ()
 
- Static Public Member Functions inherited from BankComposite
static const char * name ()
 
static const size_t getMaxNbFiles ()
 

Additional Inherited Members

- Protected Member Functions inherited from SmartPointer
 SmartPointer ()
 
virtual ~SmartPointer ()
 
- Protected Attributes inherited from BankComposite
std::vector< IBank * > _banks
 

Detailed Description

Genomic bank file made of a list of other bank files URI.

This class allows to define a list of banks URI in two ways: 1) the album URI is a comma separated list of banks URI 2) the album is a text file holding a list of banks URI

Example of a BankAlbum file content:

somefile1.fasta
somefile2.fasta
somefile3.fasta

An album A is defined by N filepath Pi. An album is valid if each Pi is present in filesystem

If a filepath Pi is a simple filename (ie. not a fullpath), the basedir of the album URI is prefixed to Pi. This feature avoids to write the fullpath in Pi, which is interesting if the banks referred by Pi are moved; in such a case, one just has to move the album file in the same location of the moved banks.

BankAlbum is a composite bank so iterating the sequences of a BankAlbum instance consists in iterating the sequences of each referred bank (in the order of the album file).

The BankAlbum follows the Composite design pattern, so it is possible to have album of albums for instance; it is also possible to mix composite and leaf banks like this:

someAlbum.txt
somefile1.fasta
somefile2.fasta

Example of use:

// We declare a Bank instance.
BankAlbum bank (filename);
// We dump some information about the bank
std::cout << "cummulated files sizes : " << bank.getSize() << std::endl;
// We create an iterator on the bank
Iterator<Sequence>* it = bank.iterator();
LOCAL (it);
// We iterate the sequences of the bank
for (it->first(); !it->isDone(); it->next())
{
// We dump some information about the sequence.
std::cout << "comment " << it->item().getComment() << std::endl;
}

Constructor & Destructor Documentation

BankAlbum ( const std::string &  name,
bool  deleteIfExists = false 
)

Constructor.

Parameters
[in]name: uri of the album.
[in]deleteIfExists: delete the album file if it exists.
BankAlbum ( const std::string &  name,
const std::vector< IBank * > &  banks 
)
inline

Constructor.

Parameters
[in]name: uri of the album.
[in]banks: vector of banks instance to be added to the album.
BankAlbum ( const std::vector< std::string > &  filenames)

Constructor.

Parameters
[in]filenamesuri of the files to be used.

Member Function Documentation

IBank * addBank ( const std::string &  bankUri)

Add a bank to the album.

IBank * addBank ( const std::string &  directory,
const std::string &  bankName,
bool  output_fastq = false,
bool  output_gz = false 
)

Add a bank to the album.

std::string getId ( )
inlinevirtual

Implements IBank.

static const char* name ( )
inlinestatic

Returns the name of the bank format.

void remove ( )
virtual

Reimplemented from AbstractBank.


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