NCBI C++ ToolKit
gap_trim.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef EDIT___GAP_TRIM__HPP
2 #define EDIT___GAP_TRIM__HPP
3 
4 /* $Id: gap_trim.hpp 93572 2021-04-30 13:48:31Z stakhovv $
5  * ===========================================================================
6  *
7  * PUBLIC DOMAIN NOTICE
8  * National Center for Biotechnology Information
9  *
10  * This software/database is a "United States Government Work" under the
11  * terms of the United States Copyright Act. It was written as part of
12  * the author's official duties as a United States Government employee and
13  * thus cannot be copyrighted. This software/database is freely available
14  * to the public for use. The National Library of Medicine and the U.S.
15  * Government have not placed any restriction on its use or reproduction.
16  *
17  * Although all reasonable efforts have been taken to ensure the accuracy
18  * and reliability of the software and data, the NLM and the U.S.
19  * Government do not and cannot warrant the performance or results that
20  * may be obtained by using this software or data. The NLM and the U.S.
21  * Government disclaim all warranties, express or implied, including
22  * warranties of performance, merchantability or fitness for any particular
23  * purpose.
24  *
25  * Please cite the author in any work or product based on this material.
26  *
27  * ===========================================================================
28  *
29  * Author: Colleen Bollin
30  *
31  * File Description:
32  * Adjusting features for gaps
33  * .......
34  *
35  */
36 
37 #include <corelib/ncbistd.hpp>
38 
39 #include <objmgr/scope.hpp>
44 
45 
48 
49 class CSeq_entry;
50 class CBioseq;
51 class CBioseq_set;
52 class CSeq_annot;
53 class CSeq_feat;
54 
55 
56 
57 class CSeq_entry_Handle;
58 class CBioseq_Handle;
59 class CBioseq_set_Handle;
60 class CSeq_annot_Handle;
61 class CSeq_feat_Handle;
62 
64 
66 public:
70 
71  void CollectGaps(const CSeq_loc& feat_loc, CScope& scope);
72  void CalculateRelevantIntervals(bool unknown_length, bool known_length, bool ns = false);
73  bool HasKnown() const { return m_Known; };
74  bool HasUnknown() const { return m_Unknown; };
75  bool HasNs() const { return m_Ns; };
76 
77  bool Trimmable() const;
78  bool Splittable() const;
79  bool ShouldRemove() const;
80 
81  void Trim(CSeq_loc& loc, bool make_partial, CScope& scope);
82  typedef vector< CRef<CSeq_loc> > TLocList;
83  TLocList Split(const CSeq_loc& orig, bool in_intron, bool make_partial);
84 
85  vector<CRef<CSeq_feat> > AdjustForRelevantGapIntervals(bool make_partial, bool trim, bool split, bool in_intron, bool create_general_only = false);
86  CSeq_feat_Handle GetFeature() const { return m_Feature; };
87 
88  static CRef<CBioseq> AdjustProteinSeq(const CBioseq& seq, const CSeq_feat& feat, const CSeq_feat& orig_cds, CScope& scope);
89 
90  bool IsRelatedByCrossRef(const CFeatGapInfo& other) const;
91 
92 protected:
93  typedef enum {
94  eGapIntervalType_unknown = 0,
96  eGapIntervalType_n
97  } EGapIntervalType;
98 
99  typedef pair<EGapIntervalType, pair<size_t, size_t> > TGapInterval;
100  typedef vector<TGapInterval> TGapIntervalList;
102 
103  typedef vector<pair<size_t, size_t> > TIntervalList;
107 
110 
111  bool m_Known;
112  bool m_Unknown;
113  bool m_Ns;
114 
116 
117  void x_AdjustOrigLabel(CSeq_feat& feat, size_t& id_offset, string& id_label, const string& qual);
118  static void x_AdjustFrame(CCdregion& cdregion, TSeqPos frame_adjust);
119  void x_AdjustCodebreaks(CSeq_feat& feat);
120  void x_AdjustAnticodons(CSeq_feat& feat);
121  bool x_UsableInterval(const TGapInterval& interval, bool unknown_length, bool known_length, bool ns);
122 };
123 
124 typedef vector<CRef<CFeatGapInfo> > TGappedFeatList;
127 
130 
131 // for adjusting feature IDs after splitting
132 
133 // for fixing a list of features from a split: pass in entire list, feature IDs will be changed
134 // for features after the first starting with the value of next_id, which will be increased
135 // after each use
137 void FixFeatureIdsForUpdates(vector<CRef<CSeq_feat> > updates, objects::CObject_id::TId& next_id);
138 
139 // adjust feature ID for a single feature (will increase next_id if feature had an ID to be adjusted)
142 
143 // adjust two lists of features, that are the result of splitting two features that had cross-references
144 // to each other. Both features must have been split into the same number of pieces.
145 // The new cross-references pair the elements of the list in order.
147 void FixFeatureIdsForUpdatePair(vector<CRef<CSeq_feat> >& updates1, vector<CRef<CSeq_feat> >& updates2);
148 
149 
153 
154 #endif /* EDIT___GAP_TRIM__HPP */
User-defined methods of the data storage class.
CBioseq_Handle –.
CBioseq_set_Handle –.
CCdregion –.
Definition: Cdregion.hpp:66
pair< EGapIntervalType, pair< size_t, size_t > > TGapInterval
Definition: gap_trim.hpp:99
CSeq_feat_Handle m_Feature
Definition: gap_trim.hpp:115
bool m_Unknown
Definition: gap_trim.hpp:112
TIntervalList m_InsideGaps
Definition: gap_trim.hpp:104
@ eGapIntervalType_known
Definition: gap_trim.hpp:95
TSeqPos m_Stop
Definition: gap_trim.hpp:109
TIntervalList m_LeftGaps
Definition: gap_trim.hpp:105
bool HasUnknown() const
Definition: gap_trim.hpp:74
bool HasNs() const
Definition: gap_trim.hpp:75
TIntervalList m_RightGaps
Definition: gap_trim.hpp:106
vector< CRef< CSeq_loc > > TLocList
Definition: gap_trim.hpp:82
TGapIntervalList m_Gaps
Definition: gap_trim.hpp:101
vector< pair< size_t, size_t > > TIntervalList
Definition: gap_trim.hpp:103
TSeqPos m_Start
Definition: gap_trim.hpp:108
CSeq_feat_Handle GetFeature() const
Definition: gap_trim.hpp:86
bool HasKnown() const
Definition: gap_trim.hpp:73
vector< TGapInterval > TGapIntervalList
Definition: gap_trim.hpp:100
CFeat_CI –.
Definition: feat_ci.hpp:64
CObject –.
Definition: ncbiobj.hpp:180
CScope –.
Definition: scope.hpp:92
CSeq_annot_Handle –.
CSeq_entry_Handle –.
Definition: Seq_entry.hpp:56
CSeq_feat_Handle –.
namespace ncbi::objects::
Definition: Seq_feat.hpp:58
static void x_AdjustOrigLabel(CSeq_feat &feat, size_t &id_offset, string &id_label, const string &qual)
Include a standard set of the NCBI C++ Toolkit most basic headers.
TGappedFeatList ListGappedFeatures(CFeat_CI &feat_it, CScope &scope)
Definition: gap_trim.cpp:625
void ProcessForTrimAndSplitUpdates(CSeq_feat_Handle cds, vector< CRef< CSeq_feat > > updates)
Definition: gap_trim.cpp:641
void FixFeatureIdsForUpdatePair(vector< CRef< CSeq_feat > > &updates1, vector< CRef< CSeq_feat > > &updates2)
Definition: gap_trim.cpp:743
void FixFeatureIdsForUpdates(vector< CRef< CSeq_feat > > updates, objects::CObject_id::TId &next_id)
vector< CRef< CFeatGapInfo > > TGappedFeatList
Definition: gap_trim.hpp:124
unsigned int TSeqPos
Type for sequence locations and lengths.
Definition: ncbimisc.hpp:875
#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
#define NCBI_XOBJEDIT_EXPORT
Definition: ncbi_export.h:1291
where boath are integers</td > n< td ></td > n</tr > n< tr > n< td > tse</td > n< td > optional</td > n< td > String</td > n< td class=\"description\"> TSE option controls what blob is orig
Definition: fix_pub.hpp:45
void split(std::vector< std::string > *strVec, const std::string &str_, const std::string &split_)
Modified on Mon Mar 04 05:14:56 2024 by modify_doxy.py rev. 669887