54 "[BankIt_uncultured16S_wizard]; [species_specific primers]; [tgge]",
55 "[BankIt_uncultured16S_wizard]; [species_specific primers]; [dgge]",
56 "[BankIt_uncultured16S_wizard]; [species_specific primers]",
57 "[uncultured (with species-specific primers)]",
58 "[uncultured]; [amplified with species-specific primers]",
59 "[uncultured (using species-specific primers) bacterial source]",
60 "[amplified with species-specific primers]; [uncultured; wizard]",
61 "[amplified with species-specific primers]",
62 "amplified with species-specific primers",
67 "[BankIt_uncultured16S_wizard]; [universal primers]; [tgge]",
68 "[BankIt_uncultured23S_wizard]; [universal primers]; [tgge]",
69 "[BankIt_uncultured16S-23SIGS_wizard]; [universal primers]; [tgge]",
70 "[BankIt_uncultured16S_wizard]; [universal primers]; [dgge]",
71 "[BankIt_uncultured23S_wizard]; [universal primers]; [dgge]",
72 "[BankIt_uncultured16S-23SIGS_wizard]; [universal primers]; [dgge]",
73 "[BankIt_uncultured16S_wizard]; [universal primers]",
74 "[BankIt_uncultured23S_wizard]; [universal primers]",
75 "[BankIt_uncultured16S-23SIGS_wizard]; [universal primers]",
76 "[universal primers]; [uncultured; wizard]",
77 "[uncultured (using universal primers)]",
78 "[uncultured (using universal primers) bacterial source]",
79 "[uncultured]; [universal primers]",
90 if ((*subtype)->IsSetSubtype()
92 && (*subtype)->IsSetName()) {
94 while (note_list[
i]) {
113 bsrc.
SetOrg().SetTaxname(suggested_taxname);
154 if (standard_taxname.empty())
161 submit.
insert(standard_taxname);
169 standard_taxname = name2;
170 submit.
insert(standard_taxname);
178 vector<CRef<COrg_ref> > rq_list;
182 rq_list.push_back(org);
188 if (!reply->IsSetReply())
254 string taxname =
m_Bsrc->GetTaxname();
256 while (old != taxname) {
258 const string uncultured =
"uncultured ";
259 const string sp =
" sp";
260 const string spdot =
" sp.";
262 taxname = taxname.substr(uncultured.length());
265 taxname = taxname.substr(0, taxname.length() - sp.length());
268 taxname = taxname.substr(0, taxname.length() - spdot.length());
279 return "uncultured " + taxname + suffix;
285 const string& orig_taxname =
m_Bsrc->GetTaxname();
288 if (reply_orig && reply_orig->
IsData()) {
295 if (standard_taxname.empty())
335 vector<CRef<COrg_ref> > rq_list;
338 rq_list.push_back(org);
344 if (reply->IsSetReply() && !reply->GetReply().empty()) {
345 t3reply = reply->GetReply().front();
372 if ((*subsrc)->IsSetSubtype()
405 if ((*status)->IsSetProperty()
407 && (*status)->IsSetValue()
408 && (*status)->GetValue().IsStr()) {
409 rank = (*status)->GetValue().GetStr();
418 if (reply && reply->
IsData()) {
441 bool is_species_level(
false), force_consult(
false), has_nucleomorphs(
false);
448 if (is_species_level) {
449 if (has_species_specific_note) {
453 if (has_universal_note) {
471 if (has_species_specific_note) {
474 if (has_universal_note) {
504 CBioSource::TSubtype::iterator subtype = bsrc.
SetSubtype().begin();
507 if ((*subtype)->IsSetSubtype()
509 && (*subtype)->IsSetName()) {
510 const string& name = (*subtype)->GetName();
512 while (note_list[
i]) {
514 if (new_note.empty()) {
518 (*subtype)->SetName(new_note);
541 "[BankIt_cultured16S_wizard]",
542 "[cultured bacterial source]",
543 "[BankIt_cultured16S_wizard]; [universal primers]",
544 "[cultured; wizard]",
545 "[BankIt_cultured16S_wizard]; [species_specific primers]; [tgge]" ,
546 "[BankIt_cultured16S_wizard]; [species_specific primers]; [dgge]" ,
547 "[BankIt_cultured16S_wizard]; [species_specific primers]",
548 "[BankIt_cultured23S_wizard]",
549 "[BankIt_cultured16S-23SIGS_wizard]",
559 string taxname =
m_Bsrc->GetTaxname();
560 if (taxname.empty())
return;
588 bsrc.
SetOrg().SetTaxname(taxname);
604 bool modified =
false;
608 if ((*subtype)->IsSetSubtype()
610 && (*subtype)->IsSetName()) {
611 const string& name = (*subtype)->GetName();
613 while (note_list[
i]) {
640 bool modified =
false;
642 auto&& orgmod = orgMods.begin();
643 while (orgmod != orgMods.end()) {
645 if ((*orgmod)->IsSetSubtype()
647 && (*orgmod)->IsSetSubname()) {
648 const string& name = (*orgmod)->GetSubname();
650 while (note_list[
i]) {
652 orgmod = orgMods.erase(orgmod);
665 if (orgMods.empty()) {
666 bsrc.
SetOrg().SetOrgname().ResetMod();
677 void CMacroFunction_UnculturedTaxLookup::TheFunction()
682 if (!bsrc || m_DataIter->IsFeature() || !bsrc->
IsSetTaxname()) {
686 const string orig_taxname = bsrc->
GetTaxname();
689 bool converted_note(
false), removed_note_sp(
false), removed_note_univ(
false);
690 uncultured_taxtool.
CorrectBioSource(*bsrc, converted_note, removed_note_sp, removed_note_univ);
691 bool changed = (!
NStr::EqualCase(orig_taxname, bsrc->
GetTaxname())) || converted_note || removed_note_sp || removed_note_univ;
694 m_DataIter->SetModified();
697 log <<
"Corrected " << orig_taxname <<
" to " << bsrc->
GetTaxname();
700 if (converted_note) {
701 msg.assign(
"Converted species-specific primer note to \"amplified with species-specific primers\" for ");
703 else if (removed_note_sp) {
704 msg.assign(
"Removed species-specific primer note for ");;
706 else if (removed_note_univ) {
707 msg.assign(
"Removed universal primer note for ");
719 bool CMacroFunction_UnculturedTaxLookup::x_ValidArguments()
const
721 return (m_Args.empty());
730 void CMacroFunction_CulturedTaxLookup::TheFunction()
735 if (!bsrc || m_DataIter->IsFeature()) {
739 const string orig_taxname = bsrc->
GetTaxname();
742 bool removed_note(
false);
747 m_DataIter->SetModified();
750 msg =
"Corrected " + orig_taxname +
" to " + bsrc->
GetTaxname();
764 bool CMacroFunction_CulturedTaxLookup::x_ValidArguments()
const
766 return (m_Args.empty());
const string & GetTaxname(void) const
bool IsSetOrgMod(void) const
bool IsSetTaxname(void) const
void GetTaxFlags(bool &is_species_level, bool &force_consult, bool &has_nucleomorphs) const
virtual CRef< CTaxon3_reply > SendOrgRefList(const vector< CRef< COrg_ref > > &list, COrg_ref::fOrgref_parts result_parts=COrg_ref::eOrgref_default, fT3reply_parts t3result_parts=eT3reply_default)
const_iterator end() const
const_iterator find(const key_type &key) const
iterator_bool insert(const value_type &val)
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
SStrictId_Tax::TId TTaxId
Taxon id type.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
bool m_RemoveNote_Sp
flag to remove species-specific note
static bool s_EditText(string &str, const string &find, const string &repl, ESearchLoc loc, bool case_sensitive, bool is_regex=false)
void CleanupForTaxnameChange(CObjectInfo oi)
bool m_RemoveNote_Univ
flag to remove universal note
static bool s_IsUnculturedName(const string &taxname)
static const char * sUnfixable[]
static bool s_CompareOrgnameLineage(CRef< objects::CT3Reply > reply, const string &lineage)
bool x_RemoveIfFoundSubSourceNote(objects::CBioSource &bsrc, const char *note_list[])
string GetSuggestedCorrection(void)
static const char * sCulturedNodes[]
class CCulturedTool
bool m_ConvertNote
flag to convert species-specific note
static bool s_OkToTaxFix(const string &taxname)
CRef< objects::CT3Reply > x_GetReply(const string &standard_taxname)
static bool s_HasSubSourceNote(const CBioSource &bsrc, const char *note_list[])
CConstRef< objects::CBioSource > m_Bsrc
CConstRef< objects::CBioSource > m_Bsrc
static string s_MakeUnculturedName(const string &taxname, const string &suffix=kEmptyStr)
void CorrectBioSource(objects::CBioSource &bsrc, bool &converted_note, bool &removed_note_sp, bool &removed_note_univ)
void CorrectBioSource(objects::CBioSource &bsrc, bool &remove_note)
bool x_CheckSuggestedFix(string &suggestion)
static bool s_IsAmbiguous(CRef< objects::CT3Reply > reply)
#define DEFINE_MACRO_FUNCNAME(CL_NAME, FN_NAME)
static string s_GetRank(CRef< objects::CT3Reply > reply)
static void s_AddEnvironmentalSample(objects::CBioSource &bsrc)
static const char * sSpeciesSpecificPrimers[]
constants used in the uncultured macro tool
static const char * sUniversalPrimers[]
map< string, CRef< objects::CT3Reply > > m_ReplyCache
void x_ConvertNote(objects::CBioSource &biosource, const char *note_list[], const string &new_note)
bool x_RemoveIfFoundOrgModNote(objects::CBioSource &bsrc, const char *note_list[])
static bool s_OrganismNotFound(CRef< objects::CT3Reply > reply)
bool x_ShouldLookupTaxname(void)
static bool s_HasTaxId(const objects::CBioSource &bsrc)
static string s_GetSuggestion(CRef< objects::CT3Reply > reply)
string x_TryRankFix(CRef< objects::CT3Reply > reply, string &name)
static const TObjectType * SafeCast(TTypeInfo type)
TObjectPtr GetObjectPtr(void) const
Get pointer to object.
CRef< C > Ref(C *object)
Helper functions to get CRef<> and CConstRef<> objects.
void Reset(void)
Reset reference object.
bool IsNull(void) const THROWS_NONE
Check if pointer is null – same effect as Empty().
TObjectType & GetObject(void) const
Get object.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define USING_SCOPE(ns)
Use the specified namespace.
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
#define BEGIN_SCOPE(ns)
Define a new scope.
bool IsOssEmpty(CNcbiOstrstream &oss)
static SIZE_TYPE FindNoCase(const CTempString str, const CTempString pattern, SIZE_TYPE start, SIZE_TYPE end, EOccurrence which=eFirst)
Find the pattern in the specified range of a string using a case insensitive search.
static bool EndsWith(const CTempString str, const CTempString end, ECase use_case=eCase)
Check if a string ends with a specified suffix value.
static bool EqualCase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-sensitive equality of a substring with another 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 SplitInTwo(const CTempString str, const CTempString delim, string &str1, string &str2, TSplitFlags flags=0)
Split a string into two pieces using the specified delimiters.
static bool EqualNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive equality of a substring with another string.
static string & ReplaceInPlace(string &src, const string &search, const string &replace, SIZE_TYPE start_pos=0, SIZE_TYPE max_replace=0, SIZE_TYPE *num_replace=0)
Replace occurrences of a substring within a string.
@ eNocase
Case insensitive compare.
const TSubtype & GetSubtype(void) const
Get the Subtype member data.
bool IsSetOrg(void) const
Check if a value has been assigned to Org data member.
list< CRef< CSubSource > > TSubtype
bool IsSetSubtype(void) const
Check if a value has been assigned to Subtype data member.
const TOrg & GetOrg(void) const
Get the Org member data.
void SetOrg(TOrg &value)
Assign a value to Org data member.
TSubtype & SetSubtype(void)
Assign a value to Subtype data member.
void ResetSubtype(void)
Reset Subtype data member.
@ eSubtype_environmental_sample
const TLineage & GetLineage(void) const
Get the Lineage member data.
bool IsSetLineage(void) const
lineage with semicolon separators Check if a value has been assigned to Lineage data member.
const TTaxname & GetTaxname(void) const
Get the Taxname member data.
void SetTaxname(const TTaxname &value)
Assign a value to Taxname data member.
list< CRef< COrgMod > > TMod
bool IsSetOrgname(void) const
Check if a value has been assigned to Orgname data member.
const TOrgname & GetOrgname(void) const
Get the Orgname member data.
bool IsData(void) const
Check if variant Data is selected.
const TData & GetData(void) const
Get the variant data.
bool IsSetStatus(void) const
Check if a value has been assigned to Status data member.
const TStatus & GetStatus(void) const
Get the Status member data.
bool IsSetOrg(void) const
Check if a value has been assigned to Org data member.
list< CRef< CT3StatusFlags > > TStatus
bool IsError(void) const
Check if variant Error is selected.
const TError & GetError(void) const
Get the variant data.
list< CRef< CT3Reply > > TReply
const TOrg & GetOrg(void) const
Get the Org member data.
const TMessage & GetMessage(void) const
Get the Message member data.
bool IsSetMessage(void) const
Check if a value has been assigned to Message data member.
#define FOR_EACH_SUBSOURCE_ON_BIOSOURCE(Itr, Var)
FOR_EACH_SUBSOURCE_ON_BIOSOURCE EDIT_EACH_SUBSOURCE_ON_BIOSOURCE.
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)