82 struct STaxidTaxname {
84 const char* m_species;
85 const char* m_subspecies;
90 { 7955, {
"Danio",
"rerio",
"" } },
91 { 8022, {
"Oncorhynchus",
"mykiss",
"" } },
92 { 9606, {
"Homo",
"sapiens",
"" } },
93 { 9615, {
"Canis",
"lupus",
"familiaris" } },
94 { 9838, {
"Camelus",
"dromedarius",
"" } },
95 { 9913, {
"Bos",
"taurus",
"" } },
96 { 9986, {
"Oryctolagus",
"cuniculus",
"" } },
97 { 10090, {
"Mus",
"musculus",
"" } },
98 { 10093, {
"Mus",
"pahari",
"" } },
99 { 10094, {
"Mus",
"saxicola",
"" } },
100 { 10096, {
"Mus",
"spretus",
"" } },
101 { 10098, {
"Mus",
"cookii",
"" } },
102 { 10105, {
"Mus",
"minutoides",
"" } },
103 { 10116, {
"Rattus",
"norvegicus",
"" } },
104 { 10117, {
"Rattus",
"rattus",
"" } }
112 auto it = _cont.find(_key);
113 if (it == _cont.end())
116 if (_key != it->first && _key != it->second.m_alias)
119 return it->second.m_groups;
125 auto it = _cont.find(_key);
126 if (it == _cont.end())
129 if (_key != it->first && _key != it->second.m_alias)
132 _retval = it->second.m_tag;
140 if (
auto it = _cont.find(v); it != _cont.end()) {
141 if (it->second.m_alias == string_view(v))
142 correct_caps = it->second.m_alias;
144 correct_caps = it->first;
145 return it->second.m_groups;
190 switch (
id.Which()) {
193 const string& db =
GetDb();
194 const string&
str =
id.GetStr();
195 if (
str.size() > db.size() &&
str[db.size()] ==
':'
220 const string& db =
GetDb();
232 bool found = (group &
fSrc);
250 const string& db =
GetDb();
274 const string& db =
GetDb();
276 auto allowed = xFindStrict(db);
277 return (allowed & group);
283 return sc_SkippableDbXrefs.find(
GetDb())
284 != sc_SkippableDbXrefs.end();
296 const string& db =
GetDb();
298 if (xGetStrict(db,
m_Type))
307 correct_caps.clear();
313 const string& db =
GetDb();
317 auto groups = xFindCorrectCaps(db, caps);
331 is_refseq = ((group &
fRefSeq) != 0);
332 is_src = ((group &
fSrc) != 0);
334 return group !=
fNone;
350 static constexpr string_view
kFBan =
"http://www.fruitfly.org/cgi-bin/annot/fban?";
351 static constexpr string_view
kHInvDbHIT =
"http://www.jbirc.aist.go.jp/hinv/hinvsys/servlet/ExecServlet?KEN_INDEX=0&KEN_TYPE=30&KEN_STR=";
352 static constexpr string_view
kHInvDbHIX =
"http://www.jbirc.aist.go.jp/hinv/hinvsys/servlet/ExecServlet?KEN_INDEX=0&KEN_TYPE=31&KEN_STR=";
353 static constexpr string_view
kDictyPrim =
"http://dictybase.org/db/cgi-bin/gene_page.pl?primary_id=";
354 static constexpr string_view
kMiRBaseMat =
"http://www.mirbase.org/cgi-bin/mature.pl?mature_acc=";
355 static constexpr string_view
kMaizeGDBInt =
"https://www.maizegdb.org/cgi-bin/displaylocusrecord.cgi?id=";
356 static constexpr string_view
kMaizeGDBStr =
"https://www.maizegdb.org/cgi-bin/displaylocusrecord.cgi?term=";
357 static constexpr string_view
kHomdTax =
"http://www.homd.org/taxon=";
358 static constexpr string_view
kHomdSeq =
"http://www.homd.org/seq=";
371 {
CDbtag::eDbtagType_ApiDB,
"http://www.apidb.org/apidb/showRecord.do?name=GeneRecordClasses.ApiDBGeneRecordClass&primary_key=" },
387 {
CDbtag::eDbtagType_FBOL,
"http://www.fungalbarcoding.org/BioloMICS.aspx?Table=Fungal%20barcodes&Fields=All&Rec=" },
390 {
CDbtag::eDbtagType_GABI,
"https://www.gabipd.org/database/cgi-bin/GreenCards.pl.cgi?Mode=ShowSequence&App=ncbi&SequenceId=" },
426 {
CDbtag::eDbtagType_OrthoMCL,
"http://orthomcl.org/orthomcl/showRecord.do?name=GroupRecordClasses.GroupRecordClass&group_name=" },
531 auto find_iter = sc_TaxIdTaxnameMap.find(taxid);
532 if( find_iter == sc_TaxIdTaxnameMap.end() ) {
535 const STaxidTaxname & taxinfo = find_iter->second;
536 return GetUrl( taxinfo.m_genus, taxinfo.m_species, taxinfo.m_subspecies );
546 if( taxname_arg.empty() || taxname_arg.length() > kMaxLen ) {
551 string taxname = taxname_arg;
555 const char ch = *str_iter;
566 vector<string> taxname_parts;
569 if( taxname_parts.size() == 2 || taxname_parts.size() == 3 ) {
574 genus = taxname_parts[0];
575 species = taxname_parts[1];
577 if( taxname_parts.size() == 3 ) {
578 subspecies = taxname_parts[2];
581 return GetUrl( genus, species, subspecies );
589 const string & species,
590 const string & subspecies)
const
592 auto it = sc_UrlMap.find(
GetType());
593 if (it == sc_UrlMap.end()) {
597 auto prefix = it->second;
600 bool nonInteger =
false;
605 }
else if (
GetTag().IsId()) {
635 string::const_iterator tag_iter =
tag.begin();
636 for ( ; tag_iter !=
tag.end() && !
isdigit(*tag_iter) ; ++tag_iter ) {
640 tag =
tag.substr(num_skip);
682 tag +=
"%20%5BUniSTS%20ID%5D";
701 }
else if (
GetTag().IsStr()) {
710 tag =
tag.substr(pos + 4);
712 }
else if (!
isdigit((
unsigned char)
tag[0])) {
736 tag.insert(0,
"id=");
738 tag.insert(0,
"name=");
761 num_alpha == 3 && num_digit == 5 )
763 prefix =
"http://www.wormbase.org/search/protein/";
779 tag +=
"&decorator=influenza";
787 tag +=
"&decorator=vipr";
791 if( ! genus.empty() ) {
792 string taxname_url_piece = genus +
"+" + species;
793 if( ! subspecies.empty() ) {
794 taxname_url_piece +=
"+" + subspecies;
798 "species=Homo+sapiens&",
799 "species=" + taxname_url_piece +
"&" ) +
806 prefix =
"http://www.ebi.ac.uk/Tools/dbfetch/dbfetch?db=imgthla;id=";
812 string::const_iterator tag_iter =
tag.begin();
815 if (*tag_iter ==
'P') {
817 if (*tag_iter ==
'_') {
818 prefix =
"https://www.ncbi.nlm.nih.gov/protein/";
850 if( ! genus.empty() && ! species.empty() ) {
856 string spc = species;
859 abbrev =
gen.substr(0, 1) + spc.substr(0, 1);
861 tag +=
"&db=" + abbrev;
882 if (
tag.empty() )
return false;
884 if (
tag.length() >= 16)
return false;
892 string::const_iterator tag_iter =
tag.begin();
896 for ( ; tag_iter !=
tag.end() &&
isalpha(*tag_iter); ++tag_iter ) {
899 for ( ; tag_iter !=
tag.end() && *tag_iter ==
'_'; ++tag_iter ) {
902 for ( ; tag_iter !=
tag.end() &&
isdigit(*tag_iter) ; ++tag_iter ) {
905 if ( tag_iter !=
tag.end() && *tag_iter !=
' ' && *tag_iter !=
'.') {
909 if (numUndersc > 1)
return false;
911 out_num_alpha = numAlpha;
912 out_num_digit = numDigits;
913 out_num_unscr = numUndersc;
915 if (numUndersc == 0) {
916 if (numAlpha == 1 && numDigits == 5)
return true;
917 if (numAlpha == 2 && numDigits == 6)
return true;
918 if (numAlpha == 3 && numDigits == 5)
return true;
919 if (numAlpha == 4 && numDigits == 8)
return true;
920 if (numAlpha == 4 && numDigits == 9)
return true;
921 if (numAlpha == 5 && numDigits == 7)
return true;
922 }
else if (numUndersc == 1) {
923 if (numAlpha != 2 || (numDigits != 6 && numDigits != 8 && numDigits != 9))
return false;
924 if (
tag[0] ==
'N' ||
tag[0] ==
'X' ||
tag[0] ==
'Z') {
937 if (
tag[0] ==
'A' ||
tag[0] ==
'Y') {
938 if (
tag[1] ==
'P')
return true;
static constexpr string_view kDictyPrim
static constexpr string_view kHomdTax
static constexpr string_view kMaizeGDBInt
MAKE_CONST_SET(sc_SkippableDbXrefs, ct::tagStrNocase, { "BankIt", "NCBIFILE", "TMSMART" }) struct STaxidTaxname
static constexpr string_view kMaizeGDBStr
static constexpr auto sc_ApprovedTags
static constexpr string_view kHomdSeq
MAKE_CONST_MAP(sc_TaxIdTaxnameMap, TTaxId, STaxidTaxname, { { 7955, { "Danio", "rerio", "" } }, { 8022, { "Oncorhynchus", "mykiss", "" } }, { 9606, { "Homo", "sapiens", "" } }, { 9615, { "Canis", "lupus", "familiaris" } }, { 9838, { "Camelus", "dromedarius", "" } }, { 9913, { "Bos", "taurus", "" } }, { 9986, { "Oryctolagus", "cuniculus", "" } }, { 10090, { "Mus", "musculus", "" } }, { 10093, { "Mus", "pahari", "" } }, { 10094, { "Mus", "saxicola", "" } }, { 10096, { "Mus", "spretus", "" } }, { 10098, { "Mus", "cookii", "" } }, { 10105, { "Mus", "minutoides", "" } }, { 10116, { "Rattus", "norvegicus", "" } }, { 10117, { "Rattus", "rattus", "" } } }) namespace
static constexpr string_view kMiRBaseMat
static constexpr string_view kHInvDbHIX
static constexpr string_view kFBan
static constexpr string_view kHInvDbHIT
void GetLabel(string *label) const
EDbtagType GetType(void) const
static bool x_LooksLikeAccession(const string &tag, int &out_num_alpha, int &out_num_digit, int &out_num_unscr)
bool Match(const CDbtag &dbt2) const
const char * IsApprovedNoCase(EIsRefseq refseq=eIsRefseq_No, EIsSource is_source=eIsSource_No) const
string GetUrl(void) const
void InvalidateType(void)
bool SetAsMatchingTo(const CDbtag &dbt2)
int TDbtagGroup
holds bitwise OR of "EDbtagGroup"
@ eDbtagType_EnsemblGenomes_Gn
@ eDbtagType_EnsemblGenomes_Tr
@ eDbtagType_EnsemblRapid
@ eDbtagType_AceView_WormGenes
@ eDbtagType_UniProt_SwissProt
@ eDbtagType_PeptideAtlas
@ eDbtagType_RBGE_herbarium
@ eDbtagType_ApiDB_ToxoDB
@ eDbtagType_AllianceGenome
@ eDbtagType_PiroplasmaDB
@ eDbtagType_EnsemblGenomes
@ eDbtagType_UniProt_TrEMBL
@ eDbtagType_NCBIOrtholog
@ eDbtagType_ApiDB_CryptoDB
@ eDbtagType_MicrosporidiaDB
@ eDbtagType_ApiDB_PlasmoDB
bool GetDBFlags(bool &is_refseq, bool &is_src, string &correct_caps) const
bool IsApproved(EIsRefseq refseq=eIsRefseq_No, EIsSource is_source=eIsSource_No, EIsEstOrGss is_est_or_gss=eIsEstOrGss_No) const
int Compare(const CDbtag &dbt2) const
bool IsSkippable(void) const
int Compare(const CObject_id &oid2) const
static constexpr auto construct(typename _Enabled::type const (&init)[N])
Include a standard set of the NCBI C++ Toolkit most basic headers.
static void DLIST_NAME() remove(DLIST_LIST_TYPE *list, DLIST_TYPE *item)
static const char * str(char *buf, int n)
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
SStrictId_Tax::TId TTaxId
Taxon id type.
virtual bool Equals(const CSerialObject &object, ESerialRecursionMode how=eRecursive) const
Check if both objects contain the same values.
const CSeq_id & GetId(const CSeq_loc &loc, CScope *scope)
If all CSeq_ids embedded in CSeq_loc refer to the same CBioseq, returns the first CSeq_id found,...
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
NCBI_NS_STD::string::size_type SIZE_TYPE
int Compare(const T &s1, const T &s2) const
Return difference between "s1" and "s2".
static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Split a string using specified delimiters.
static bool IsBlank(const CTempString str, SIZE_TYPE pos=0)
Check if a string is blank (has no text).
static void TruncateSpacesInPlace(string &str, ETrunc where=eTrunc_Both)
Truncate whitespace in a string (in-place)
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
static SIZE_TYPE Find(const CTempString str, const CTempString pattern, ECase use_case=eCase, EDirection direction=eForwardSearch, SIZE_TYPE occurrence=0)
Find the pattern in the string.
PNocase_Generic< string > PNocase
static string & Replace(const string &src, const string &search, const string &replace, string &dst, SIZE_TYPE start_pos=0, SIZE_TYPE max_replace=0, SIZE_TYPE *num_replace=0)
Replace occurrences of a substring within a string.
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
static bool Equal(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2, ECase use_case=eCase)
Test for equality of a substring with another string.
static string & ToLower(string &str)
Convert string to lower case – string& version.
@ fSplit_Tokenize
All delimiters are merged and trimmed, to get non-empty tokens only.
@ eNocase
Case insensitive compare.
static const char label[]
TTag & SetTag(void)
Assign a value to Tag data member.
const TTag & GetTag(void) const
Get the Tag member data.
bool CanGetDb(void) const
Check if it is safe to call GetDb method.
const TDb & GetDb(void) const
Get the Db member data.
TDb & SetDb(void)
Assign a value to Db data member.
const TStr & GetStr(void) const
Get the variant data.
std::false_type tagStrNocase