NCBI C++ ToolKit
Macros | Functions | Variables
utilfun.cpp File Reference
#include <ncbi_pch.hpp>
#include <corelib/ncbitime.hpp>
#include "ftacpp.hpp"
#include <corelib/ncbistr.hpp>
#include <objmgr/scope.hpp>
#include <objmgr/object_manager.hpp>
#include <objects/seq/MolInfo.hpp>
#include <objects/seqloc/PDB_seq_id.hpp>
#include <corelib/tempstr.hpp>
#include "index.h"
#include "ftaerr.hpp"
#include "indx_def.h"
#include "utilfun.h"
+ Include dependency graph for utilfun.cpp:

Go to the source code of this file.

Go to the SVN repository for this file.

Macros

#define THIS_FILE   "utilfun.cpp"
 

Functions

 USING_SCOPE (objects)
 
CScopeGetScope ()
 
static string FTAitoa (Int4 m)
 
void UnwrapAccessionRange (const CGB_block::TExtra_accessions &extra_accs, CGB_block::TExtra_accessions &hist)
 
static bool sIsPrefixChar (char c)
 
bool ParseAccessionRange (list< string > &tokens, unsigned skip)
 
bool IsLeadPrefixChar (char c)
 
bool IsDigit (char c)
 
bool ParseAccessionRange (TokenStatBlkPtr tsbp, unsigned skip)
 
unique_ptr< TokenStatBlkTokenString (const char *str, Char delimiter)
 
Int2 fta_StringMatch (const Char **array, string_view text)
 
Int2 StringMatchIcase (const Char **array, string_view text)
 
Int2 MatchArrayString (const char **array, const char *text)
 
Int2 MatchArrayIString (const Char **array, const Char *text)
 
Int2 MatchArraySubString (const Char **array, string_view text)
 
CharStringIStr (const Char *where, const Char *what)
 
Int2 MatchArrayISubString (const Char **array, string_view text)
 
string GetBlkDataReplaceNewLine (string_view instr, Uint2 indent)
 
static size_t SeekLastAlphaChar (const Char *str, size_t len)
 
void CleanTailNoneAlphaCharInString (string &str)
 
void CleanTailNoneAlphaChar (char *str)
 
char * PointToNextToken (char *ptr)
 
char * GetTheCurrentToken (char **ptr)
 
char * SrchTheChar (char *bptr, char *eptr, Char letter)
 
char * SrchTheStr (char *bptr, char *eptr, const char *leadstr)
 
void CpSeqId (InfoBioseqPtr ibp, const CSeq_id &id)
 
CRef< CDate_stdget_full_date (const char *s, bool is_ref, Parser::ESource source)
 
int SrchKeyword (const CTempString &ptr, const vector< string > &keywordList)
 
bool CheckLineType (char *ptr, Int4 line, const vector< string > &keywordList, bool after_origin)
 
char * SrchNodeType (DataBlkPtr entry, Int4 type, size_t *len)
 
char * xSrchNodeType (const DataBlk &entry, Int4 type, size_t *len)
 
string xGetNodeData (const DataBlk &entry, int nodeType)
 
DataBlkPtr TrackNodeType (const DataBlk &entry, Int2 type)
 
const SectionxTrackNodeType (const Entry &entry, int type)
 
bool fta_tpa_keywords_check (const TKeywordList &kwds)
 
bool fta_tsa_keywords_check (const TKeywordList &kwds, Parser::ESource source)
 
bool fta_tls_keywords_check (const TKeywordList &kwds, Parser::ESource source)
 
bool fta_is_tpa_keyword (const char *str)
 
bool fta_is_tsa_keyword (const char *str)
 
bool fta_is_tls_keyword (const char *str)
 
void fta_keywords_check (const char *str, bool *estk, bool *stsk, bool *gssk, bool *htck, bool *flik, bool *wgsk, bool *tpak, bool *envk, bool *mgak, bool *tsak, bool *tlsk)
 
void fta_remove_keywords (CMolInfo::TTech tech, TKeywordList &kwds)
 
void fta_remove_tpa_keywords (TKeywordList &kwds)
 
void fta_remove_tsa_keywords (TKeywordList &kwds, Parser::ESource source)
 
void fta_remove_tls_keywords (TKeywordList &kwds, Parser::ESource source)
 
void fta_remove_env_keywords (TKeywordList &kwds)
 
void fta_remove_mag_keywords (TKeywordList &kwds)
 
void xCheckEstStsGssTpaKeywords (const list< string > keywordList, bool tpa_check, IndexblkPtr entry)
 
void check_est_sts_gss_tpa_kwds (ValNodePtr kwds, size_t len, IndexblkPtr entry, bool tpa_check, bool &specialist_db, bool &inferential, bool &experimental, bool &assembly)
 
ValNodePtr ConstructValNode (CSeq_id::E_Choice choice, const char *data)
 
bool fta_check_mga_keywords (CMolInfo &mol_info, const TKeywordList &kwds)
 
void fta_StringCpy (char *dst, const char *src)
 
bool SetTextId (Uint1 seqtype, CSeq_id &seqId, CTextseq_id &textId)
 
bool IsCancelled (const TKeywordList &keywords)
 
bool HasHtg (const TKeywordList &keywords)
 
void RemoveHtgPhase (TKeywordList &keywords)
 
bool HasHtc (const TKeywordList &keywords)
 

Variables

static const char * ParFlat_EST_kw_array []
 
static const char * ParFlat_GSS_kw_array []
 
static const char * ParFlat_STS_kw_array []
 
static const char * ParFlat_HTC_kw_array []
 
static const char * ParFlat_FLI_kw_array []
 
static const char * ParFlat_WGS_kw_array []
 
static const char * ParFlat_MGA_kw_array []
 
static const char * ParFlat_MGA_more_kw_array []
 
static const char * ParFlat_TSA_kw_array []
 
static const char * ParFlat_TLS_kw_array []
 
static const char * ParFlat_TPA_kw_array []
 
static const char * ParFlat_TPA_kw_array_to_remove []
 
static const char * ParFlat_ENV_kw_array []
 
static const char * ParFlat_MAG_kw_array []
 

Macro Definition Documentation

◆ THIS_FILE

#define THIS_FILE   "utilfun.cpp"

Definition at line 56 of file utilfun.cpp.

Function Documentation

◆ check_est_sts_gss_tpa_kwds()

void check_est_sts_gss_tpa_kwds ( ValNodePtr  kwds,
size_t  len,
IndexblkPtr  entry,
bool  tpa_check,
bool specialist_db,
bool inferential,
bool experimental,
bool assembly 
)

◆ CheckLineType()

bool CheckLineType ( char *  ptr,
Int4  line,
const vector< string > &  keywordList,
bool  after_origin 
)

Definition at line 910 of file utilfun.cpp.

References ERR_ENTRY_InvalidLineType, ErrPostEx, i, msg(), SEV_ERROR, StringChr, StringEquN(), and StringNCpy().

Referenced by EmblIndex(), and GenBankIndex().

◆ CleanTailNoneAlphaChar()

void CleanTailNoneAlphaChar ( char *  str)

Definition at line 697 of file utilfun.cpp.

References last(), SeekLastAlphaChar(), and str().

Referenced by GetOneGeneRef(), and GetTheCurrentToken().

◆ CleanTailNoneAlphaCharInString()

void CleanTailNoneAlphaCharInString ( string str)

Definition at line 683 of file utilfun.cpp.

References SeekLastAlphaChar(), and str().

Referenced by GetBioseqSetDescrTitle(), GetEmblBlockXref(), and ParseRLDataSP().

◆ ConstructValNode()

ValNodePtr ConstructValNode ( CSeq_id::E_Choice  choice,
const char *  data 
)

Definition at line 1437 of file utilfun.cpp.

References ValNode::choice, data, and ValNodeNew().

Referenced by AddToList(), GenBankIndex(), GetDRlineDataSP(), and XMLKeywordsCheck().

◆ CpSeqId()

void CpSeqId ( InfoBioseqPtr  ibp,
const CSeq_id id 
)

◆ fta_check_mga_keywords()

bool fta_check_mga_keywords ( CMolInfo mol_info,
const TKeywordList kwds 
)

◆ fta_is_tls_keyword()

bool fta_is_tls_keyword ( const char *  str)

Definition at line 1187 of file utilfun.cpp.

References MatchArrayIString(), ParFlat_TLS_kw_array, and str().

◆ fta_is_tpa_keyword()

bool fta_is_tpa_keyword ( const char *  str)

Definition at line 1170 of file utilfun.cpp.

References MatchArrayIString(), ParFlat_TPA_kw_array, and str().

Referenced by fta_fix_tpa_keywords().

◆ fta_is_tsa_keyword()

bool fta_is_tsa_keyword ( const char *  str)

Definition at line 1179 of file utilfun.cpp.

References MatchArrayIString(), ParFlat_TSA_kw_array, and str().

◆ fta_keywords_check()

void fta_keywords_check ( const char *  str,
bool estk,
bool stsk,
bool gssk,
bool htck,
bool flik,
bool wgsk,
bool tpak,
bool envk,
bool mgak,
bool tsak,
bool tlsk 
)

◆ fta_remove_env_keywords()

void fta_remove_env_keywords ( TKeywordList kwds)

◆ fta_remove_keywords()

void fta_remove_keywords ( CMolInfo::TTech  tech,
TKeywordList kwds 
)

◆ fta_remove_mag_keywords()

void fta_remove_mag_keywords ( TKeywordList kwds)

◆ fta_remove_tls_keywords()

void fta_remove_tls_keywords ( TKeywordList kwds,
Parser::ESource  source 
)

◆ fta_remove_tpa_keywords()

void fta_remove_tpa_keywords ( TKeywordList kwds)

◆ fta_remove_tsa_keywords()

void fta_remove_tsa_keywords ( TKeywordList kwds,
Parser::ESource  source 
)

◆ fta_StringCpy()

void fta_StringCpy ( char *  dst,
const char *  src 
)

◆ fta_StringMatch()

Int2 fta_StringMatch ( const Char **  array,
string_view  text 
)

◆ fta_tls_keywords_check()

bool fta_tls_keywords_check ( const TKeywordList kwds,
Parser::ESource  source 
)

◆ fta_tpa_keywords_check()

bool fta_tpa_keywords_check ( const TKeywordList kwds)

◆ fta_tsa_keywords_check()

bool fta_tsa_keywords_check ( const TKeywordList kwds,
Parser::ESource  source 
)

◆ FTAitoa()

static string FTAitoa ( Int4  m)
static

Definition at line 179 of file utilfun.cpp.

Referenced by UnwrapAccessionRange().

◆ get_full_date()

CRef<CDate_std> get_full_date ( const char *  s,
bool  is_ref,
Parser::ESource  source 
)

◆ GetBlkDataReplaceNewLine()

string GetBlkDataReplaceNewLine ( string_view  instr,
Uint2  indent 
)

◆ GetScope()

CScope& GetScope ( void  )

◆ GetTheCurrentToken()

char* GetTheCurrentToken ( char **  ptr)

Definition at line 727 of file utilfun.cpp.

References CleanTailNoneAlphaChar(), str(), and StringSave.

Referenced by ParseRLDataSP().

◆ HasHtc()

bool HasHtc ( const TKeywordList keywords)

◆ HasHtg()

bool HasHtg ( const TKeywordList keywords)

◆ IsCancelled()

bool IsCancelled ( const TKeywordList keywords)

◆ IsDigit()

bool IsDigit ( char  c)
inline

Definition at line 344 of file utilfun.cpp.

Referenced by ParseAccessionRange().

◆ IsLeadPrefixChar()

bool IsLeadPrefixChar ( char  c)
inline

Definition at line 340 of file utilfun.cpp.

Referenced by ParseAccessionRange().

◆ MatchArrayIString()

Int2 MatchArrayIString ( const Char **  array,
const Char text 
)

◆ MatchArrayISubString()

Int2 MatchArrayISubString ( const Char **  array,
string_view  text 
)

Definition at line 623 of file utilfun.cpp.

References NStr::FindNoCase(), i, NPOS, and text().

◆ MatchArrayString()

Int2 MatchArrayString ( const char **  array,
const char *  text 
)

◆ MatchArraySubString()

Int2 MatchArraySubString ( const Char **  array,
string_view  text 
)

Definition at line 578 of file utilfun.cpp.

References NStr::Find(), i, NPOS, and text().

Referenced by CkDateFormat().

◆ ParseAccessionRange() [1/2]

bool ParseAccessionRange ( list< string > &  tokens,
unsigned  skip 
)

◆ ParseAccessionRange() [2/2]

bool ParseAccessionRange ( TokenStatBlkPtr  tsbp,
unsigned  skip 
)

◆ PointToNextToken()

char* PointToNextToken ( char *  ptr)

◆ RemoveHtgPhase()

void RemoveHtgPhase ( TKeywordList keywords)

◆ SeekLastAlphaChar()

static size_t SeekLastAlphaChar ( const Char str,
size_t  len 
)
static

Definition at line 667 of file utilfun.cpp.

References len, and str().

Referenced by CleanTailNoneAlphaChar(), and CleanTailNoneAlphaCharInString().

◆ SetTextId()

bool SetTextId ( Uint1  seqtype,
CSeq_id seqId,
CTextseq_id textId 
)

◆ sIsPrefixChar()

static bool sIsPrefixChar ( char  c)
static

Definition at line 260 of file utilfun.cpp.

Referenced by ParseAccessionRange().

◆ SrchKeyword()

int SrchKeyword ( const CTempString ptr,
const vector< string > &  keywordList 
)

Definition at line 897 of file utilfun.cpp.

References i, ParFlat_UNKW, and NStr::StartsWith().

Referenced by GenBankIndex(), GetEmblBlock(), GetGenBankBlock(), and xGetGenBankBlocks().

◆ SrchNodeType()

char* SrchNodeType ( DataBlkPtr  entry,
Int4  type,
size_t *  len 
)

◆ SrchTheChar()

char* SrchTheChar ( char *  bptr,
char *  eptr,
Char  letter 
)

◆ SrchTheStr()

char* SrchTheStr ( char *  bptr,
char *  eptr,
const char *  leadstr 
)

Definition at line 779 of file utilfun.cpp.

References i.

Referenced by check_cds(), GetDescrComment(), GetEmblRefType(), GetFlatBiomol(), and GetReleaseInfo().

◆ StringIStr()

Char* StringIStr ( const Char where,
const Char what 
)

◆ StringMatchIcase()

Int2 StringMatchIcase ( const Char **  array,
string_view  text 
)

◆ TokenString()

unique_ptr<TokenStatBlk> TokenString ( const char *  str,
Char  delimiter 
)

◆ TrackNodeType()

DataBlkPtr TrackNodeType ( const DataBlk entry,
Int2  type 
)

◆ UnwrapAccessionRange()

void UnwrapAccessionRange ( const CGB_block::TExtra_accessions extra_accs,
CGB_block::TExtra_accessions hist 
)

Definition at line 197 of file utilfun.cpp.

References first(), FTAitoa(), i, and last().

Referenced by fta_add_hist().

◆ USING_SCOPE()

USING_SCOPE ( objects  )

◆ xCheckEstStsGssTpaKeywords()

void xCheckEstStsGssTpaKeywords ( const list< string keywordList,
bool  tpa_check,
IndexblkPtr  entry 
)

◆ xGetNodeData()

string xGetNodeData ( const DataBlk entry,
int  nodeType 
)

Definition at line 977 of file utilfun.cpp.

References string, tmp, and TrackNodeType().

Referenced by GetSequenceOfKeywords().

◆ xSrchNodeType()

char* xSrchNodeType ( const DataBlk entry,
Int4  type,
size_t *  len 
)

◆ xTrackNodeType()

const Section* xTrackNodeType ( const Entry entry,
int  type 
)

Definition at line 1008 of file utilfun.cpp.

References Entry::mSections, and Section::mType.

Variable Documentation

◆ ParFlat_ENV_kw_array

const char* ParFlat_ENV_kw_array[]
static
Initial value:
= {
"ENV",
nullptr
}

Definition at line 167 of file utilfun.cpp.

Referenced by fta_keywords_check(), and fta_remove_env_keywords().

◆ ParFlat_EST_kw_array

const char* ParFlat_EST_kw_array[]
static
Initial value:
= {
"EST",
"EST PROTO((expressed sequence tag)",
"expressed sequence tag",
"EST (expressed sequence tag)",
"EST (expressed sequence tags)",
"EST(expressed sequence tag)",
"transcribed sequence fragment",
nullptr
}

Definition at line 69 of file utilfun.cpp.

Referenced by fta_keywords_check(), and fta_remove_keywords().

◆ ParFlat_FLI_kw_array

const char* ParFlat_FLI_kw_array[]
static
Initial value:
= {
"FLI_CDNA",
nullptr
}

Definition at line 101 of file utilfun.cpp.

Referenced by fta_keywords_check(), and fta_remove_keywords().

◆ ParFlat_GSS_kw_array

const char* ParFlat_GSS_kw_array[]
static
Initial value:
= {
"GSS",
"GSS (genome survey sequence)",
"trapped exon",
nullptr
}

Definition at line 80 of file utilfun.cpp.

Referenced by fta_keywords_check(), and fta_remove_keywords().

◆ ParFlat_HTC_kw_array

const char* ParFlat_HTC_kw_array[]
static
Initial value:
= {
"HTC",
nullptr
}

Definition at line 96 of file utilfun.cpp.

Referenced by fta_keywords_check(), and fta_remove_keywords().

◆ ParFlat_MAG_kw_array

const char* ParFlat_MAG_kw_array[]
static
Initial value:
= {
"Metagenome Assembled Genome",
"MAG",
nullptr
}

Definition at line 172 of file utilfun.cpp.

Referenced by fta_remove_mag_keywords().

◆ ParFlat_MGA_kw_array

const char* ParFlat_MGA_kw_array[]
static
Initial value:
= {
"MGA",
"CAGE (Cap Analysis Gene Expression)",
"5'-SAGE",
nullptr
}

Definition at line 111 of file utilfun.cpp.

Referenced by fta_keywords_check().

◆ ParFlat_MGA_more_kw_array

const char* ParFlat_MGA_more_kw_array[]
static
Initial value:
= {
"CAGE (Cap Analysis Gene Expression)",
"5'-SAGE",
"5'-end tag",
"unspecified tag",
"small RNA",
nullptr
}

Definition at line 118 of file utilfun.cpp.

Referenced by fta_check_mga_keywords().

◆ ParFlat_STS_kw_array

const char* ParFlat_STS_kw_array[]
static
Initial value:
= {
"STS",
"STS(sequence tagged site)",
"STS (sequence tagged site)",
"STS sequence",
"sequence tagged site",
nullptr
}

Definition at line 87 of file utilfun.cpp.

Referenced by fta_keywords_check(), and fta_remove_keywords().

◆ ParFlat_TLS_kw_array

const char* ParFlat_TLS_kw_array[]
static
Initial value:
= {
"TLS",
"Targeted Locus Study",
nullptr
}

Definition at line 139 of file utilfun.cpp.

Referenced by fta_is_tls_keyword(), fta_keywords_check(), fta_remove_tls_keywords(), and fta_tls_keywords_check().

◆ ParFlat_TPA_kw_array

const char* ParFlat_TPA_kw_array[]
static
Initial value:
= {
"TPA",
"THIRD PARTY ANNOTATION",
"THIRD PARTY DATA",
"TPA:INFERENTIAL",
"TPA:EXPERIMENTAL",
"TPA:REASSEMBLY",
"TPA:ASSEMBLY",
"TPA:SPECIALIST_DB",
nullptr
}

Definition at line 148 of file utilfun.cpp.

Referenced by fta_is_tpa_keyword(), fta_keywords_check(), and fta_tpa_keywords_check().

◆ ParFlat_TPA_kw_array_to_remove

const char* ParFlat_TPA_kw_array_to_remove[]
static
Initial value:
= {
"TPA",
"THIRD PARTY ANNOTATION",
"THIRD PARTY DATA",
nullptr
}

Definition at line 160 of file utilfun.cpp.

Referenced by fta_remove_tpa_keywords().

◆ ParFlat_TSA_kw_array

const char* ParFlat_TSA_kw_array[]
static
Initial value:
= {
"TSA",
"Transcriptome Shotgun Assembly",
nullptr
}

Definition at line 130 of file utilfun.cpp.

Referenced by fta_is_tsa_keyword(), fta_keywords_check(), fta_remove_tsa_keywords(), and fta_tsa_keywords_check().

◆ ParFlat_WGS_kw_array

const char* ParFlat_WGS_kw_array[]
static
Initial value:
= {
"WGS",
nullptr
}

Definition at line 106 of file utilfun.cpp.

Referenced by fta_keywords_check(), and fta_remove_keywords().

Modified on Fri Sep 20 14:57:15 2024 by modify_doxy.py rev. 669887