NCBI C++ ToolKit
Classes | Typedefs | Functions | Variables
utils.cpp File Reference
#include <ncbi_pch.hpp>
#include <corelib/ncbiapp.hpp>
#include <misc/xmlwrapp/xmlwrapp.hpp>
#include <gui/objutils/utils.hpp>
#include <gui/objutils/tool_tip_info.hpp>
#include <gui/objutils/obj_convert.hpp>
#include <gui/objutils/gencoll_svc.hpp>
#include <gui/objutils/gui_eutils_client.hpp>
#include <objects/seqfeat/Feat_id.hpp>
#include <objects/seqfeat/SeqFeatXref.hpp>
#include <objects/general/Object_id.hpp>
#include <objects/seq/Seq_descr.hpp>
#include <objects/seq/seqport_util.hpp>
#include <objects/seq/Annot_descr.hpp>
#include <objects/seq/Annotdesc.hpp>
#include <objects/seq/Pubdesc.hpp>
#include <objects/seqset/Seq_entry.hpp>
#include <objects/seqfeat/RNA_ref.hpp>
#include <objects/seqalign/Seq_align_set.hpp>
#include <objects/seqalign/Std_seg.hpp>
#include <objects/entrezgene/Entrezgene.hpp>
#include <objects/entrezgene/Entrezgene_Set.hpp>
#include <objects/submit/Seq_submit.hpp>
#include <objects/biotree/BioTreeContainer.hpp>
#include <objects/genomecoll/GC_Replicon.hpp>
#include <objects/gbproj/ProjectItem.hpp>
#include <objmgr/feat_ci.hpp>
#include <objmgr/util/sequence.hpp>
#include <objmgr/util/feature.hpp>
#include <objmgr/impl/handle_range_map.hpp>
#include <objmgr/impl/synonyms.hpp>
#include <objmgr/seq_vector.hpp>
#include <objmgr/bioseq_ci.hpp>
#include <objmgr/seq_entry_ci.hpp>
#include <objmgr/align_ci.hpp>
#include <objmgr/seqdesc_ci.hpp>
#include <serial/iterator.hpp>
#include <connect/ncbi_types.h>
#include <connect/ncbi_conn_stream.hpp>
#include <util/line_reader.hpp>
#include <algorithm>
#include <objtools/alnmgr/aln_generators.hpp>
#include <objtools/edit/apply_object.hpp>
+ Include dependency graph for utils.cpp:

Go to the source code of this file.

Go to the SVN repository for this file.

Classes

struct  SFeatLengthPredicate
 
struct  SFeatSortPredicate
 
struct  SPairBy1stLess< T, U >
 

Typedefs

typedef map< string, boolTTopLevels
 
typedef vector< CConstRef< CSeq_id > > TAssemblySeqIds
 
typedef SStaticPair< const char *, CSeqUtils::TAnnotNameTypeTNameTypeStr
 
typedef CStaticArrayMap< string, CSeqUtils::TAnnotNameTypeTNameTypeMap
 
typedef vector< CRef< CSeq_loc > > TMappedLocs
 For CDS and RNA feature mapping information. More...
 

Functions

 USING_SCOPE (objects)
 
 DEFINE_STATIC_ARRAY_MAP (TNameTypeMap, sm_NameTypeMap, s_NameTypeStrs)
 
static bool s_IsNAA (const string &annot, char div)
 
static bool s_IsExtendedNAA (const string &sAnnotName, char div, bool isStrict)
 
static CSeqUtils::TLocVec s_GetAlnMapplingLocs (const CSeq_align_set &align_set, TGi gi)
 
static const stringGetLinksURL ()
 
static const TAssemblySeqIdss_GetAssemblySeqIds (const string &assm_acc)
 
template<class T1 , class T2 >
static void s_ELinkQuery (const string &db_from, const string &db_to, const vector< T1 > &uids_from, vector< T2 > &uids_to, const string &cmd, const string &xpath)
 
template<class T >
static void s_ELinkQuery (const string &db_from, const string &db_to, const vector< T > &uids_from, xml::document &linkset, const string &cmd)
 
template<class T >
static void s_ESearchQuery (const string &db, const string &term, vector< T > &uids, size_t &count, const int ret_max, const string &xpath)
 
template<class T >
static void s_ESearchQuery (const string &db, const string &term, const string &web_env, const string &query_key, vector< T > &uids, size_t &count, int retstart, const string &xpath)
 
static TMappedLocs s_GetRnaMappingLocs (const CSeq_loc &feat_loc, const CMappedFeat &feat, const CBioseq_Handle &handle)
 
static void s_CreateMappingInfo (const CSeq_loc &prod_loc, const CSeq_loc &gen_loc, CSeqUtils::TMappingInfo &info)
 Helper function to convert two mapped locations into an interval-to-interval mapping structure. More...
 
static void s_AdjustToAnnotatedCDS (const CMappedFeat &mapped_cds_feat, CScope &scope, CSeqUtils::TMappingInfo &cds_map_info)
 
CConstRef< CBioseqGetBioseqForSeqdesc (CRef< CScope > scope, const CSeqdesc &seq_desc)
 
CSeq_entry_Handle GetSeqEntryForPubdesc (CRef< CScope > scope, const CPubdesc &pubdesc)
 
CSeq_entry_Handle GetDefaultTopLevelSeqEntry (CScope &scope)
 
CSeq_feat_Handle GetSeqFeatHandleForBadLocFeature (const CSeq_feat &feat, CScope &scope)
 
CBioseq_Handle GetBioseqForSeqFeat (const CSeq_feat &f, CScope &scope)
 
CSeq_entry_Handle GetTopSeqEntryFromScopedObject (SConstScopedObject &obj)
 
static bool s_CompareDescriptions (const CFeatListItem *p1, const CFeatListItem *p2)
 
vector< const CFeatListItem * > GetSortedFeatList (CSeq_entry_Handle seh, size_t max)
 

Variables

static TTopLevels m_TopLevels
 
static CRWLock m_TopLevelsLock
 
static CRWLock m_AssemblySeqIdLock
 
static map< string, TAssemblySeqIdss_AssemblySeqIdCache
 
static const TNameTypeStr s_NameTypeStrs []
 
static const char * kLinksUrlDefault
 
static const string kTaxDb = "taxonomy"
 
static const string kNucDb = "nucleotide"
 
static const string kAssmDb = "assembly"
 
static const int kRetMax = 5000
 

Typedef Documentation

◆ TAssemblySeqIds

typedef vector<CConstRef<CSeq_id> > TAssemblySeqIds

Definition at line 94 of file utils.cpp.

◆ TMappedLocs

typedef vector< CRef<CSeq_loc> > TMappedLocs

For CDS and RNA feature mapping information.

Definition at line 1768 of file utils.cpp.

◆ TNameTypeMap

Definition at line 136 of file utils.cpp.

◆ TNameTypeStr

Definition at line 128 of file utils.cpp.

◆ TTopLevels

Definition at line 89 of file utils.cpp.

Function Documentation

◆ DEFINE_STATIC_ARRAY_MAP()

DEFINE_STATIC_ARRAY_MAP ( TNameTypeMap  ,
sm_NameTypeMap  ,
s_NameTypeStrs   
)

◆ GetBioseqForSeqdesc()

CConstRef<CBioseq> GetBioseqForSeqdesc ( CRef< CScope scope,
const CSeqdesc seq_desc 
)

◆ GetBioseqForSeqFeat()

CBioseq_Handle GetBioseqForSeqFeat ( const CSeq_feat f,
CScope scope 
)

◆ GetDefaultTopLevelSeqEntry()

CSeq_entry_Handle GetDefaultTopLevelSeqEntry ( CScope scope)

◆ GetLinksURL()

static const string& GetLinksURL ( )
static

◆ GetSeqEntryForPubdesc()

CSeq_entry_Handle GetSeqEntryForPubdesc ( CRef< CScope scope,
const CPubdesc pubdesc 
)

◆ GetSeqFeatHandleForBadLocFeature()

CSeq_feat_Handle GetSeqFeatHandleForBadLocFeature ( const CSeq_feat feat,
CScope scope 
)

Definition at line 2502 of file utils.cpp.

References f(), CScope::GetAllTSEs(), and ITERATE.

Referenced by GetBioseqForSeqFeat().

◆ GetSortedFeatList()

vector<const CFeatListItem * > GetSortedFeatList ( CSeq_entry_Handle  seh,
size_t  max 
)

◆ s_AdjustToAnnotatedCDS()

static void s_AdjustToAnnotatedCDS ( const CMappedFeat mapped_cds_feat,
CScope scope,
CSeqUtils::TMappingInfo cds_map_info 
)
static

◆ s_CompareDescriptions()

static bool s_CompareDescriptions ( const CFeatListItem p1,
const CFeatListItem p2 
)
static

Definition at line 2617 of file utils.cpp.

References ch1, ch2, NStr::Compare(), NStr::eNocase, CFeatListItem::GetDescription(), and isdigit().

Referenced by GetSortedFeatList().

◆ s_CreateMappingInfo()

static void s_CreateMappingInfo ( const CSeq_loc prod_loc,
const CSeq_loc gen_loc,
CSeqUtils::TMappingInfo info 
)
static

◆ s_ELinkQuery() [1/2]

template<class T >
static void s_ELinkQuery ( const string db_from,
const string db_to,
const vector< T > &  uids_from,
xml::document linkset,
const string cmd 
)
static

◆ s_ELinkQuery() [2/2]

template<class T1 , class T2 >
static void s_ELinkQuery ( const string db_from,
const string db_to,
const vector< T1 > &  uids_from,
vector< T2 > &  uids_to,
const string cmd,
const string xpath 
)
static

◆ s_ESearchQuery() [1/2]

template<class T >
static void s_ESearchQuery ( const string db,
const string term,
const string web_env,
const string query_key,
vector< T > &  uids,
size_t &  count,
int  retstart,
const string xpath 
)
static

◆ s_ESearchQuery() [2/2]

template<class T >
static void s_ESearchQuery ( const string db,
const string term,
vector< T > &  uids,
size_t &  count,
const int  ret_max,
const string xpath 
)
static

◆ s_GetAlnMapplingLocs()

static CSeqUtils::TLocVec s_GetAlnMapplingLocs ( const CSeq_align_set align_set,
TGi  gi 
)
static

◆ s_GetAssemblySeqIds()

static const TAssemblySeqIds& s_GetAssemblySeqIds ( const string assm_acc)
static

◆ s_GetRnaMappingLocs()

static TMappedLocs s_GetRnaMappingLocs ( const CSeq_loc feat_loc,
const CMappedFeat feat,
const CBioseq_Handle handle 
)
static

◆ s_IsExtendedNAA()

static bool s_IsExtendedNAA ( const string sAnnotName,
char  div,
bool  isStrict 
)
static

Definition at line 824 of file utils.cpp.

References i, NPOS, and s_IsNAA().

Referenced by CSeqUtils::IsExtendedNAA(), and CSeqUtils::IsExtendedNAA_Name().

◆ s_IsNAA()

static bool s_IsNAA ( const string annot,
char  div 
)
static

Definition at line 764 of file utils.cpp.

References i, and len.

Referenced by CSeqUtils::IsNAA(), and s_IsExtendedNAA().

◆ USING_SCOPE()

USING_SCOPE ( objects  )

Variable Documentation

◆ kAssmDb

const string kAssmDb = "assembly"
static

◆ kLinksUrlDefault

const char* kLinksUrlDefault
static
Initial value:
=
"https://www.ncbi.nlm.nih.gov/sviewer/links.fcgi?link_name=gi_placement&report=asn"

Definition at line 1055 of file utils.cpp.

Referenced by GetLinksURL().

◆ kNucDb

const string kNucDb = "nucleotide"
static

Definition at line 1359 of file utils.cpp.

Referenced by CSeqUtils::GetAssmIds_GI(), and CSeqUtils::GetAssmIds_GIChr().

◆ kRetMax

const int kRetMax = 5000
static

◆ kTaxDb

const string kTaxDb = "taxonomy"
static

Definition at line 1358 of file utils.cpp.

◆ m_AssemblySeqIdLock

CRWLock m_AssemblySeqIdLock
static

Definition at line 93 of file utils.cpp.

Referenced by s_GetAssemblySeqIds().

◆ m_TopLevels

TTopLevels m_TopLevels
static

Definition at line 90 of file utils.cpp.

Referenced by CSeqUtils::isTopLevel().

◆ m_TopLevelsLock

CRWLock m_TopLevelsLock
static

Definition at line 91 of file utils.cpp.

Referenced by CSeqUtils::isTopLevel().

◆ s_AssemblySeqIdCache

map<string, TAssemblySeqIds> s_AssemblySeqIdCache
static

Definition at line 95 of file utils.cpp.

Referenced by s_GetAssemblySeqIds().

◆ s_NameTypeStrs

const TNameTypeStr s_NameTypeStrs[]
static
Initial value:
= {
{ "Unnamed", CSeqUtils::eAnnot_Unnamed },
}
@ 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

Definition at line 129 of file utils.cpp.

Modified on Fri Jan 05 07:22:23 2024 by modify_doxy.py rev. 669887