alignment_smear.hpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:6k
- /*
- * ===========================================================================
- * PRODUCTION $Log: alignment_smear.hpp,v $
- * PRODUCTION Revision 1000.0 2004/06/01 19:54:26 gouriano
- * PRODUCTION PRODUCTION: IMPORTED [GCC34_MSVC7] Dev-tree R1.3
- * PRODUCTION
- * ===========================================================================
- */
- #ifndef GUI_OBJUTILS___ALIGNMENT_SMEAR__HPP
- #define GUI_OBJUTILS___ALIGNMENT_SMEAR__HPP
- /* $Id: alignment_smear.hpp,v 1000.0 2004/06/01 19:54:26 gouriano Exp $
- * ===========================================================================
- *
- * PUBLIC DOMAIN NOTICE
- * National Center for Biotechnology Information
- *
- * This software/database is a "United States Government Work" under the
- * terms of the United States Copyright Act. It was written as part of
- * the author's official duties as a United States Government employee and
- * thus cannot be copyrighted. This software/database is freely available
- * to the public for use. The National Library of Medicine and the U.S.
- * Government have not placed any restriction on its use or reproduction.
- *
- * Although all reasonable efforts have been taken to ensure the accuracy
- * and reliability of the software and data, the NLM and the U.S.
- * Government do not and cannot warrant the performance or results that
- * may be obtained by using this software or data. The NLM and the U.S.
- * Government disclaim all warranties, express or implied, including
- * warranties of performance, merchantability or fitness for any particular
- * purpose.
- *
- * Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- * Authors: Robert G. Smith
- *
- * File Description:
- *
- */
- #include <corelib/ncbiobj.hpp>
- #include <gui/gui.hpp>
- #include <gui/objutils/density_map.hpp>
- /** @addtogroup GUI_OBJUTILS
- *
- * @{
- */
- BEGIN_NCBI_SCOPE
- template <typename T>
- struct max_func : public binary_function<T, T, T>
- {
- T operator() (T a1, T a2) const {
- return max(a1, a2);
- };
- };
- /*
- class CAlignSmearSeg_CI {
- public:
- typedef int score_type;
-
- CAlignSmearSeg_CI(const CDenMapRunIterator<score_type>& dmr_it, const CDensityMap<score_type>& density);
-
- score_type Advance();
-
- TSeqPos GetPosition() const { return m_DMR_it.GetPosition() * m_Window + m_Start; }
- TSeqPos GetLength() const{ return m_DMR_it.GetRunLength() * m_Window; }
- score_type GetValue() const { return m_DMR_it.GetValue(); }
-
- operator bool() const { return m_DMR_it.Valid(); }
- private:
- CDenMapRunIterator<score_type> m_DMR_it;
- TSeqPos m_Start;
- TSeqPos m_Window;
-
- };
- class CAlignSmearGap_CI {
- public:
- typedef int score_type;
-
- CAlignSmearGap_CI(const CDenMapRunIterator<score_type>& dmr_it, const CDensityMap<score_type, max_func<score_type> >& density);
-
- void Advance();
-
- TSeqPos GetPosition() const { return m_DMR_it.GetPosition() * m_Window + m_Start; }
- TSeqPos GetLength() const{ return m_DMR_it.GetRunLength() * m_Window; }
-
- operator bool() const { return m_DMR_it.Valid(); }
- private:
- CDensityMap<score_type, max_func<score_type> > m_DMR_it;
- TSeqPos m_Start;
- TSeqPos m_Window;
-
- };
- */
- class objects::CBioseq_Handle;
- class objects::CAlnMap;
- class objects::CSeq_annot;
- struct objects::SAnnotSelector;
- class NCBI_GUIOBJUTILS_EXPORT CAlignmentSmear : public CObject {
- public:
- enum EAlignSmearStrand {
- eSmearStrand_Both,
- eSmearStrand_Pos,
- eSmearStrand_Neg
- };
- typedef int score_type;
- typedef CDenMapRunIterator<score_type> runlen_iterator;
-
- CAlignmentSmear(
- const objects::CBioseq_Handle& handle,
- TSeqPos start,
- TSeqPos stop,
- TSeqPos window = 1,
- EAlignSmearStrand strand_type = eSmearStrand_Both
- );
- /// INPUT:
- /// smear all the alignments in this annotation.
- void AddAnnot(const objects::CSeq_annot& seq_annot);
- /// Smear all the alignments matchec by this selector on my bioseq.
- void AddAlignments(const objects::SAnnotSelector& sel);
-
- /// Add this one alignment to my smear.
- void AddAlignment(objects::CAlnMap& align);
- void MaskGaps();
-
- string GetLabel() const;
- void SetLabel(const string& label);
-
- EAlignSmearStrand GetStrandType() const { return m_StrandType; }
-
- static bool SeparateStrands(const objects::CSeq_annot& seq_annot);
-
- /// OUTPUT:
- runlen_iterator SmearSegBegin() const
- { return m_AccumSeg.RunLenBegin(); }
- runlen_iterator SmearGapBegin() const
- { return m_AccumGap.RunLenBegin(); }
- score_type GetMaxValue() const { return m_AccumSeg.GetMax(); }
- private:
- static string x_GetAnnotName(const objects::CSeq_annot& seq_annot);
- const objects::CBioseq_Handle& m_BioseqHandle;
-
- typedef CDensityMap<score_type> TSegMap;
- TSegMap m_AccumSeg;
-
- typedef CDensityMap<score_type, max_func<score_type> > TGapMap;
- TGapMap m_AccumGap;
- EAlignSmearStrand m_StrandType;
- string m_Label;
- };
- END_NCBI_SCOPE
- /* @} */
- /*
- * ===========================================================================
- * $Log: alignment_smear.hpp,v $
- * Revision 1000.0 2004/06/01 19:54:26 gouriano
- * PRODUCTION: IMPORTED [GCC34_MSVC7] Dev-tree R1.3
- *
- * Revision 1.3 2004/05/03 13:34:53 dicuccio
- * FIxed include guards, doxygen groups
- *
- * Revision 1.2 2004/05/03 12:41:35 dicuccio
- * Fixed #includes and export specifiers
- *
- * Revision 1.1 2004/04/30 11:52:52 dicuccio
- * Split out from gui/utils
- *
- * Revision 1.4 2004/04/16 14:27:17 dicuccio
- * Added doxygen module tag
- *
- * Revision 1.3 2004/03/23 13:34:39 dicuccio
- * Added export specifiers. Changed predeclaration from class -> struct to match
- * actual definition
- *
- * Revision 1.2 2004/03/22 18:40:10 ucko
- * Fix forward declaration of SAnnotSelector to contain "class".
- *
- * Revision 1.1 2004/03/22 16:35:34 rsmith
- * initial checkin
- *
- *
- * ===========================================================================
- */
- #endif // GUI_OBJUTILS___ALIGNMENT_SMEAR__HPP