cross_aln_ds.cpp
来自「ncbi源码」· C++ 代码 · 共 159 行
CPP
159 行
/* * =========================================================================== * PRODUCTION $Log: cross_aln_ds.cpp,v $ * PRODUCTION Revision 1000.1 2004/06/01 21:06:26 gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.4 * PRODUCTION * =========================================================================== *//* $Id: cross_aln_ds.cpp,v 1000.1 2004/06/01 21:06: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: Vlad Lebedev * */#include <ncbi_pch.hpp>#include <gui/widgets/aln_crossaln/cross_aln_ds.hpp>BEGIN_NCBI_SCOPEUSING_SCOPE(ncbi::objects);CCrossAlnDataSource::CCrossAlnDataSource(const CSeq_annot& annot, CScope& scope) : CHitMatrixDataSource(annot, scope){}CCrossAlnDataSource::CCrossAlnDataSource(const CSeq_align_set& aset, CScope& scope) : CHitMatrixDataSource(aset, scope){}CCrossAlnDataSource::~CCrossAlnDataSource(){}bool CCrossAlnDataSource::SelectIds(const TIdRef& q_id, const TIdRef& s_id){ bool b_ok = CHitMatrixDataSource::SelectIds(q_id, s_id); const THitAdapterCont& hit_adapts = GetHits(); TSignedSeqPos off1 = INT_MAX, off2 = INT_MAX; TSeqPos start1 = INT_MAX, start2 = INT_MAX; TSeqPos stop1 = 0, stop2 = 0; ITERATE(THitAdapterCont, iter, hit_adapts) { for (int idx = 0; idx != (*iter).GetElemsCount(); idx++) { TSignedSeqPos qs = (*iter).GetQueryStart (idx); TSignedSeqPos ss = (*iter).GetSubjectStart(idx); TSeqPos len = (*iter).GetLength(idx); off1 = min(off1, qs); off2 = min(off2, ss); start1 = min(start1, TSeqPos(qs)); start2 = min(start2, TSeqPos(ss)); stop1 = max(stop1, qs+len); stop2 = max(stop2, ss+len); } } // FixMe: Only Totalrange is really needed m_Offset = off1 - off2; m_QueryRange = TSeqRange(start1, stop1); m_SubjectRange = TSeqRange(start2, stop2); m_TotalRange = TSeqRange(min(start1, start2), max(stop1, stop2) ); if (m_Offset < 0) { m_QueryRange = TSeqRange(start1 - m_Offset, stop1 - m_Offset); m_SubjectRange = TSeqRange(start2, stop2); } else { m_QueryRange = TSeqRange(start1, stop1); m_SubjectRange = TSeqRange(start2 + m_Offset, stop2 + m_Offset); } m_TotalRange = TSeqRange(min(m_QueryRange.GetFrom(), m_SubjectRange.GetFrom()), max(m_QueryRange.GetTo(), m_SubjectRange.GetTo()) ); return b_ok;}TSignedSeqPos CCrossAlnDataSource::GetOffset() const{ return m_Offset;} const TSeqRange& CCrossAlnDataSource::GetQueryRange() const{ return m_QueryRange;} const TSeqRange& CCrossAlnDataSource::GetSubjectRange() const{ return m_SubjectRange;} const TSeqRange& CCrossAlnDataSource::GetTotalRange() const{ return m_TotalRange;} END_NCBI_SCOPE/* * =========================================================================== * $Log: cross_aln_ds.cpp,v $ * Revision 1000.1 2004/06/01 21:06:26 gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.4 * * Revision 1.4 2004/05/21 22:27:51 gorelenk * Added PCH ncbi_pch.hpp * * Revision 1.3 2004/03/11 17:50:41 dicuccio * Updated typedefs: dropped TDimension, TPosition, TIndex, TColor; use TSeqRange * instead of TRange * * Revision 1.2 2003/12/22 21:44:34 ucko * Avoid deque<>::const_iterator::operator->, which fails to compile on * GCC 2.95.x due to a typo in its STL implementation. :-/ * * Revision 1.1 2003/12/22 13:12:32 lebedev * Initial revision * * =========================================================================== */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?