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

Go to the SVN repository for this file.

1 #ifndef OBJMGR_UTIL___AUTODEF_MOD_COMBO__HPP
2 #define OBJMGR_UTIL___AUTODEF_MOD_COMBO__HPP
3 
4 /* $Id: autodef_mod_combo.hpp 84631 2018-11-23 14:45:42Z bollin $
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 
52 
55 
56 
58  public IAutoDefCombo
59 {
60 public:
61 
65 
66  void InitFromOptions(const CAutoDefOptions& options);
67  void SetOptions(const CAutoDefOptions& options) { InitFromOptions(options); }
68  void InitOptions(CAutoDefOptions& options) const;
69 
70  unsigned int GetNumGroups();
71 
72  unsigned int GetNumSubSources();
73  CSubSource::ESubtype GetSubSource(unsigned int index);
74  unsigned int GetNumOrgMods();
75  COrgMod::ESubtype GetOrgMod(unsigned int index);
76 
77  bool HasSubSource(CSubSource::ESubtype st);
78  bool HasOrgMod(COrgMod::ESubtype st);
79 
80  void AddSource(const CBioSource& bs, const string& feature_clauses = "");
81 
82  void AddSubsource(CSubSource::ESubtype st, bool even_if_not_uniquifying = false);
83  void AddOrgMod(COrgMod::ESubtype st, bool even_if_not_uniquifying = false);
84  void GetAvailableModifiers (CAutoDefSourceDescription::TAvailableModifierVector &modifier_list);
85  bool HasTrickyHIV();
86  bool GetDefaultExcludeSp();
87 
88  void SetUseModifierLabels(bool use);
89  bool GetUseModifierLabels();
90  void SetMaxModifiers(int max_mods);
91  int GetMaxModifiers();
92  void SetAllowModAtEndOfTaxname(bool keep);
93  bool GetAllowModAtEndOfTaxname();
94  void SetKeepCountryText(bool keep);
95  bool GetKeepCountryText();
96  void SetExcludeSpOrgs(bool exclude);
97  bool GetExcludeSpOrgs ();
98  void SetExcludeCfOrgs(bool exclude);
99  bool GetExcludeCfOrgs ();
100  void SetExcludeNrOrgs(bool exclude);
101  bool GetExcludeNrOrgs ();
102  void SetExcludeAffOrgs(bool exclude);
103  bool GetExcludeAffOrgs ();
104  void SetKeepParen(bool keep);
105  bool GetKeepParen();
106  void SetKeepAfterSemicolon(bool keep);
107  bool GetKeepAfterSemicolon();
108  void SetHIVCloneIsolateRule(CAutoDefOptions::EHIVCloneIsolateRule rule_num);
109  CAutoDefOptions::EHIVCloneIsolateRule GetHIVCloneIsolateRule();
110 
111  string GetSourceDescriptionString(const CBioSource& bsrc);
112  static bool IsUsableInDefline(CSubSource::ESubtype subtype);
113  static bool IsUsableInDefline(COrgMod::ESubtype subtype);
114 
115  typedef vector<CSubSource::ESubtype> TSubSourceTypeVector;
116  typedef vector<COrgMod::ESubtype> TOrgModTypeVector;
117  typedef vector<CRef<CAutoDefSourceGroup> > TGroupListVector;
118 
119  const TGroupListVector& GetGroupList() const { return m_GroupList; }
120  const CAutoDefSourceDescription::TModifierVector& GetModifiers() const { return m_Modifiers; }
121 
122  unsigned int GetNumUnique () const;
123  unsigned int GetMaxInGroup () const;
124 
125  int Compare(const CAutoDefModifierCombo& other) const;
126  bool operator>(const CAutoDefModifierCombo& src) const
127  {
128  return Compare (src) > 0;
129  }
130 
131  bool operator<(const CAutoDefModifierCombo& src) const
132  {
133  return Compare (src) < 0;
134  }
135 
136  bool AddQual (bool IsOrgMod, int subtype, bool even_if_not_uniquifying = false);
137  bool RemoveQual (bool IsOrgMod, int subtype);
138 
139  vector<CRef<CAutoDefModifierCombo>> ExpandByAnyPresent();
140  bool AreFeatureClausesUnique();
141 
142  static bool IsModifierRequiredByDefault(bool is_orgmod, int subtype);
143  static bool IsModifierInString(const string& find_this, const string& find_in, bool ignore_at_end);
144 
145  typedef enum {
146  eNotInfluenza = 0,
150  eInfluenzaD
151  } EInfluenzaType;
152 
153  static EInfluenzaType GetInfluenzaType(const string& taxname);
154 
155 private:
160 
166  // NOTE - after the wxWidgets conversion is complete, need to add controls for the following three
167  // values to the autodef configuration dialog
171 
175 
176  string x_GetSubSourceLabel (CSubSource::ESubtype st);
177  string x_GetOrgModLabel(COrgMod::ESubtype st);
178  void x_CleanUpTaxName (string &tax_name);
179  bool x_AddSubsourceString (string &source_description, const CBioSource& bsrc, CSubSource::ESubtype st);
180  bool x_AddOrgModString (string &source_description, const CBioSource& bsrc, COrgMod::ESubtype st);
181 
182  static bool x_AddMinicircle(string& source_description, const CBioSource& bsrc);
183  static bool x_AddMinicircle(string& source_description, const string& note_text);
184 
185  typedef pair<COrgMod::ESubtype, bool> TExtraOrgMod;
187  typedef pair<CSubSource::ESubtype, bool> TExtraSubSrc;
189  static bool x_BioSourceHasSubSrc(const CBioSource& src, CSubSource::ESubtype subtype);
190  static bool x_BioSourceHasOrgMod(const CBioSource& src, COrgMod::ESubtype subtype);
191 
192  void x_AddHIVModifiers(TExtraOrgMods& extra_orgmods, TExtraSubSrcs& extra_subsrcs, const CBioSource& bsrc);
193  void x_AddInfluenzaModifiers(TExtraOrgMods& extra_orgmods, TExtraSubSrcs& extra_subsrcs, EInfluenzaType influenza_type);
194  static bool x_SpecialHandlingForInfluenza(EInfluenzaType influenza_type, CSubSource::ESubtype subtype);
195  static bool x_SpecialHandlingForInfluenza(EInfluenzaType influenza_type, COrgMod::ESubtype subtype);
196  void x_AddRequiredSubSourceModifiers(TExtraOrgMods& extra_orgmods, TExtraSubSrcs& extra_subsrcs, const CBioSource& bsrc);
197  void x_AddTypeStrainModifiers(TExtraOrgMods& extra_orgmods, TExtraSubSrcs& extra_subsrcs, const CBioSource& bsrc);
198  static bool x_HasTypeStrainComment(const CBioSource& bsrc);
199 };
200 
201 
202 inline
204 {
205  m_UseModifierLabels = use;
206 }
207 
208 
209 inline
211 {
212  return m_UseModifierLabels;
213 }
214 
215 
216 inline
218 {
219  m_MaxModifiers = max_mods;
220 }
221 
222 
223 inline
225 {
226  return m_MaxModifiers;
227 }
228 
229 
230 inline
232 {
234 }
235 
236 
237 inline
239 {
241 }
242 
243 
244 inline
246 {
247  m_KeepCountryText = keep;
248 }
249 
250 
251 inline
253 {
254  return m_KeepCountryText;
255 }
256 
257 
258 inline
260 {
261  m_ExcludeSpOrgs = exclude;
262 }
263 
264 
265 inline
267 {
268  return m_ExcludeSpOrgs;
269 }
270 
271 
272 inline
274 {
275  m_ExcludeCfOrgs = exclude;
276 }
277 
278 
279 inline
281 {
282  return m_ExcludeCfOrgs;
283 }
284 
285 
286 inline
288 {
289  m_ExcludeNrOrgs = exclude;
290 }
291 
292 
293 inline
295 {
296  return m_ExcludeNrOrgs;
297 }
298 
299 
300 inline
302 {
303  m_ExcludeAffOrgs = exclude;
304 }
305 
306 
307 inline
309 {
310  return m_ExcludeAffOrgs;
311 }
312 
313 
314 inline
316 {
317  m_KeepParen = keep;
318 }
319 
320 
321 inline
323 {
324  return m_KeepParen;
325 }
326 
327 
328 inline
330 {
331  m_KeepAfterSemicolon = keep;
332 }
333 
334 
335 inline
337 {
338  return m_KeepAfterSemicolon;
339 }
340 
341 
342 inline
344 {
345  m_HIVCloneIsolateRule = rule_num;
346 }
347 
348 
349 inline
351 {
352  return m_HIVCloneIsolateRule;
353 }
354 
355 
358 
359 #endif //OBJMGR_UTIL___AUTODEF_MOD_COMBO__HPP
vector< CSubSource::ESubtype > TSubSourceTypeVector
bool operator>(const CAutoDefModifierCombo &src) const
TGroupListVector m_GroupList
bool operator<(const CAutoDefModifierCombo &src) const
vector< CRef< CAutoDefSourceGroup > > TGroupListVector
void SetExcludeCfOrgs(bool exclude)
void SetHIVCloneIsolateRule(CAutoDefOptions::EHIVCloneIsolateRule rule_num)
void SetKeepAfterSemicolon(bool keep)
void SetExcludeNrOrgs(bool exclude)
TOrgModTypeVector m_OrgMods
map< CSubSource::ESubtype, bool > TExtraSubSrcs
void SetMaxModifiers(int max_mods)
void SetUseModifierLabels(bool use)
TSubSourceTypeVector m_SubSources
const TGroupListVector & GetGroupList() const
CAutoDefSourceDescription::TModifierVector m_Modifiers
void SetOptions(const CAutoDefOptions &options)
vector< COrgMod::ESubtype > TOrgModTypeVector
void SetExcludeSpOrgs(bool exclude)
pair< CSubSource::ESubtype, bool > TExtraSubSrc
void SetExcludeAffOrgs(bool exclude)
map< COrgMod::ESubtype, bool > TExtraOrgMods
CAutoDefOptions::EHIVCloneIsolateRule GetHIVCloneIsolateRule()
CAutoDefOptions::EHIVCloneIsolateRule m_HIVCloneIsolateRule
const CAutoDefSourceDescription::TModifierVector & GetModifiers() const
pair< COrgMod::ESubtype, bool > TExtraOrgMod
void SetAllowModAtEndOfTaxname(bool keep)
void SetKeepParen(bool keep)
void SetKeepCountryText(bool keep)
vector< CAutoDefSourceModifierInfo > TModifierVector
vector< CAutoDefAvailableModifier > TAvailableModifierVector
CObject –.
Definition: ncbiobj.hpp:180
Definition: map.hpp:338
Include a standard set of the NCBI C++ Toolkit most basic headers.
static void AddOrgMod(COrg_ref &org_ref, const Char *val, COrgMod::ESubtype type)
Definition: fta_src.cpp:1717
sequence::ECompare Compare(const CSeq_loc &loc1, const CSeq_loc &loc2, CScope *scope)
Returns the sequence::ECompare containment relationship between CSeq_locs.
#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
static CRef< CSeqdesc > AddSource(CRef< CSeq_entry > entry, string taxname)
Modified on Sat Jun 15 11:48:13 2024 by modify_doxy.py rev. 669887