NCBI C++ ToolKit
mapped_feat.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: mapped_feat.cpp 76314 2017-01-31 17:17:26Z vasilche $
2 * ===========================================================================
3 *
4 * PUBLIC DOMAIN NOTICE
5 * National Center for Biotechnology Information
6 *
7 * This software/database is a "United States Government Work" under the
8 * terms of the United States Copyright Act. It was written as part of
9 * the author's official duties as a United States Government employee and
10 * thus cannot be copyrighted. This software/database is freely available
11 * to the public for use. The National Library of Medicine and the U.S.
12 * Government have not placed any restriction on its use or reproduction.
13 *
14 * Although all reasonable efforts have been taken to ensure the accuracy
15 * and reliability of the software and data, the NLM and the U.S.
16 * Government do not and cannot warrant the performance or results that
17 * may be obtained by using this software or data. The NLM and the U.S.
18 * Government disclaim all warranties, express or implied, including
19 * warranties of performance, merchantability or fitness for any particular
20 * purpose.
21 *
22 * Please cite the author in any work or product based on this material.
23 *
24 * ===========================================================================
25 *
26 * Author: Eugene Vasilchenko
27 *
28 * File Description:
29 * class CMappedFeat to represent feature with mapped locations
30 *
31 */
32 
33 #include <ncbi_pch.hpp>
34 #include <objmgr/mapped_feat.hpp>
35 
38 
39 class CScope;
40 
42 {
44 }
45 
46 
48  : CSeq_feat_Handle(feat)
49 {
51 }
52 
53 
55 {
56  *this = feat;
57 }
58 
59 
61 {
62  if ( this != &feat ) {
63  CSeq_feat_Handle::operator=(feat);
67  }
68  return *this;
69 }
70 
71 
73 {
74 }
75 
76 
78 {
83 }
84 
85 
87  const CAnnotObject_Ref& feat_ref)
88 {
89  _ASSERT(feat_ref.IsFeat());
90 
91  m_Seq_annot = feat_ref.GetSeq_annot_Handle();
93  if ( feat_ref.IsSNPTableFeat() ) {
95  if ( !collector.m_CreatedOriginal ) {
97  }
98  m_CreatedFeat = collector.m_CreatedOriginal;
100  }
101  else if ( feat_ref.IsSortedSeqTableFeat() ) {
103  if ( !collector.m_CreatedOriginal ) {
105  }
106  m_CreatedFeat = collector.m_CreatedOriginal;
108  }
109  else if ( feat_ref.GetAnnotObject_Info().IsRegular() ) {
110  m_FeatIndex = feat_ref.GetAnnotIndex();
112  _ASSERT(IsPlainFeat());
113  }
114  else {
115  m_FeatIndex = feat_ref.GetAnnotIndex();
116  if ( !collector.m_CreatedOriginal ) {
118  }
119  m_CreatedFeat = collector.m_CreatedOriginal;
120  _ASSERT(IsTableFeat());
121  }
122 
123  m_MappingInfoPtr = &feat_ref.GetMappingInfo();
125  return *this;
126 }
127 
128 
130 {
132 }
133 
134 
136 {
137  if ( m_MappingInfoPtr->IsMapped() ) {
139  }
140  else {
141  return GetOriginalSeq_feat();
142  }
143 }
144 
145 
147 {
148  return *GetOriginalSeq_feat();
149 }
150 
151 
153 {
154  return *GetSeq_feat();
155 }
156 
157 
159 {
160  if ( !m_MappingInfoPtr->IsMapped() ) {
162  }
163  return m_MappingInfoPtr->IsPartial();
164 }
165 
166 
167 bool CMappedFeat::GetPartial(void) const
168 {
169  if ( !m_MappingInfoPtr->IsMapped() ) {
171  }
172  return m_MappingInfoPtr->IsPartial();
173 }
174 
175 
177 {
180 }
181 
182 
184 {
187 }
188 
189 
191 {
193  const CSeq_id* id = m_MappingInfoPtr->GetLocationId();
194  return id? CSeq_id_Handle::GetHandle(*id): CSeq_id_Handle();
195  }
197 }
198 
199 
201 {
205 }
206 
207 
209 {
211  const CSeq_id* id = m_MappingInfoPtr->GetProductId();
212  return id? CSeq_id_Handle::GetHandle(*id): CSeq_id_Handle();
213  }
215 }
216 
217 
219 {
223 }
224 
225 
const TRange & GetTotalRange(void) const
bool IsMappedLocation(void) const
bool IsMapped(void) const
const CSeq_id * GetProductId(void) const
bool IsMappedProduct(void) const
const CSeq_id * GetLocationId(void) const
bool IsPartial(void) const
bool IsRegular(void) const
bool IsSortedSeqTableFeat(void) const
const CAnnotObject_Info & GetAnnotObject_Info(void) const
bool IsSNPTableFeat(void) const
const CSeq_annot_Handle & GetSeq_annot_Handle(void) const
TAnnotIndex GetAnnotIndex(void) const
bool IsFeat(void) const
CAnnotMapping_Info & GetMappingInfo(void) const
CRef< CCreatedFeat_Ref > m_CreatedOriginal
CRef< CSeq_loc > GetMappedLocation(const CAnnotMapping_Info &map, const CSeq_feat &orig_feat)
CConstRef< CSeq_feat > GetMappedFeature(const CAnnotMapping_Info &map, const CSeq_feat &orig_feat)
CMappedFeat –.
Definition: mapped_feat.hpp:59
CScope –.
Definition: scope.hpp:92
CSeq_feat_Handle –.
namespace ncbi::objects::
Definition: Seq_feat.hpp:58
static CSeq_id_Handle GetHandle(const CSeq_id &id)
Normal way of getting a handle, works for any seq-id.
CRef< CCreatedFeat_Ref > m_CreatedFeat
virtual bool GetPartial(void) const
virtual CSeq_id_Handle GetLocationId(void) const
CSeq_annot_Handle m_Seq_annot
CConstRef< CSeq_feat > m_CreatedOriginalFeat
virtual TRange GetRange(void) const
Get range for current seq-feat.
virtual TRange GetProductTotalRange(void) const
bool IsTableSNP(void) const
Check if this is SNP table feature.
CConstRef< CSeq_feat > GetOriginalSeq_feat(void) const
bool IsTableFeat(void) const
Check if this is non-SNP table feature.
virtual bool IsSetPartial(void) const
bool IsSortedTableFeat(void) const
Check if this is a simple feature from sorted Seq-table.
bool IsPlainFeat(void) const
Check if this is plain feature.
virtual CSeq_id_Handle GetProductId(void) const
~CMappedFeat(void)
Definition: mapped_feat.cpp:72
CSeq_id_Handle GetProductId(void) const
CAnnotMapping_Info m_MappingInfoObj
bool IsSetPartial(void) const
CMappedFeat & operator=(const CMappedFeat &feat)
Definition: mapped_feat.cpp:60
const CSeq_loc & GetLocation(void) const
bool GetPartial(void) const
const CSeq_feat & GetOriginalFeature(void) const
Get original feature with unmapped location/product.
TRange GetProductTotalRange(void) const
const CSeq_feat & GetMappedFeature(void) const
Feature mapped to the master sequence.
CCreatedFeat_Ref m_MappedFeat
const CSeq_loc & GetProduct(void) const
CMappedFeat & Set(CAnnot_Collector &collector, const CAnnotObject_Ref &feat_ref)
Definition: mapped_feat.cpp:86
TRange GetRange(void) const
Get range for mapped seq-feat's location.
CConstRef< CSeq_loc > GetMappedLocation(void) const
CMappedFeat(void)
Definition: mapped_feat.cpp:41
CAnnotMapping_Info * m_MappingInfoPtr
CConstRef< CSeq_feat > GetSeq_feat(void) const
Get current seq-feat.
CSeq_id_Handle GetLocationId(void) const
void Reset(void)
Definition: mapped_feat.cpp:77
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:1439
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:773
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:75
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:72
const TLocation & GetLocation(void) const
Get the Location member data.
Definition: Seq_feat_.hpp:1117
const TProduct & GetProduct(void) const
Get the Product member data.
Definition: Seq_feat_.hpp:1096
#define _ASSERT
Modified on Wed Apr 17 13:08:12 2024 by modify_doxy.py rev. 669887