mate_pair.cpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:4k
- /*
- * ===========================================================================
- * PRODUCTION $Log: mate_pair.cpp,v $
- * PRODUCTION Revision 1000.0 2004/06/01 21:20:56 gouriano
- * PRODUCTION PRODUCTION: IMPORTED [GCC34_MSVC7] Dev-tree R1.3
- * PRODUCTION
- * ===========================================================================
- */
- /* $Id: mate_pair.cpp,v 1000.0 2004/06/01 21:20:56 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
- *
- * File Description:
- * CLayoutMatePair -- utility class to layout mate pairs (a special type of
- * pairwise alignments and hold a set of CLayoutPWAlign
- */
- #include <ncbi_pch.hpp>
- #include <gui/objutils/mate_pair.hpp>
- #include <objects/seqloc/Seq_interval.hpp>
- #include <objtools/alnmgr/alnvec.hpp>
- BEGIN_NCBI_SCOPE
- USING_SCOPE(objects);
- CLayoutMatePair::CLayoutMatePair(const TAlignList& aligns)
- : m_SeqAligns(aligns)
- , m_LibraryId(eLibrary_NotSet)
- , m_ErrorType(eError_NotSet)
- {
- if (m_SeqAligns.size() != 1) {
- m_ErrorType = eError_NoError;
- }
- const CSeq_id* id = NULL;
- TSeqRange range;
- ITERATE (TAlignList, iter, m_SeqAligns) {
- const CLayoutPWAlign& pw = **iter;
- range += pw.GetLocation().GetTotalRange();
- id = &pw.GetAlignMgr().GetSeqId(pw.GetAlignMgr().GetAnchor());
- const CSeq_align& align = pw.GetAlignment();
- int type = 0;
- if (m_ErrorType != eError_NoError &&
- align.GetNamedScore("bad matepair code", type)) {
- m_ErrorType = static_cast<EErrorType>(type);
- }
- align.GetNamedScore("matepair library", m_LibraryId);
- }
- if (m_LibraryId == eLibrary_NotSet) {
- m_LibraryId = eLibrary_NotFound;
- }
- if (m_ErrorType == eError_NotSet) {
- m_ErrorType = eError_NoError;
- }
- if (id) {
- m_Location.Reset(new CSeq_loc());
- m_Location->SetInt().SetFrom(range.GetFrom());
- m_Location->SetInt().SetTo (range.GetTo());
- m_Location->SetId(*id);
- }
- }
- const CObject* CLayoutMatePair::GetObject(TSeqPos pos) const
- {
- ITERATE (TAlignList, iter, m_SeqAligns) {
- const CObject* obj = (*iter)->GetObject(pos);
- if (obj) {
- return obj;
- }
- }
- return NULL;
- }
- END_NCBI_SCOPE
- /*
- * ===========================================================================
- * $Log: mate_pair.cpp,v $
- * Revision 1000.0 2004/06/01 21:20:56 gouriano
- * PRODUCTION: IMPORTED [GCC34_MSVC7] Dev-tree R1.3
- *
- * Revision 1.3 2004/05/21 22:27:44 gorelenk
- * Added PCH ncbi_pch.hpp
- *
- * Revision 1.2 2004/05/10 18:22:10 dicuccio
- * Added recognition of mate pair library and error codes
- *
- * Revision 1.1 2004/04/30 11:48:16 dicuccio
- * Initial commit - split out from src/gui/utils
- *
- * Revision 1.4 2004/04/20 19:16:08 dicuccio
- * Converted to use a set of pairwise alignments
- *
- * Revision 1.3 2004/04/15 13:00:11 lebedev
- * Changed GetObject to return NULL or const pointer based on given position
- *
- * Revision 1.2 2004/04/12 16:50:54 dicuccio
- * Redesign CLayoutMatePair to store an alignment manager internally
- *
- * Revision 1.1 2004/04/05 16:11:00 lebedev
- * Initial revision
- *
- * ===========================================================================
- */