⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 su_block_multiple_alignment.hpp

📁 ncbi源码
💻 HPP
📖 第 1 页 / 共 2 页
字号:
    bool ShiftRow(unsigned int row, unsigned int fromAlignmentIndex, unsigned int toAlignmentIndex,        eUnalignedJustification justification);    // delete a row; returns true if successful    bool DeleteRow(unsigned int row);    // this function does two things: it extracts from a multiple alignment all slave rows listed for    // removal; and if pairwiseAlignments!=NULL, for each slave removed creates a new BlockMultipleAlignment    // that contains the alignment of just that slave with the master, as it was in the original multiple    // (i.e., not according to the corresponding pre-IBM MasterSlaveAlignment)    typedef std::list < BlockMultipleAlignment * > AlignmentList;    bool ExtractRows(const std::vector < unsigned int >& slavesToRemove, AlignmentList *pairwiseAlignments);    // merge in the contents of the given alignment (assuming same master, compatible block structure),    // addings its rows to the end of this alignment; returns true if merge successful. Does not change    // block structure - just adds the part of new alignment's aligned blocks that intersect with this    // object's aligned blocks    bool MergeAlignment(const BlockMultipleAlignment *newAlignment);    // reorder rows according to newOrder; returns true on success    bool ReorderRows(const std::vector < unsigned int >& newOrder);private:    SequenceList m_sequences;    typedef std::list < ncbi::CRef < Block > > BlockList;    BlockList m_blocks;    typedef struct {        Block *block;        unsigned int blockColumn, alignedBlockNum;    } BlockInfo;    typedef std::vector < BlockInfo > BlockMap;    BlockMap m_blockMap;    unsigned int m_totalWidth;    bool CheckAlignedBlock(const Block *newBlock) const;    UnalignedBlock * CreateNewUnalignedBlockBetween(const Block *left, const Block *right);    Block * GetBlockBefore(const Block *block);    Block * GetBlockAfter(const Block *block);    const Block * GetBlockBefore(const Block *block) const;    const Block * GetBlockAfter(const Block *block) const;    void InsertBlockBefore(Block *newBlock, const Block *insertAt);    void InsertBlockAfter(const Block *insertAt, Block *newBlock);    void RemoveBlock(Block *block);    // for cacheing of residue->block lookups    mutable unsigned int m_cachePrevRow;    mutable const Block *m_cachePrevBlock;    mutable BlockList::const_iterator m_cacheBlockIterator;    void InitCache(void);    // given a row and seqIndex, find block that contains that residue    const Block * GetBlock(unsigned int row, unsigned int seqIndex) const;    // intended for volatile storage of row-associated info (e.g. for alignment scores, etc.)    mutable std::vector < double > m_rowDoubles;    mutable std::vector < std::string > m_rowStrings;    // associated PSSM    mutable BLAST_Matrix_ *m_pssm;};// static function to create Seq-aligns out of multiplencbi::objects::CSeq_align * CreatePairwiseSeqAlignFromMultipleRow(const BlockMultipleAlignment *multiple,    const BlockMultipleAlignment::UngappedAlignedBlockList& blocks, unsigned int slaveRow);// base class for Block - BlockMultipleAlignment is made up of a list of theseclass Block : public ncbi::CObject{public:    virtual ~Block(void) { }    // virtual destructor for base class    // makes a new copy of itself    virtual Block * Clone(const BlockMultipleAlignment *newMultiple) const = 0;    unsigned int m_width;    virtual bool IsAligned(void) const = 0;    // get sequence index for a column, which must be in block range (0 ... width-1)    virtual unsigned int GetIndexAt(unsigned int blockColumn, unsigned int row,        BlockMultipleAlignment::eUnalignedJustification justification) const = 0;    // delete a row    virtual void DeleteRow(unsigned int row) = 0;    virtual void DeleteRows(std::vector < bool >& removeRows, unsigned int nToRemove) = 0;    bool IsFrom(const BlockMultipleAlignment *alignment) const { return (alignment == m_parentAlignment); }    // given a row number (from 0 ... nSequences-1), give the sequence range covered by this block    typedef struct {        unsigned int from, to;    } Range;    const Range* GetRangeOfRow(int row) const { return &(m_ranges[row]); }    void SetRangeOfRow(unsigned int row, unsigned int from, unsigned int to)    {        m_ranges[row].from = from;        m_ranges[row].to = to;    }    // resize - add new (empty) rows at end    void AddRows(unsigned int nNewRows) { m_ranges.resize(m_ranges.size() + nNewRows); }    unsigned int NSequences(void) const { return m_ranges.size(); }    // reorder rows according to newOrder; returns true on success    bool ReorderRows(const std::vector < unsigned int >& newOrder);protected:    Block(const BlockMultipleAlignment *multiple) :        m_parentAlignment(multiple), m_ranges(multiple->NRows()) { }    const BlockMultipleAlignment *m_parentAlignment;    typedef std::vector < Range > RangeList;    RangeList m_ranges;};// a gapless aligned block; width must be >= 1class UngappedAlignedBlock : public Block{public:    UngappedAlignedBlock(const BlockMultipleAlignment *multiple) : Block(multiple) { }    bool IsAligned(void) const { return true; }    unsigned int GetIndexAt(unsigned int blockColumn, unsigned int row,        BlockMultipleAlignment::eUnalignedJustification justification =            BlockMultipleAlignment::eCenter) const  // justification ignored for aligned block        { return (GetRangeOfRow(row)->from + blockColumn); }    char GetCharacterAt(unsigned int blockColumn, unsigned int row) const;    void DeleteRow(unsigned int row);    void DeleteRows(std::vector < bool >& removeRows, unsigned int nToRemove);    Block * Clone(const BlockMultipleAlignment *newMultiple) const;};// an unaligned block; max width of block must be >=1. But range over any given// sequence can be length 0 (but not <0); if length 0, "to" is the residue before// the block, and "from" (= to+1) is the residue after.class UnalignedBlock : public Block{public:    UnalignedBlock(const BlockMultipleAlignment *multiple) : Block(multiple) { }    void Resize(void);  // recompute block width from current ranges    bool IsAligned(void) const { return false; }    unsigned int GetIndexAt(unsigned int blockColumn, unsigned int row,        BlockMultipleAlignment::eUnalignedJustification justification) const;    void DeleteRow(unsigned int row);    void DeleteRows(std::vector < bool >& removeRows, unsigned int nToRemove);    Block * Clone(const BlockMultipleAlignment *newMultiple) const;};END_SCOPE(struct_util)#endif // SU_BLOCK_MULTIPLE_ALIGNMENT__HPP/** ---------------------------------------------------------------------------* $Log: su_block_multiple_alignment.hpp,v $* Revision 1000.0  2004/06/01 18:14:33  gouriano* PRODUCTION: IMPORTED [GCC34_MSVC7] Dev-tree R1.7** Revision 1.7  2004/05/28 09:46:57  thiessen* restructure C-toolkit header usage ; move C Bioseq storage into su_sequence_set** Revision 1.6  2004/05/27 21:34:08  thiessen* add PSSM calculation (requires C-toolkit)** Revision 1.5  2004/05/26 14:49:59  thiessen* UNDEFINED -> eUndefined** Revision 1.4  2004/05/26 14:30:16  thiessen* adjust handling of alingment data ; add row ordering** Revision 1.3  2004/05/26 02:40:24  thiessen* progress towards LOO - all but PSSM and row ordering** Revision 1.2  2004/05/25 16:12:30  thiessen* fix GCC warnings** Revision 1.1  2004/05/25 15:52:18  thiessen* add BlockMultipleAlignment, IBM algorithm**/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -