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

Go to the SVN repository for this file.

1 #ifndef GUI_OBJUTILS___UTILS__HPP
2 #define GUI_OBJUTILS___UTILS__HPP
3 
4 /* $Id: utils.hpp 47780 2024-08-19 02:13:10Z asztalos $
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  * Authors: Mike DiCuccio, Liangshou Wu
30  *
31  * File Description:
32  * General utility classes for GUI projects.
33  */
34 
35 #include <corelib/ncbistd.hpp>
36 #include <corelib/ncbimisc.hpp>
37 #include <util/range_coll.hpp>
39 #include <objmgr/mapped_feat.hpp>
40 #include <gui/gui.hpp>
41 #include <objects/seq/Bioseq.hpp>
42 #include <objmgr/scope.hpp>
44 #include <objmgr/bioseq_handle.hpp>
45 #include <gui/objutils/objects.hpp>
48 
51 
52 
53 #include <limits>
54 
55 /** @addtogroup GUI_OBJUTILS
56  *
57  * @{
58  */
59 
60 
62  class document;
63  class node;
65 
67 
69  class CSeq_loc;
70  class CBioseq_Handle;
71  class CProjectItem;
72  class CGC_Assembly;
74 
75 static const string kCoverageStr = "coverage";
76 
78 {
79 public:
80  typedef list< CRef<CLinkedFeature> > TLinkedFeats;
81  CLinkedFeature(const objects::CMappedFeat& feat) : m_Feat(feat) {}
82 
83  const objects::CMappedFeat& GetMappedFeature() const { return m_Feat; }
84 
85  objects::CMappedFeat& GetMappedFeature(){ return m_Feat; }
86 
87  const objects::CSeq_feat& GetFeature() const { return m_Feat.GetOriginalFeature(); }
88 
89  const TLinkedFeats& GetChildren() const { return m_Children; }
90 
91  TLinkedFeats& GetChildren() { return m_Children; }
92 
94  { m_Children.push_back(CRef<CLinkedFeature>(feat)); }
95 
96  void AddChild(const objects::CMappedFeat& feat)
97  { m_Children.push_back(CRef<CLinkedFeature>(new CLinkedFeature(feat))); }
98 
99 private:
100  objects::CMappedFeat m_Feat;
102 };
103 
104 
105 /// Task clients implement this callback interface.
107 {
108 public:
109  virtual void SetTaskName (const string& name) = 0;
110  /// set total finished task number.
111  virtual void SetTaskCompleted (int completed) = 0;
112  /// set to add newly finished task number.
113  virtual void AddTaskCompleted (int delta) = 0;
114  virtual void SetTaskTotal (int total) = 0;
115  virtual bool StopRequested () const = 0;
117 };
118 
119 #define __GUI_SEQ_UTILS_DEFINED__
121 {
122 public:
123  typedef vector< CRef<objects::CSeq_loc> > TLocVec;
124 
125  typedef vector<TEntrezId> TEntrezIds;
126 
127  typedef vector<TGi> TGis;
128  typedef vector<objects::CSeq_id_Handle> TSeqIdHandles;
129 
130  /// flags for classifying annotation names.
132  {
133  eAnnot_Unnamed, ///< unnamed annotation
134  eAnnot_Named, ///< all named annotations
135  eAnnot_All, ///< all annotations
136  eAnnot_Other ///< any given named annots
137  };
138 
140 
141  static TAnnotNameType NameTypeStrToValue(const string& type);
142  static const string& NameTypeValueToStr(TAnnotNameType type);
143 
144  /// flags controlling feature retrieval
145  enum {
146  fFeature_LinkFeatures = 0x1,
147  fFeature_Default = 0
148  };
149  typedef int TFeatureFlags;
150 
151  /// flags controlling use of annotation selectors
152  enum {
153  //< don't apply any settings that affect the retrieval or presentation
154  //< of named annotation sets
155  fAnnot_UnsetNamed = 0x01,
156 
157  //< don't apply any settings that affect the depth of annotation retrieval
158  fAnnot_UnsetDepth = 0x02
159  };
160  typedef int TAnnotFlags;
161 
164  typedef pair<TProdInterval, TGenomicInterval> TMappedInt;
165  typedef vector<TMappedInt> TMappingInfo;
166 
167  // set of assembly ids
168  typedef set<string> TIds;
169  // set of assembly accessions
171 
172  /// request an annotation selector for a given type
173  static objects::SAnnotSelector
174  GetAnnotSelector(TAnnotFlags flags = 0);
175 
176  static objects::SAnnotSelector
177  GetAnnotSelector(objects::SAnnotSelector::TAnnotType choice,
178  TAnnotFlags flags = 0);
179 
180  static objects::SAnnotSelector
181  GetAnnotSelector(objects::SAnnotSelector::TFeatType,
182  TAnnotFlags flags = 0);
183 
184  static objects::SAnnotSelector
185  GetAnnotSelector(objects::SAnnotSelector::TFeatSubtype,
186  TAnnotFlags flags = 0);
187 
188  /// create a annotation selector for collecting annotation names only.
189  /// @param annots
190  static objects::SAnnotSelector
191  GetAnnotSelector(const vector<string>& annots);
192 
193  static objects::SAnnotSelector
194  GetAnnotSelector(const vector<string>& annots,
195  bool adaptive, int depth);
196 
197  /// help function for setting up an annotation.
198  static void SetAnnot(objects::SAnnotSelector& sel, const string& annot);
199 
200  /// helper functions to read selector-related tune-up info (mostly segment limits) from registry:
201  static CRegistryReadView GetSelectorRegistry();
202  static int GetMaxSearchSegments(const CRegistryReadView& view);
203  static objects::SAnnotSelector::EMaxSearchSegmentsAction GetMaxSearchSegmentsAction(const CRegistryReadView& view);
204  static int GetMaxSearchTime(const CRegistryReadView& view);
205 
206  /// check actual number of segments against max and perform the action if the actual number is more than max
207  /// returns true if actual is more than max
208  static bool CheckMaxSearchSegments(int actual, int max, objects::SAnnotSelector::EMaxSearchSegmentsAction action);
209 
210  /// help function for setting selector resolve depth.
211  /// @param sel target annotation selector
212  /// @param adaptive adaptive selector if true, otherwise, exact selector
213  /// @param depth resolve depth. For adaptive selector, it resolves all
214  /// if depth < 0, otherwie resolve up to the specified depth.
215  /// For exact selector, depth is the exact the resovle depth (>=0).
216  static void SetResolveDepth(objects::SAnnotSelector& sel,
217  bool adaptive, int depth = -1);
218 
219  typedef int TFeatLinkingMode;
220 
221  /// Link features into a hierarchical list. This function will transform a
222  /// linear, feature-order-sorted list of CLinkedFeature into a
223  /// hierarchically arranged list in which genes are linked to mRNAs, mRNAs
224  /// to CDSs, etc.
225  /// @param mode 0:eFeatId_ignore, 1:eFeatId_by_type, 2:eFeatId_always
226  static bool LinkFeatures(CLinkedFeature::TLinkedFeats& feats,
227  TFeatLinkingMode mode = 1, // TFeatLinkingMode
229 
230  /// remap a location to a parent location. The child location is split
231  /// such that all of its relative positions will map correctly to the
232  /// parent location's positions
234  RemapChildToParent(const objects::CSeq_loc& parent,
235  const objects::CSeq_loc& child,
236  objects::CScope* scope = NULL);
237 
238  /// check to see if two seq-ids are identical. If provided with a scope,
239  /// this function will use the synonyms available through a scope to check
240  /// for identicality. Note that this may require network access, and may
241  /// be slow.
242  static bool Match(const objects::CSeq_id& id1,
243  const objects::CSeq_id& id2,
244  objects::CScope* scope = NULL);
245 
246  static bool Match(const objects::CSeq_id_Handle& id1,
247  const objects::CSeq_id_Handle& id2,
248  objects::CScope* scope = NULL);
249 
250  // create a CSeq_loc from the given CSeq_id and a collection of ranges
252  CreateSeq_loc(const objects::CSeq_id& id,
253  const CRangeCollection<TSeqPos>& ranges);
254 
255  // extracts from the given map all segments corresponding to the given id
256  // and puts them to the "ranges" collection. Retuns false if id is not found
257  // in the map.
258  static bool GetRangeCollection(const objects::CSeq_id& id,
259  const objects::CHandleRangeMap& map,
260  CRangeCollection<TSeqPos>& ranges);
261 
262  /// Construct a bioseq to fit a given location. If the location is of
263  /// type 'whole', then a duplicate of the original will be returned;
264  /// otherwise, a new bioseq will be constructed to cover just the
265  /// region indicated in the seq-loc
266  static objects::CBioseq* SeqLocToBioseq(objects::CScope& scope,
267  const objects::CSeq_loc& loc);
268 
269  /// Create a new seq-loc with a unique seq-id from a "mixed" loc.
270  /// "Mixed" means mixed seq-ids, e.g. a seq-loc with multi seq-ids.
272  MixLocToLoc(const objects::CSeq_loc& mix_loc,
273  const objects::CBioseq_Handle& handle);
274 
275  static string GetAnnotName(const objects::CSeq_annot_Handle& annot_handle);
276 
277  static string GetAnnotName(const objects::CSeq_annot& annot);
278 
279  static string GetAnnotComment(const objects::CSeq_annot_Handle& annot_handle);
280 
281  static string GetAnnotComment(const objects::CSeq_annot& annot);
282  static CConstRef<objects::CUser_field> GetAnnotUserField(const objects::CSeq_annot& annot, const string& type, const string& label);
283 
284  /// check if a given annotation is a named annotation accession[.version][#number]
285  /// when isSctrict == false, includes extended NAs since it is considered no harm to relax the rules for all NAs
286  static bool IsNAA(const string& annot, bool isStrict = false);
287  /// check if a given annotation is a named annotation name with '.' replaced with '_'.
288  static bool IsNAA_Name(const string& annot);
289 
290  /// check if a given annotation is an extended NAA (named accession[.version][#number], as used in e.g. SNP2)
291  /// when isSctrict == false, regular NAs are now included into this as well i.e. the result of calling this is now the same as IsNAA
292  static bool IsExtendedNAA(const string& annot, bool isStrict = false);
293 
294  /// check if a given annotation is an extended NAA name with '.' replaced with '_'.
295  static bool IsExtendedNAA_Name(const string& annot);
296 
297  /// check if a given annotation is AlignDb (potentially suffixed with batch identication string after a '#')
298  static bool IsAlignDb(const string& annot);
299  /// get a batch string from AlignDb annotation suffixed with batch identication string after a '#'
300  static string GetAlignDbBatch(const string& annot);
301  /// get a is_source_assembly_query string from AlignDb annotation suffixed after a second '#'
302  static string GetAlignDbIsQuery(const string& annot);
303 
304  /// create an annotation name for a remote file pipeline, appending sSuffix
305  static string MakeRmtAnnotName(const string& sSuffix);
306  /// check if a given annotation was created by a remote file pipeline
307  static bool isRmtAnnotName(const string& sAnnotname);
308 
309  /// check if a file type is one of remote file types
310  static bool isRmtPipelineFileType(const string& sFileType);
311 
312  /// check if a given annotation is a unnamed annotation.
313  static bool IsUnnamed(const string& annot);
314 
315  /// Get the commonly used symbol representing a unnnamed annotation.
316  static const string& GetUnnamedAnnot();
317 
318  /// Check if string starts with ("SRA", "SRR", "DRR", "ERR")
319  static bool IsVDBAccession(const string& acc);
320 
321  static bool IsPseudoFeature(const objects::CSeq_feat& feat);
322  static bool IsPartialFeature(const objects::CSeq_feat& feat);
323  static bool IsPartialStart(const objects::CSeq_loc& loc);
324  static bool IsPartialStop(const objects::CSeq_loc& loc);
325  static bool IsSameStrands(const objects::CSeq_loc& loc);
326  static bool IsException(const objects::CSeq_feat& feat);
327  static string GetNcbiBaseUrl();
328 
329  /// help methods for creating HTML text
330  static string CreateTableStart();
331  static string CreateTableEnd();
332  static string CreateTableRow(const string& tag = "", const string& value = "");
333  static string CreateSectionRow(const string& tag);
334  static string CreateLinkRow(const string& tag,
335  const string& label, const string& url);
336 
337  /// check that a given accession is either local or unrecognizable
338  /// this can be important to avoid unnecessary calls to NCBI services
339  static bool isQuasiLocal(const objects::CBioseq_Handle& handle);
340 
341  /// Retrieve mapped-up sequences.
342  /// Help method for retrieving upper level sequences for a given gi.
343  /// @param gi: the source sequence gi
344  static TLocVec GetGiPlacements(TGi gi, int time_out_sec = 5, THTTP_Flags flags = fHTTP_AutoReconnect);
345 
346  /// check that a given seq-id can potentially have placements (to weed out cases like local ids)
347  static bool CanHavePlacements(const objects::CSeq_id& seqid);
348  /// Retrieve mapped-up sequences.
349  /// Help method for retrieving upper level sequences for a given accession.
350  static TLocVec GetAccessionPlacements(const objects::CSeq_id &id, objects::CScope &scope, int time_out_sec = 1, THTTP_Flags flags = fHTTP_AutoReconnect);
351  /// same, with a timeout in milliseconds
352  static TLocVec GetAccessionPlacementsMsec(const objects::CSeq_id &id, objects::CScope &scope, unsigned long time_out_msec = 1000, THTTP_Flags flags = fHTTP_AutoReconnect);
353 
354  /// Retrieve locations on mapped-up sequences
355  /// Help method for retrieving upper level sequences for a given loc
356  /// @param loc
357  /// source location (expected to be a pnt or int)
358  /// @return
359  /// list of locations represented as intervals
360  static TLocVec GetLocPlacements(const objects::CSeq_loc& loc, int time_out_sec = 1);
361 
362  /// Convert a range string to a range.
363  /// @return flag indicating if the input range string is valid
364  static bool StringToRange(const string& range_str, long& from, long& to);
365 
366  /// try to get a chromosome from a GI
367  ///
368  /// @param gi
369  /// GI to try to match to a chromosome
370  /// @return
371  /// - if the given GI is a chromosome GI, then a string containing the chr number, or X/Y
372  /// - empty string if the GI is not a chromosome
373  static string GetChrGI(TGi gi);
374 
375  /// same as GetChrGI(), but takes an string with id (that must correspond to some GI)
376  static string GetChrId(const string& id_str, objects::CScope& scope);
377 
378  /// get all assembly ids associated with a gi where this gi is a chromosome
379  /// @note transplanted from w_loaders/assm_info.cpp because this is needed for GetChrGI()
380  ///
381  /// @param gi
382  /// GI to try to match to a chromosome in any assembly
383  /// @param gc_ids
384  /// - will be reset and filled with list of assemblies where the given GI is a chromosome
385  /// - will become empty if there is no assembly where this GI is a chromosome
386  static void GetAssmIds_GIChr(TEntrezIds& gc_ids, TGi gi);
387 
388  /// get all assembly accessions corresponding to a GI
389  static void GetAssmAccs_Gi(TAccs& accs, TGi gi);
390 
391  /// get all assembly ids associated with a gi.
392  static void GetAssmIds_GI(TEntrezIds& gc_ids, TGi gi);
393 
394  // uses a GenColl assembly to find out whether a given sequence is listed as top level in that assembly
395  // if scope is given, will consider synonyms for seq-ids found in the assembly; this may give more precise
396  // results at cost of some time
397  static bool isTopLevel(const objects::CSeq_id& seq_id, const string& assm_acc, objects::CScope* scope = NULL);
398  /// Helper function to generate mapping info between the
399  /// specified product sequence and genomic sequence using
400  /// the anotated alignment.
401  static TMappingInfo GetRnaMappingInfo(const objects::CSeq_loc& feat_loc,
402  const objects::CMappedFeat& feat,
403  const objects::CBioseq_Handle& handle);
404 
405 
406  /// Derive the CDS feature mapping information based on
407  /// its parent RNA feature mapping info.
408  static TMappingInfo GetCdsMappingInfoFromRna(
409  const TMappingInfo& rna_mapping_info,
410  const objects::CSeq_feat& rna_feat,
411  const objects::CMappedFeat& mapped_cds_feat,
412  const objects::CSeq_loc& feat_loc,
413  objects::CScope& scope,
414  const int feat_offset = 0);
415 
416  // Assumes that the feature and the product have exactly the same number of intervals, and
417  // each has the same length
418  // feat_offset is used for CDS features to correclty map CDS that have cds_frame > 0
419  static TMappingInfo GetMappingInfoFromLocation(
420  const objects::CSeq_loc &feat_loc,
421  const objects::CSeq_id &product_id,
422  const int feat_offset = 0);
423 
424  // Gets a feature location on the master sequence
425  static CConstRef<objects::CSeq_loc> GetFeatLocation(const objects::CSeq_feat& feat, const objects::CBioseq_Handle& bsh);
426 
427  // Finds the parent RNA feature of a given CDS feature
428  static objects::CMappedFeat GetMrnaForCds(const objects::CMappedFeat &cds_feat, const string &named_acc = string());
429 
430  // Calculates the mapping information of a given RNA/CDS/V Segment feature
431  static void GetMappingInfo(const objects::CMappedFeat &mapped_feat, const objects::CBioseq_Handle& bsh, TMappingInfo &info, const string &annot = string());
432 
433  /// ad-hoc GI extraction (for misformed seq-id strings like: "gi|55823257|ref|YP_141698.1"
434  /// (data coming from some other ad-hoc scripts)
435  ///
436  /// @param sid - input string
437  /// @param gi_str - output string ("gi|123")
438  /// @return true if input matches the profile
439  ///
440  static bool GetGIString(const string& sid, string* gi_str);
441 
442  /// Convert a list of ids into a comma-delimited string
443  template<class T> static string CreateIdStr(const vector<T>& uids);
444 
445  /// Queries elink.fcgi with a vector of uids/seq-ids (seq-ids preferred for future compatibility) and returns a vector of uids, filtered by the xpath query
446  /// note that return is still uids only since at this point trying to support seq-ids in return is fruitless
447 
448  static void ELinkQuery(const string& db_from, const string& db_to, const TEntrezIds& uids_from, TEntrezIds& uids_to, const string& cmd = "neighbor", const string& xpath = "//Link/Id/text()");
449 
450  static void ELinkQuery(const string &db_from, const string &db_to, const TSeqIdHandles& uids_from, TEntrezIds& uids_to, const string &cmd = "neighbor", const string &xpath = "//Link/Id/text()");
451 
452  /// Queries elink.fcgi and returns an xml document
453  static void ELinkQuery(const string &db_from, const string &db_to, const TEntrezIds &uids_from, xml::document& linkset, const string &cmd = "neighbor");
454 
455  static void ELinkQuery(const string &db_from, const string &db_to, const TSeqIdHandles& uids_from, xml::document& linkset, const string &cmd = "neighbor");
456 
457 
458  /// Queries esearch.fcgi and returns a vector of uids/seq-ids (seq-ids preferred for future compatibility), filtered by the xpath query
459  static void ESearchQuery(const string &db, const string &term, TEntrezIds&uids, size_t &count, const int ret_max, const string &xpath = "//IdList/Id/text()");
460 
461  /// Queries esearch.fcgi and returns a vector of uids, filtered by the xpath query
462  static void ESearchQuery(const string &db, const string &term, const string &web_env, const string &query_key, TEntrezIds&uids, size_t &count, int retstart = 0, const string &xpath = "//IdList/Id/text()");
463 
464  /// Queries esearch.fcgi and returns an xml document
465  static void ESearchQuery(const string &db, const string &term, const string &web_env, const string &query_key, xml::document &searchset, int retstart = 0);
466 
467  /// Returns the contents of the specified child node
468  static std::string GetXmlChildNodeValue(const xml::node& parent, const std::string& name);
469 
470  /// Returns Bioseq's Genetic Code
471  static int GetGenCode(const objects::CBioseq_Handle& handle);
472 
473  static void CreateCoverageAnnotName(const string& annot_name, string& coverage_annot);
474  static bool IsCoverageAnnotName(const string& annot_name);
475 
476  // parse a ranges string into TRanges
477  // string format:
478  // from-to[,from-to...] comma-delimited list of position ranges, zero-based, end-inclusive
479  typedef vector<TSeqRange> TRanges;
480 
481  static void ParseRanges(const string& sRanges, TRanges& ranges);
482 
483  /// flags controlling BLAST track default visibility
485  fBlastTrackShowFlag_Original = (1 << 1),
486  fBlastTrackShowFlag_Cleaned = (1 << 2)
487  };
488  typedef int TBlastTrackShowFlags;
489 
490  // encode "shown" flag inside an annot
491  static void SetAnnotShown(objects::CSeq_annot& annot, bool isShown);
492 
493  // get "shown" flag from an annot
494  // absence of encoded flag is treated as true/shown
495  static bool GetAnnotShown(const objects::CSeq_annot& annot);
496 
497  static CRef<objects::CSeq_id> MapStringId(const string& str, objects::IIdMapper *mapper);
498 
499  static bool IsCrossOrigin(const objects::CSeq_loc& loc);
500  static bool IsCrossOrigin(const objects::CSeq_align& align);
501 
502 private:
503  /// get all assembly ids associated with a gi.
504  static void x_GetAssmIds_GI(string& gc_ids, TGi gi);
505 
506 };
507 
508 
509 /// Adapter class to convert CGencollIdMapper to IIdMapper interface
510 class NCBI_GUIOBJUTILS_EXPORT CGencollIdMapperAdapter : public objects::IIdMapper
511 {
512 public:
514  virtual objects::CSeq_id_Handle Map(const objects::CSeq_id_Handle& idh) override;
515  virtual CRef<objects::CSeq_loc> Map(const objects::CSeq_loc& loc) override;
516  virtual void MapObject(CSerialObject& obj) override;
517 
518  static IIdMapper* GetIdMapper(CRef<objects::CGC_Assembly> assm);
519 
520 private:
523 };
524 
525 
526 
527 inline
528 bool CSeqUtils::IsUnnamed(const string& annot)
529 {
530  return annot == GetUnnamedAnnot();
531 }
532 
533 inline
535 {
536  static string kUnnamedAnnot = "Unnamed";
537  return kUnnamedAnnot;
538 }
539 
540 inline
541 void CSeqUtils::CreateCoverageAnnotName(const string& annot_name, string& coverage_annot)
542 {
543  coverage_annot = annot_name;
544  coverage_annot += " ";
545  coverage_annot += kCoverageStr;
546 }
547 
548 inline
549 bool CSeqUtils::IsCoverageAnnotName(const string& annot_name)
550 {
551  return NStr::EndsWith(annot_name, kCoverageStr, NStr::eNocase);
552 }
553 
554 
555 template<class T> string CSeqUtils::CreateIdStr(const vector<T>& uids)
556 {
557  stringstream idstrm;
558  size_t count = uids.size();
559  if (count) {
560  idstrm << uids[0];
561  for (size_t i = 1; i < count; ++i)
562  idstrm << ',' << uids[i];
563  }
564  return idstrm.str();
565 }
566 
568 NCBI_GUIOBJUTILS_EXPORT objects::CBioseq_Handle GetBioseqForSeqFeat(const objects::CSeq_feat& f, objects::CScope& scope);
569 NCBI_GUIOBJUTILS_EXPORT objects::CSeq_feat_Handle GetSeqFeatHandleForBadLocFeature(const objects::CSeq_feat& feat, objects::CScope& scope);
570 NCBI_GUIOBJUTILS_EXPORT objects::CSeq_entry_Handle GetSeqEntryForPubdesc (CRef<objects::CScope> scope, const objects::CPubdesc& pubdesc);
572 NCBI_GUIOBJUTILS_EXPORT vector<const objects::CFeatListItem *> GetSortedFeatList(objects::CSeq_entry_Handle seh, size_t max = numeric_limits<size_t>::max());
573 
575 
576 
577 /* @} */
578 
579 #endif /// GUI_OBJUTILS___UTILS__HPP
#define static
CBioseq_Handle –.
Adapter class to convert CGencollIdMapper to IIdMapper interface.
Definition: utils.hpp:511
CObject –.
Definition: ncbiobj.hpp:180
CRef –.
Definition: ncbiobj.hpp:618
class CRegistryReadView provides a nested hierarchical view at a particular key.
Definition: reg_view.hpp:58
Base class for all serializable objects.
Definition: serialbase.hpp:150
General IdMapper interface.
Definition: iidmapper.hpp:48
Task clients implement this callback interface.
Definition: utils.hpp:107
Definition: map.hpp:338
The xml::document class is used to hold the XML tree and various bits of information about it.
Definition: document.hpp:80
The xml::node class is used to hold information about one XML node.
Definition: node.hpp:106
Include a standard set of the NCBI C++ Toolkit most basic headers.
static uch flags
static unsigned char depth[2 *(256+1+29)+1]
static CS_COMMAND * cmd
Definition: ct_dynamic.c:26
static const char * str(char *buf, int n)
Definition: stats.c:84
static FILE * f
Definition: readconf.c:23
TSignedSeqRange StringToRange(const string &s)
CRange< Position > Map(const CRange< Position > &target, const CRange< Position > &range)
Definition: blast_aux.cpp:826
string
Definition: cgiapp.hpp:690
#define NULL
Definition: ncbistd.hpp:225
unsigned int THTTP_Flags
Bitwise OR of EHTTP_Flag.
@ fHTTP_AutoReconnect
See HTTP_CreateConnectorEx()
virtual void SetTaskName(const string &name)=0
virtual void SetTaskCompleted(int completed)=0
set total finished task number.
void AddChild(const objects::CMappedFeat &feat)
Definition: utils.hpp:96
static const string kCoverageStr
Definition: utils.hpp:75
const objects::CSeq_feat & GetFeature() const
Definition: utils.hpp:87
int TFeatLinkingMode
Definition: utils.hpp:219
CLinkedFeature(const objects::CMappedFeat &feat)
Definition: utils.hpp:81
static bool Match(const objects::CSeq_id_Handle &id1, const objects::CSeq_id_Handle &id2, objects::CScope *scope=NULL)
list< CRef< CLinkedFeature > > TLinkedFeats
Definition: utils.hpp:80
vector< CRef< objects::CSeq_loc > > TLocVec
Definition: utils.hpp:123
TLinkedFeats & GetChildren()
Definition: utils.hpp:91
static objects::SAnnotSelector GetAnnotSelector(objects::SAnnotSelector::TFeatSubtype, TAnnotFlags flags=0)
static bool IsCoverageAnnotName(const string &annot_name)
Definition: utils.hpp:549
objects::CBioseq_Handle GetBioseqForSeqFeat(const objects::CSeq_feat &f, objects::CScope &scope)
static bool IsCrossOrigin(const objects::CSeq_loc &loc)
static string GetAnnotName(const objects::CSeq_annot &annot)
static objects::SAnnotSelector GetAnnotSelector(objects::SAnnotSelector::TFeatType, TAnnotFlags flags=0)
static bool IsCrossOrigin(const objects::CSeq_align &align)
pair< TProdInterval, TGenomicInterval > TMappedInt
Definition: utils.hpp:164
objects::CMappedFeat & GetMappedFeature()
Definition: utils.hpp:85
vector< TEntrezId > TEntrezIds
Definition: utils.hpp:125
EBlastTrackShowFlags
flags controlling BLAST track default visibility
Definition: utils.hpp:484
static string GetAnnotComment(const objects::CSeq_annot &annot)
vector< objects::CSeq_id_Handle > TSeqIdHandles
Definition: utils.hpp:128
static string GetAnnotName(const objects::CSeq_annot_Handle &annot_handle)
static void CreateCoverageAnnotName(const string &annot_name, string &coverage_annot)
Definition: utils.hpp:541
CGencollIdMapper::SIdSpec m_Spec
Definition: utils.hpp:522
virtual ~ISeqTaskProgressCallback()
Definition: utils.hpp:116
set< string > TAccs
Definition: utils.hpp:170
objects::CSeq_entry_Handle GetTopSeqEntryFromScopedObject(SConstScopedObject &obj)
Definition: utils.cpp:2596
EAnnotationNameType TAnnotNameType
Definition: utils.hpp:139
static const string & GetUnnamedAnnot()
Get the commonly used symbol representing a unnnamed annotation.
Definition: utils.hpp:534
void AddChild(CLinkedFeature *feat)
Definition: utils.hpp:93
vector< const objects::CFeatListItem * > GetSortedFeatList(objects::CSeq_entry_Handle seh, size_t max=numeric_limits< size_t >::max())
virtual void SetTaskTotal(int total)=0
static string CreateIdStr(const vector< T > &uids)
Convert a list of ids into a comma-delimited string.
Definition: utils.hpp:555
static bool IsUnnamed(const string &annot)
check if a given annotation is a unnamed annotation.
Definition: utils.hpp:528
static objects::SAnnotSelector GetAnnotSelector(objects::SAnnotSelector::TAnnotType choice, TAnnotFlags flags=0)
static string GetAnnotComment(const objects::CSeq_annot_Handle &annot_handle)
CConstRef< objects::CBioseq > GetBioseqForSeqdesc(CRef< objects::CScope > scope, const objects::CSeqdesc &seq_desc)
set< string > TIds
Definition: utils.hpp:168
int TBlastTrackShowFlags
Definition: utils.hpp:488
int TFeatureFlags
Definition: utils.hpp:149
CRef< objects::CSeq_interval > TGenomicInterval
Definition: utils.hpp:163
vector< TSeqRange > TRanges
Definition: utils.hpp:479
CRef< objects::CSeq_interval > TProdInterval
Definition: utils.hpp:162
CRef< CGencollIdMapper > m_Mapper
Definition: utils.hpp:521
static void x_GetAssmIds_GI(string &gc_ids, TGi gi)
get all assembly ids associated with a gi.
static bool Match(const objects::CSeq_id &id1, const objects::CSeq_id &id2, objects::CScope *scope=NULL)
check to see if two seq-ids are identical.
objects::CSeq_feat_Handle GetSeqFeatHandleForBadLocFeature(const objects::CSeq_feat &feat, objects::CScope &scope)
TLinkedFeats m_Children
Definition: utils.hpp:101
virtual bool StopRequested() const =0
EAnnotationNameType
flags for classifying annotation names.
Definition: utils.hpp:132
vector< TGi > TGis
Definition: utils.hpp:127
vector< TMappedInt > TMappingInfo
Definition: utils.hpp:165
const TLinkedFeats & GetChildren() const
Definition: utils.hpp:89
objects::CMappedFeat m_Feat
Definition: utils.hpp:100
virtual void AddTaskCompleted(int delta)=0
set to add newly finished task number.
int TAnnotFlags
Definition: utils.hpp:160
const objects::CMappedFeat & GetMappedFeature() const
Definition: utils.hpp:83
objects::CSeq_entry_Handle GetSeqEntryForPubdesc(CRef< objects::CScope > scope, const objects::CPubdesc &pubdesc)
@ eAnnot_Unnamed
unnamed annotation
Definition: utils.hpp:133
@ eAnnot_All
all annotations
Definition: utils.hpp:135
@ eAnnot_Named
all named annotations
Definition: utils.hpp:134
#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
static bool EndsWith(const CTempString str, const CTempString end, ECase use_case=eCase)
Check if a string ends with a specified suffix value.
Definition: ncbistr.hpp:5424
@ eNocase
Case insensitive compare.
Definition: ncbistr.hpp:1206
#define NCBI_GUIOBJUTILS_EXPORT
Definition: gui_export.h:512
static const char label[]
CRef< objects::CBioseq > SeqLocToBioseq(const objects::CSeq_loc &loc, objects::CScope &scope)
Definition: util.cpp:45
int i
static MDB_envinfo info
Definition: mdb_load.c:37
mdb_mode_t mode
Definition: lmdb++.h:38
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
XML library namespace.
Definition: attributes.hpp:57
const char * tag
Miscellaneous common-use basic types and functionality.
T max(T x_, T y_)
Int4 delta(size_t dimension_, const Int4 *score_)
#define count
Definition: type.c:6
#define const
Definition: zconf.h:232
Modified on Fri Sep 20 14:57:10 2024 by modify_doxy.py rev. 669887