NCBI C++ ToolKit
Classes | Macros | Functions | Variables
objutil.cpp File Reference
#include <ncbi_pch.hpp>
#include <corelib/ncbistd.hpp>
#include <util/strsearch.hpp>
#include <objects/general/Date.hpp>
#include <objects/general/User_object.hpp>
#include <objects/general/User_field.hpp>
#include <objects/general/Object_id.hpp>
#include <objects/seq/Bioseq.hpp>
#include <objects/seq/Seq_inst.hpp>
#include <objects/seq/Seq_ext.hpp>
#include <objects/seq/Delta_ext.hpp>
#include <objects/seq/Delta_seq.hpp>
#include <objects/seq/Seq_literal.hpp>
#include <objects/seq/MolInfo.hpp>
#include <objects/seq/seqport_util.hpp>
#include <objects/seqloc/Seq_loc.hpp>
#include <objmgr/scope.hpp>
#include <objmgr/bioseq_handle.hpp>
#include <objmgr/seqdesc_ci.hpp>
#include <objmgr/object_manager.hpp>
#include <objmgr/util/sequence.hpp>
#include <objects/general/general_macros.hpp>
#include <algorithm>
#include <objmgr/util/objutil.hpp>
+ Include dependency graph for objutil.cpp:

Go to the source code of this file.

Go to the SVN repository for this file.

Classes

class  CIsGraph
 

Macros

#define twochars(a, b)   Uint2((a) << 8 | (b))
 
#define twocommas   twochars(',',',')
 
#define twospaces   twochars(' ',' ')
 
#define twosemicolons   twochars(';',';')
 
#define space_comma   twochars(' ',',')
 
#define space_bracket   twochars(' ',')')
 
#define bracket_space   twochars('(',' ')
 
#define space_semicolon   twochars(' ',';')
 
#define comma_space   twochars(',',' ')
 
#define semicolon_space   twochars(';',' ')
 

Functions

 SAFE_CONST_STATIC_STRING (kLegalPathChars, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_-.")
 
bool IsPartOfUrl (const string &sentence, size_t pos)
 
static bool s_RunOfStars (string &s, SIZE_TYPE start, SIZE_TYPE length)
 
void ExpandTildes (string &s, ETildeStyle style)
 
void ConvertQuotes (string &str)
 
string ConvertQuotes (const string &str)
 
bool StripSpaces (string &str)
 
bool RemovePeriodFromEnd (string &str, bool keep_ellipsis)
 
void AddPeriod (string &str)
 
void TrimSpaces (string &str, size_t indent)
 
stringCompressSpaces (string &str, const bool trim_beginning, const bool trim_end)
 
bool TrimSpacesAndJunkFromEnds (string &str, bool allow_ellipsis)
 
void TrimSpacesAndJunkFromEnds (string &result, const CTempString &str, bool allow_ellipsis)
 
void CleanAndCompress (string &dest, const CTempString &instr)
 
static bool s_IsWholeWord (const string &str, size_t pos)
 
void JoinString (string &to, const string &prefix, const string &str, bool noRedundancy)
 
string JoinString (const list< string > &l, const string &delim, bool noRedundancy)
 
static bool s_IsValidDotVersion (const string &accn)
 
bool IsValidAccession (const string &accn, EAccValFlag flag)
 
void DateToString (const CDate &date, string &str, EDateToString format_choice)
 
void GetDeltaSeqSummary (const CBioseq_Handle &seq, SDeltaSeqSummary &summary)
 
 SAFE_CONST_STATIC_STRING (kTS_concept_trans, "conceptual translation")
 
 SAFE_CONST_STATIC_STRING (kTS_concept_trans_a, "conceptual translation supplied by author")
 
 SAFE_CONST_STATIC_STRING (kTS_both, "conceptual translation with partial peptide sequencing")
 
 SAFE_CONST_STATIC_STRING (kTS_seq_pept, "direct peptide sequencing")
 
 SAFE_CONST_STATIC_STRING (kTS_seq_pept_homol, "sequenced peptide, ordered by homology")
 
 SAFE_CONST_STATIC_STRING (kTS_seq_pept_overlap, "sequenced peptide, ordered by overlap")
 
const stringGetTechString (int tech)
 
bool s_IsModelEvidanceUop (const CUser_object &uo)
 
const CUser_objects_FindModelEvidanceUop (const CUser_object &uo)
 
bool s_GetModelEvidance (const CBioseq_Handle &bsh, SModelEvidance &me)
 
bool GetModelEvidance (const CBioseq_Handle &bsh, SModelEvidance &me)
 
const char * GetAAName (unsigned char aa, bool is_ascii)
 
EResolveOrder GetResolveOrder (CScope &scope, const CSeq_id_Handle &mrna, const CSeq_id_Handle &prot, CBioseq_Handle &mrna_bsh, CBioseq_Handle &prot_bsh)
 
bool ConvertQuotesNotInHTMLTags (string &str)
 
void TryToSanitizeHtml (string &str)
 
void TryToSanitizeHtml (std::string &result, const CTempString &str)
 
void TryToSanitizeHtmlList (std::list< std::string > &strs)
 
bool CommentHasSuspiciousHtml (const string &str)
 

Variables

static const char * kAANames []
 
const char * strLinkBaseNuc
 
const char * strLinkBaseProt
 
const char * strLinkBaseEntrezViewer
 
const char * strLinkBaseTaxonomy
 
const char * strLinkBaseTransTable
 
const char * strLinkBasePubmed
 
const char * strLinkBaseExpasy
 
const char * strLinkBaseNucSearch
 
const char * strLinkBaseGenomePrj
 
const char * strLinkBaseLatLon
 
const char * strLinkBaseGeneOntology
 
const char * strLinkBaseGeneOntologyRef
 
const char * strLinkBaseUSPTO
 
const char * strLinkBaseUniProt
 
const char * strDocLink
 

Macro Definition Documentation

◆ bracket_space

#define bracket_space   twochars('(',' ')

Definition at line 818 of file objutil.cpp.

◆ comma_space

#define comma_space   twochars(',',' ')

Definition at line 820 of file objutil.cpp.

◆ semicolon_space

#define semicolon_space   twochars(';',' ')

Definition at line 821 of file objutil.cpp.

◆ space_bracket

#define space_bracket   twochars(' ',')')

Definition at line 817 of file objutil.cpp.

◆ space_comma

#define space_comma   twochars(' ',',')

Definition at line 816 of file objutil.cpp.

◆ space_semicolon

#define space_semicolon   twochars(' ',';')

Definition at line 819 of file objutil.cpp.

◆ twochars

#define twochars (   a,
  b 
)    Uint2((a) << 8 | (b))

Definition at line 812 of file objutil.cpp.

◆ twocommas

#define twocommas   twochars(',',',')

Definition at line 813 of file objutil.cpp.

◆ twosemicolons

#define twosemicolons   twochars(';',';')

Definition at line 815 of file objutil.cpp.

◆ twospaces

#define twospaces   twochars(' ',' ')

Definition at line 814 of file objutil.cpp.

Function Documentation

◆ AddPeriod()

void AddPeriod ( string str)

◆ CleanAndCompress()

void CleanAndCompress ( string dest,
const CTempString instr 
)

◆ CommentHasSuspiciousHtml()

bool CommentHasSuspiciousHtml ( const string str)

Definition at line 1879 of file objutil.cpp.

References ArraySize(), and str().

Referenced by CReferenceItem::x_GatherRemark(), and CFeatureItem::x_ImportQuals().

◆ CompressSpaces()

string& CompressSpaces ( string str,
const bool  trim_beginning,
const bool  trim_end 
)

Definition at line 416 of file objutil.cpp.

References isgraph(), and str().

◆ ConvertQuotes() [1/2]

string ConvertQuotes ( const string str)

Definition at line 246 of file objutil.cpp.

References ConvertQuotes(), and str().

◆ ConvertQuotes() [2/2]

void ConvertQuotes ( string str)

◆ ConvertQuotesNotInHTMLTags()

bool ConvertQuotesNotInHTMLTags ( string str)

◆ DateToString()

void DateToString ( const CDate date,
string str,
EDateToString  format_choice 
)

◆ ExpandTildes()

void ExpandTildes ( string s,
ETildeStyle  style 
)

◆ GetAAName()

const char* GetAAName ( unsigned char  aa,
bool  is_ascii 
)

◆ GetDeltaSeqSummary()

void GetDeltaSeqSummary ( const CBioseq_Handle seq,
SDeltaSeqSummary summary 
)

◆ GetModelEvidance()

bool GetModelEvidance ( const CBioseq_Handle bsh,
SModelEvidance me 
)

◆ GetResolveOrder()

EResolveOrder GetResolveOrder ( CScope scope,
const CSeq_id_Handle mrna,
const CSeq_id_Handle prot,
CBioseq_Handle mrna_bsh,
CBioseq_Handle prot_bsh 
)

◆ GetTechString()

const string& GetTechString ( int  tech)

◆ IsPartOfUrl()

bool IsPartOfUrl ( const string sentence,
size_t  pos 
)

Definition at line 67 of file objutil.cpp.

References DEFINE_STATIC_ARRAY_MAP_WITH_COPY.

Referenced by ExpandTildes().

◆ IsValidAccession()

bool IsValidAccession ( const string accn,
EAccValFlag  flag 
)

◆ JoinString() [1/2]

string JoinString ( const list< string > &  l,
const string delim,
bool  noRedundancy 
)

Definition at line 1083 of file objutil.cpp.

References JoinString(), kEmptyStr, and result.

◆ JoinString() [2/2]

void JoinString ( string to,
const string prefix,
const string str,
bool  noRedundancy 
)

◆ RemovePeriodFromEnd()

bool RemovePeriodFromEnd ( string str,
bool  keep_ellipsis 
)

◆ s_FindModelEvidanceUop()

const CUser_object* s_FindModelEvidanceUop ( const CUser_object uo)

◆ s_GetModelEvidance()

bool s_GetModelEvidance ( const CBioseq_Handle bsh,
SModelEvidance me 
)

◆ s_IsModelEvidanceUop()

bool s_IsModelEvidanceUop ( const CUser_object uo)

◆ s_IsValidDotVersion()

static bool s_IsValidDotVersion ( const string accn)
static

Definition at line 1208 of file objutil.cpp.

References isdigit(), and NPOS.

Referenced by IsValidAccession().

◆ s_IsWholeWord()

static bool s_IsWholeWord ( const string str,
size_t  pos 
)
static

Definition at line 1040 of file objutil.cpp.

References ispunct(), isspace(), and str().

Referenced by JoinString().

◆ s_RunOfStars()

static bool s_RunOfStars ( string s,
SIZE_TYPE  start,
SIZE_TYPE  length 
)
static

Definition at line 137 of file objutil.cpp.

References i, and max().

Referenced by ExpandTildes().

◆ SAFE_CONST_STATIC_STRING() [1/7]

SAFE_CONST_STATIC_STRING ( kLegalPathChars  ,
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_-."   
)

◆ SAFE_CONST_STATIC_STRING() [2/7]

SAFE_CONST_STATIC_STRING ( kTS_both  ,
"conceptual translation with partial peptide sequencing"   
)

◆ SAFE_CONST_STATIC_STRING() [3/7]

SAFE_CONST_STATIC_STRING ( kTS_concept_trans  ,
"conceptual translation"   
)

◆ SAFE_CONST_STATIC_STRING() [4/7]

SAFE_CONST_STATIC_STRING ( kTS_concept_trans_a  ,
"conceptual translation supplied by author"   
)

◆ SAFE_CONST_STATIC_STRING() [5/7]

SAFE_CONST_STATIC_STRING ( kTS_seq_pept  ,
"direct peptide sequencing"   
)

◆ SAFE_CONST_STATIC_STRING() [6/7]

SAFE_CONST_STATIC_STRING ( kTS_seq_pept_homol  ,
"sequenced  peptide,
ordered by homology"   
)

◆ SAFE_CONST_STATIC_STRING() [7/7]

SAFE_CONST_STATIC_STRING ( kTS_seq_pept_overlap  ,
"sequenced  peptide,
ordered by overlap"   
)

◆ StripSpaces()

bool StripSpaces ( string str)

◆ TrimSpaces()

void TrimSpaces ( string str,
size_t  indent 
)

Definition at line 385 of file objutil.cpp.

References indent(), isspace(), and str().

Referenced by CFlatItemFormatter::Wrap().

◆ TrimSpacesAndJunkFromEnds() [1/2]

void TrimSpacesAndJunkFromEnds ( string result,
const CTempString str,
bool  allow_ellipsis 
)

Definition at line 647 of file objutil.cpp.

References _ASSERT, int, isalnum(), len, result, str(), and suffix.

◆ TrimSpacesAndJunkFromEnds() [2/2]

bool TrimSpacesAndJunkFromEnds ( string str,
bool  allow_ellipsis 
)

◆ TryToSanitizeHtml() [1/2]

void TryToSanitizeHtml ( std::string result,
const CTempString str 
)

Definition at line 1815 of file objutil.cpp.

References ITERATE, result, and str().

◆ TryToSanitizeHtml() [2/2]

void TryToSanitizeHtml ( string str)

Definition at line 1803 of file objutil.cpp.

References result, and str().

Referenced by TryToSanitizeHtmlList().

◆ TryToSanitizeHtmlList()

void TryToSanitizeHtmlList ( std::list< std::string > &  strs)

Variable Documentation

◆ kAANames

const char* kAANames[]
static
Initial value:
= {
"---", "Ala", "Asx", "Cys", "Asp", "Glu", "Phe", "Gly", "His", "Ile",
"Lys", "Leu", "Met", "Asn", "Pro", "Gln", "Arg", "Ser", "Thr", "Val",
"Trp", "OTHER", "Tyr", "Glx", "Sec", "TERM", "Pyl", "Xle"
}

Definition at line 1552 of file objutil.cpp.

Referenced by GetAAName().

◆ strDocLink

const char* strDocLink
Initial value:
=
"https://www.ncbi.nlm.nih.gov/genome/annotation_euk/process/"

Definition at line 1667 of file objutil.cpp.

Referenced by CCommentItem::GetStringForRefTrack(), and CGenomeAnnotComment::x_GatherInfo().

◆ strLinkBaseEntrezViewer

const char* strLinkBaseEntrezViewer
Initial value:
=
"https://www.ncbi.nlm.nih.gov/entrez/viewer.fcgi?val="

Definition at line 1641 of file objutil.cpp.

Referenced by CFlatSeqLoc::x_AddID().

◆ strLinkBaseExpasy

const char* strLinkBaseExpasy
Initial value:
=
"https://enzyme.expasy.org/EC/"

Definition at line 1650 of file objutil.cpp.

Referenced by CFlatStringQVal::Format().

◆ strLinkBaseGeneOntology

const char* strLinkBaseGeneOntology
Initial value:
=
"http://amigo.geneontology.org/amigo/term/GO:"

Definition at line 1658 of file objutil.cpp.

Referenced by s_GetGOText().

◆ strLinkBaseGeneOntologyRef

const char* strLinkBaseGeneOntologyRef
Initial value:
=
"http://www.geneontology.org/cgi-bin/references.cgi#GO_REF:"

Definition at line 1660 of file objutil.cpp.

Referenced by s_GetGOText().

◆ strLinkBaseGenomePrj

const char* strLinkBaseGenomePrj
Initial value:
=
"https://www.ncbi.nlm.nih.gov/bioproject/"

Definition at line 1654 of file objutil.cpp.

Referenced by CGenbankFormatter::FormatGenomeProject().

◆ strLinkBaseLatLon

const char* strLinkBaseLatLon
Initial value:
=
"https://www.ncbi.nlm.nih.gov/projects/Sequin/latlonview.html"

Definition at line 1656 of file objutil.cpp.

◆ strLinkBaseNuc

const char* strLinkBaseNuc
Initial value:
=
"https://www.ncbi.nlm.nih.gov/nuccore/"

Definition at line 1636 of file objutil.cpp.

Referenced by CGenbankFormatter::FormatAccession(), and NcbiId().

◆ strLinkBaseNucSearch

const char* strLinkBaseNucSearch
Initial value:
=
"https://www.ncbi.nlm.nih.gov/sites/entrez?db=Nucleotide&amp;cmd=Search&amp;term="

Definition at line 1652 of file objutil.cpp.

◆ strLinkBaseProt

const char* strLinkBaseProt
Initial value:
=
"https://www.ncbi.nlm.nih.gov/protein/"

Definition at line 1638 of file objutil.cpp.

Referenced by CGenbankFormatter::FormatAccession().

◆ strLinkBasePubmed

const char* strLinkBasePubmed
Initial value:
=
"https://www.ncbi.nlm.nih.gov/pubmed/"

Definition at line 1648 of file objutil.cpp.

Referenced by CFlatPubSetQVal::Format(), s_GetGOText(), s_HTMLizeExperimentQual(), and CGenbankFormatter::x_Medline().

◆ strLinkBaseTaxonomy

const char* strLinkBaseTaxonomy
Initial value:
=
"https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?"

Definition at line 1644 of file objutil.cpp.

◆ strLinkBaseTransTable

const char* strLinkBaseTransTable
Initial value:
=
"https://www.ncbi.nlm.nih.gov/Taxonomy/Utils/wprintgc.cgi?mode=c#SG"

Definition at line 1646 of file objutil.cpp.

Referenced by CFlatIntQVal::Format().

◆ strLinkBaseUniProt

const char* strLinkBaseUniProt
Initial value:
=
"https://www.uniprot.org/uniprot/"

Definition at line 1664 of file objutil.cpp.

Referenced by CHTMLFormatterEx::FormatUniProtId().

◆ strLinkBaseUSPTO

const char* strLinkBaseUSPTO
Initial value:
=
"https://ppubs.uspto.gov/pubwebapp/external.html?q="

Definition at line 1662 of file objutil.cpp.

Referenced by s_FormatPatent().

Modified on Mon Jun 24 05:22:40 2024 by modify_doxy.py rev. 669887