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

Go to the SVN repository for this file.

1 #ifndef OBJMGR_UTIL___AUTODEF__HPP
2 #define OBJMGR_UTIL___AUTODEF__HPP
3 
4 /* $Id: autodef.hpp 99081 2023-02-10 01:32:30Z kans $
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 * Creates unique definition lines for sequences in a set using organism
33 * descriptions and feature clauses.
34 */
35 
36 #include <corelib/ncbistd.hpp>
43 #include <objects/seq/MolInfo.hpp>
44 
45 #include <objmgr/bioseq_handle.hpp>
47 #include <objmgr/feat_ci.hpp>
48 
55 
56 #include <objmgr/util/feature.hpp>
57 
60 
62 {
63 public:
65 
66  CAutoDef();
67  ~CAutoDef();
68 
69  void AddSources(CSeq_entry_Handle se);
71  using TSources = vector<CConstRef<objects::CBioSource>>;
72  void AddDescriptors(const TSources& sources);
73 
74  CRef<CAutoDefModifierCombo> FindBestModifierCombo();
75  CAutoDefModifierCombo* GetAllModifierCombo();
76  CAutoDefModifierCombo* GetEmptyCombo();
77  unsigned int GetNumAvailableModifiers();
78  string GetOneSourceDescription(const CBioseq_Handle& bh);
79  string GetOneFeatureClauseList(CBioseq_Handle bh, unsigned int genome_val);
80  string GetOneDefLine(CAutoDefModifierCombo* mod_combo, const CBioseq_Handle& bh, CRef<feature::CFeatTree> featTree = null);
81  string GetOneDefLine(const CBioseq_Handle& bh);
82 
83  void SetOptionsObject(const CUser_object& user);
84  CRef<CUser_object> GetOptionsObject() const { return m_Options.MakeUserObject(); }
85  void SetOptions(const CAutoDefModifierCombo& mod_combo);
86 
87  void SetFeatureListType(CAutoDefOptions::EFeatureListType feature_list_type);
88  void SetMiscFeatRule(CAutoDefOptions::EMiscFeatRule misc_feat_rule);
89  void SetProductFlag(CBioSource::EGenome product_flag);
90  void SetNuclearCopyFlag(CBioSource::EGenome product_flag);
91  void SetSpecifyNuclearProduct (bool specify_nuclear_product);
92  void SetAltSpliceFlag (bool alt_splice_flag);
93  void SetSuppressLocusTags(bool suppress_locus_tags);
94  void SetSuppressAllele(bool suppress_allele);
95  void SetGeneClusterOppStrand(bool gene_opp_strand);
96  void SetSuppressFeatureAltSplice (bool suppress_alt_splice);
97  void SuppressMobileElementAndInsertionSequenceSubfeatures(bool suppress);
98  void SuppressMiscFeatSubfeatures(bool suppress);
99  void SetKeepExons(bool keep);
100  void SetKeepIntrons(bool keep);
101  void SetKeepRegulatoryFeatures(bool keep);
102  void SetKeepLTRs(bool keep);
103  void SetKeep3UTRs(bool keep);
104  void SetKeep5UTRs(bool keep);
105  void SetKeepuORFs(bool keep);
106  void SetKeepOptionalMobileElements(bool keep);
107  void SetKeepPrecursorRNA(bool keep);
108  void SetKeepRepeatRegion(bool keep);
109  void SetKeepMiscRecomb(bool keep);
110  void SetUseNcRNAComment (bool use_comment);
111  void SetUseFakePromoters (bool use_fake);
112  void SetCustomFeatureClause(const string& custom_feature_clause);
113 
114  void SuppressFeature(const objects::CFeatListItem& feat);
115  void SuppressFeature(objects::CSeqFeatData::ESubtype subtype);
116 
117  typedef vector<CRef<CAutoDefModifierCombo>> TModifierComboVector;
118 
119  void GetAvailableModifiers(TAvailableModifierSet &mod_set);
120 
121  void Cancel() { m_Cancelled = true; }
122  bool Cancelled() { return m_Cancelled; }
123 
124  static string GetKeywordPrefix(CBioseq_Handle bh);
125 
126  static bool RegenerateSequenceDefLines(CSeq_entry_Handle se);
127  static string RegenerateDefLine(CBioseq_Handle bh);
128 
129  static CRef<CUser_object> CreateIDOptions(CSeq_entry_Handle seh);
130 
131 private:
132  typedef vector<unsigned int> TModifierIndexVector;
133  typedef vector<CSeq_entry_Handle> TSeqEntryHandleVector;
134 
136 
138 
139  // feature clause specifications
141 
142  void x_SortModifierListByRank
143  (TModifierIndexVector& index_list,
145  void x_GetModifierIndexList
146  (TModifierIndexVector& index_list,
148 
149  string x_GetNonFeatureListEnding();
150 
151  string x_GetFeatureClauses(const CBioseq_Handle& bh);
152  string x_GetFeatureClauseProductEnding(const string& feature_clauses,
153  CBioseq_Handle bh);
154 
155  void x_RemoveOptionalFeatures(CAutoDefFeatureClause_Base *main_clause, const CBioseq_Handle& bh);
156 
157 
158  bool x_IsOrgModRequired(unsigned int mod_type);
159  bool x_IsSubSrcRequired(unsigned int mod_type);
160 
161  bool x_IsFeatureSuppressed(CSeqFeatData::ESubtype subtype);
162 
163  void GetMasterLocation(CBioseq_Handle &bh, CRange<TSeqPos>& range);
164  bool IsSegment(const CBioseq_Handle& bh);
165  bool x_Is5SList(CFeat_CI feat_ci);
166  bool x_IsSingleMiscFeat(CFeat_CI feat_ci);
167  string x_GetHumanSTRFeatureClauses(CBioseq_Handle bh, const CUser_object& comment);
168  string x_GetHumanSTRv2FeatureClauses(CBioseq_Handle bh, const CUser_object& comment);
169  bool x_IsHumanSTR(const CUser_object& obj);
170 
171  string x_GetOneNonFeatureClause(CBioseq_Handle bh, unsigned int genome_val);
172 
174 }; // end of CAutoDef
175 
176 
177 inline
179 {
180  m_Options.SetFeatureListType(feature_list_type);
181 }
182 
183 
184 inline
186 {
187  m_Options.SetMiscFeatRule(misc_feat_rule);
188 }
189 
190 
191 inline
193 {
194  m_Options.SetProductFlag(product_flag);
195 }
196 
197 
198 inline
200 {
201  m_Options.SetNuclearCopyFlag(product_flag);
202 }
203 
204 
205 inline
206 void CAutoDef::SetSpecifyNuclearProduct (bool specify_nuclear_product)
207 {
208  m_Options.SetSpecifyNuclearProduct(specify_nuclear_product);
209 }
210 
211 
212 inline
213 void CAutoDef::SetAltSpliceFlag (bool alt_splice_flag)
214 {
215  m_Options.SetAltSpliceFlag(alt_splice_flag);
216 }
217 
218 
219 inline
220 void CAutoDef::SetSuppressLocusTags (bool suppress_locus_tags)
221 {
222  m_Options.SetSuppressLocusTags(suppress_locus_tags);
223 }
224 
225 
226 inline
227 void CAutoDef::SetGeneClusterOppStrand (bool gene_opp_strand)
228 {
229  m_Options.SetGeneClusterOppStrand(gene_opp_strand);
230 }
231 
232 
233 inline
234 void CAutoDef::SetSuppressFeatureAltSplice (bool suppress_alt_splice)
235 {
236  m_Options.SetSuppressFeatureAltSplice(suppress_alt_splice);
237 }
238 
239 
240 inline
242 {
244 }
245 
246 
247 inline
249 {
251 }
252 
253 
254 inline
255 void CAutoDef::SetKeepExons(bool keep)
256 {
257  m_Options.SetKeepExons(keep);
258 }
259 
260 
261 inline
263 {
265 }
266 
267 
268 inline
270 {
272 }
273 
274 inline
275 void CAutoDef::SetKeepLTRs(bool keep)
276 {
277  m_Options.SetKeepLTRs(keep);
278 }
279 
280 
281 inline
282 void CAutoDef::SetKeep3UTRs(bool keep)
283 {
284  m_Options.SetKeep3UTRs(keep);
285 }
286 
287 
288 inline
289 void CAutoDef::SetKeep5UTRs(bool keep)
290 {
291  m_Options.SetKeep5UTRs(keep);
292 }
293 
294 
295 inline
296 void CAutoDef::SetKeepuORFs(bool keep)
297 {
298  m_Options.SetKeepuORFs(keep);
299 }
300 
301 
302 inline
304 {
306 }
307 
308 inline
310 {
312 }
313 
314 inline
316 {
318 }
319 
320 inline
322 {
324 }
325 
326 inline
327 void CAutoDef::SetUseNcRNAComment(bool use_comment)
328 {
329  m_Options.SetUseNcRNAComment(use_comment);
330 }
331 
332 
333 inline
334 void CAutoDef::SetUseFakePromoters(bool use_fake)
335 {
336  m_Options.SetUseFakePromoters(use_fake);
337 }
338 
339 
340 inline
341 void CAutoDef::SetCustomFeatureClause(const string& custom_feature_clause)
342 {
343  m_Options.SetCustomFeatureClause(custom_feature_clause);
344 }
345 
348 
349 #endif //OBJMGR_UTIL___AUTODEF__HPP
void SetNuclearCopyFlag(CBioSource::EGenome val)
void SetSuppressMiscFeatureSubfeatures(bool val=true)
void SetUseNcRNAComment(bool val=true)
void SetKeepPrecursorRNA(bool val=true)
void SetKeepLTRs(bool val=true)
void SetSuppressLocusTags(bool val=true)
void SetKeepIntrons(bool val=true)
void SetSpecifyNuclearProduct(bool val)
void SetGeneClusterOppStrand(bool val=true)
void SetKeepMiscRecomb(bool val=true)
void SetKeepRepeatRegion(bool val=true)
void SetMiscFeatRule(TMiscFeatRule rule)
void SetProductFlag(CBioSource::EGenome val)
void SetSuppressMobileElementSubfeatures(bool val=true)
void SetFeatureListType(EFeatureListType list_type)
void SetKeep3UTRs(bool val=true)
void SetKeep5UTRs(bool val=true)
void SetUseFakePromoters(bool val=true)
void SetKeepExons(bool val=true)
void SetKeepMobileElements(bool val=true)
void SetKeepRegulatoryFeatures(bool val=true)
void SetSuppressFeatureAltSplice(bool val=true)
void SetCustomFeatureClause(const string &val)
void SetKeepuORFs(bool val=true)
void SetAltSpliceFlag(bool val=true)
vector< CAutoDefAvailableModifier > TAvailableModifierVector
void SetKeepIntrons(bool keep)
Definition: autodef.hpp:262
void SetUseFakePromoters(bool use_fake)
Definition: autodef.hpp:334
void SuppressMiscFeatSubfeatures(bool suppress)
Definition: autodef.hpp:248
vector< CConstRef< objects::CBioSource > > TSources
Definition: autodef.hpp:71
void SetKeepLTRs(bool keep)
Definition: autodef.hpp:275
void SetSuppressAllele(bool suppress_allele)
void SetSpecifyNuclearProduct(bool specify_nuclear_product)
Definition: autodef.hpp:206
void SetKeep5UTRs(bool keep)
Definition: autodef.hpp:289
void SetKeepExons(bool keep)
Definition: autodef.hpp:255
void SetSuppressLocusTags(bool suppress_locus_tags)
Definition: autodef.hpp:220
void SetKeepOptionalMobileElements(bool keep)
Definition: autodef.hpp:303
CAutoDefModifierCombo m_OrigModCombo
Definition: autodef.hpp:135
void SetKeepRegulatoryFeatures(bool keep)
Definition: autodef.hpp:269
void SetKeepMiscRecomb(bool keep)
Definition: autodef.hpp:321
void SetProductFlag(CBioSource::EGenome product_flag)
Definition: autodef.hpp:192
void SetCustomFeatureClause(const string &custom_feature_clause)
Definition: autodef.hpp:341
void SetKeepRepeatRegion(bool keep)
Definition: autodef.hpp:315
void SetSuppressFeatureAltSplice(bool suppress_alt_splice)
Definition: autodef.hpp:234
CRef< CUser_object > GetOptionsObject() const
Definition: autodef.hpp:84
void SetGeneClusterOppStrand(bool gene_opp_strand)
Definition: autodef.hpp:227
void SetKeep3UTRs(bool keep)
Definition: autodef.hpp:282
void SetNuclearCopyFlag(CBioSource::EGenome product_flag)
Definition: autodef.hpp:199
CRef< feature::CFeatTree > m_Feat_Tree
Definition: autodef.hpp:173
void AddSources(CBioseq_Handle bh)
void SetFeatureListType(CAutoDefOptions::EFeatureListType feature_list_type)
Definition: autodef.hpp:178
bool Cancelled()
Definition: autodef.hpp:122
CAutoDefOptions m_Options
Definition: autodef.hpp:137
void SetKeepuORFs(bool keep)
Definition: autodef.hpp:296
vector< CSeq_entry_Handle > TSeqEntryHandleVector
Definition: autodef.hpp:133
void Cancel()
Definition: autodef.hpp:121
void SetMiscFeatRule(CAutoDefOptions::EMiscFeatRule misc_feat_rule)
Definition: autodef.hpp:185
void SetUseNcRNAComment(bool use_comment)
Definition: autodef.hpp:327
void SetAltSpliceFlag(bool alt_splice_flag)
Definition: autodef.hpp:213
void SuppressMobileElementAndInsertionSequenceSubfeatures(bool suppress)
Definition: autodef.hpp:241
set< CAutoDefAvailableModifier > TAvailableModifierSet
Definition: autodef.hpp:64
vector< unsigned int > TModifierIndexVector
Definition: autodef.hpp:132
bool m_Cancelled
Definition: autodef.hpp:140
void SetKeepPrecursorRNA(bool keep)
Definition: autodef.hpp:309
vector< CRef< CAutoDefModifierCombo > > TModifierComboVector
Definition: autodef.hpp:117
CBioseq_Handle –.
CFeat_CI –.
Definition: feat_ci.hpp:64
CRef –.
Definition: ncbiobj.hpp:618
CSeq_entry_Handle –.
Definition: set.hpp:45
Include a standard set of the NCBI C++ Toolkit most basic headers.
#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
EGenome
biological context
Definition: BioSource_.hpp:97
range(_Ty, _Ty) -> range< _Ty >
Modified on Wed Sep 04 15:01:38 2024 by modify_doxy.py rev. 669887