/*
 * AlignedSequenceLoader.h
 *
 * Interface to Arb's DB.
 * This class loads aligned sequences from Arb's DB and allows the other
 * code in this package to access it in a standard way.
 *
 *  Created on: Feb 15, 2010
 *      Author: Breno Faria
 *
 *  Institute of Microbiology (Technical University Munich)
 *  http://www.arb-home.de/
 */


#ifndef ALIGNEDSEQUENCELOADER_H
#define ALIGNEDSEQUENCELOADER_H

#ifndef CMA_H
#include "Cma.h"
#endif
#ifndef ARB_CORE_H
#include <arb_core.h>
#endif
#ifndef ARBTOOLS_H
#include <arbtools.h>
#endif

class AlignedSequenceLoader FINAL_TYPE : virtual Noncopyable {

    GB_ERROR        error;
    /**
     * The aligned sequences (see Cma.h for the definition of VecVecType).
     */
    VecVecType     *seqs;
    /**
     * The positions map between cleaned-up alignment and original one.
     */
    vector<size_t> position_map;
    /**
     * The length of the multiple sequence alignment.
     */
    size_t          MSA_len;
    /**
     * Cleans-up the MSA, removing positions with no base occurrence.
     */
    void            cleanSeqs(const size_t * occurrences, long len);

  public:

    /**
     * Returns the MSA length.
     */
    size_t getMsaLen();

    /**
     * Returns the position map.
     */
    const vector<size_t>& getPositionMap();

    /**
     * Returns the aligned sequences.
     */
    VecVecType* getSequences();

    GB_ERROR get_error() const { return error; }
    bool has_error() const { return get_error(); }

    /**
     * Constructor.
     */
    AlignedSequenceLoader(class GBDATA *gb_main);

    /**
     * Destructor.
     */
    ~AlignedSequenceLoader();
};

#else
#error AlignedSequenceLoader.h included twice
#endif // ALIGNEDSEQUENCELOADER_H
