gatb.core-API-1.4.2
IBank Class Referenceabstract

Interface for what we need to read genomic databases. More...

#include <IBank.hpp>

Inheritance diagram for IBank:
Inheritance graph

Public Member Functions

virtual std::string getId ()=0
 
virtual std::string getIdNb (int i)=0
 
virtual int64_t estimateNbItemsBanki (int i)=0
 
virtual const std::vector< IBank * > getBanks () const =0
 
virtual tools::dp::Iterator< Sequence > * iterator ()=0
 
virtual void insert (const Sequence &item)=0
 
virtual u_int64_t getSize ()=0
 
virtual size_t getCompositionNb ()=0
 
virtual void estimate (u_int64_t &number, u_int64_t &totalSize, u_int64_t &maxSize)=0
 
virtual int64_t estimateNbItems ()=0
 
virtual u_int64_t estimateSequencesSize ()=0
 
virtual u_int64_t getEstimateThreshold ()=0
 
virtual void setEstimateThreshold (u_int64_t nbSeq)=0
 
virtual void remove ()=0
 
virtual void finalize ()=0
 
- Public Member Functions inherited from Iterable< Sequence >
void iterate (Functor f)
 
virtual int64_t getNbItems ()=0
 
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 ()
 
virtual void use ()=0
 
virtual void forget ()=0
 
- 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)
 
virtual void flush ()=0
 

Detailed Description

Interface for what we need to read genomic databases.

The IBank interface provides means to:

  • read sequences from some container.
  • insert sequences into some container.

One typical implementation of this interface is a FASTA bank parser.

The key point here is that clients should use this interface instead of specific implementations, wherever they need to get nucleotides sequences from some container.

By doing this, such clients will support many bank formats (according to the fact that a IBank implementation provides such a service). They will also support "fake" banks, for instance random generated sequences or any kind of synthetic data.

From a design point of view, IBank is an Iterable (something we can get iterators from) and a Bag (something we can insert items into); in both cases, the item type is Sequence

Some kind of factory method exists for using IBank instances: this is the gatb::core::bank::impl::Bank class. This class allows to get a IBank instance by providing an URI. The actual implementation class of the IBank interface is computed by analyzing the URI string itself, or the content of the file defined by the URI. So, tools developers should in general get IBank instances this way, so their tool would support different kind of input bank formats.

See also
Sequence
IBankFactory
impl::Bank

Member Function Documentation

virtual void estimate ( u_int64_t &  number,
u_int64_t &  totalSize,
u_int64_t &  maxSize 
)
pure virtual

Give an estimation of sequences information in the bank.

Parameters
[out]number: sequences number
[out]totalSize: sequences size (in bytes)
[out]maxSize: max size size (in bytes)

Implemented in BankComposite, BankStrings, BankDelegate, BankBinary, BankFasta, BankSplitter, BankRandom, and BankKmers.

virtual int64_t estimateNbItems ( )
pure virtual

Shortcut to 'estimate' method.

Returns
estimation of the number of sequences

Implements Iterable< Sequence >.

Implemented in BankDelegate, and AbstractBank.

virtual int64_t estimateNbItemsBanki ( int  i)
pure virtual

In case of a composite bank,

Returns
estimation of the number of sequences of sub bank i

Implemented in BankDelegate, BankComposite, and AbstractBank.

virtual u_int64_t estimateSequencesSize ( )
pure virtual

Shortcut to 'estimate' method.

Returns
estimation of the size of sequences

Implemented in BankDelegate, and AbstractBank.

virtual void finalize ( )
pure virtual

Method that may be called when the bank is done. It is called by BankFasta destructor for instance. It will close fclose() or something equivalent. You don't need to call this function yourself.

Implemented in BankFasta, and AbstractBank.

virtual const std::vector<IBank*> getBanks ( ) const
pure virtual

Return the vector of sub IBank objects (in case of bank composite), or a vector containing only the bank itself

Returns
the IBank objects.

Implemented in BankComposite, and AbstractBank.

virtual size_t getCompositionNb ( )
pure virtual

In case of a composite bank, return the number of sub banks.

Returns
number of sub banks.

Implemented in BankComposite, and AbstractBank.

virtual u_int64_t getEstimateThreshold ( )
pure virtual
Returns
the number of sequences read from the bank for computing estimated information

Implemented in BankDelegate, and AbstractBank.

virtual std::string getId ( )
pure virtual

Get an unique identifier for the bank (could be the URI of a FASTA file for instance).

Returns
the identifier

Implemented in BankAlbum, BankBinary, BankDelegate, BankFasta, BankComposite, BankSplitter, BankRandom, BankStrings, and BankKmers.

virtual std::string getIdNb ( int  i)
pure virtual

In case of a composite bank, return the id of bank i

Returns
id of sub bank i

Implemented in BankComposite, BankDelegate, and AbstractBank.

virtual u_int64_t getSize ( )
pure virtual

Return the size of the bank (comments + data)

The returned value may be an approximation in some case. For instance, if we use a zipped bank, an implementation may be not able to give accurate answer to the size of the original file.

Returns
the bank size in bytes.

Implemented in BankComposite, BankStrings, BankDelegate, BankBinary, BankFasta, BankSplitter, BankRandom, and BankKmers.

virtual void insert ( const Sequence item)
pure virtual

Insert an item into the bag.

Parameters
[in]item: the item to be inserted.

Implemented in BankComposite, BankDelegate, BankBinary, BankFasta, BankStrings, BankSplitter, BankRandom, and BankKmers.

virtual tools::dp::Iterator<Sequence>* iterator ( )
pure virtual

Create an iterator for the given Iterable instance.

Returns
the new iterator.

Implements Iterable< Sequence >.

Implemented in BankFiltered< Filter >, BankKmers, BankComposite, BankDelegate, BankBinary, BankFasta, BankStrings, BankSplitter, and BankRandom.

virtual void remove ( )
pure virtual

Remove physically the bank. This method will have non-empty implementation for banks using file system for instance.

Implemented in BankComposite, BankAlbum, BankBinary, and AbstractBank.

virtual void setEstimateThreshold ( u_int64_t  nbSeq)
pure virtual

Set the number of sequences read from the bank for computing estimated information

Parameters
[in]nbSeq: the number of sequences to be read.

Implemented in BankDelegate, and AbstractBank.


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