void CMacroFunction_SwapRelatedFeaturesQual_Depr::TheFunction()
79 CRef<CScope>scope = m_DataIter->GetScopedObject().scope;
80 if(!src_feat || !scope)
94src_objs = m_Args[0]->GetObjects();
97x_GetObjectsFromRef(src_objs, 0);
100 if(src_objs.empty()) {
108 if(feat_list.empty()) {
114new_feat->Assign(*orig_feat);
115 CObjectInfoobjInfo(new_feat.GetPointer(), new_feat.GetPointer()->GetTypeInfo());
118 const string& dest_field = m_Args[2]->GetString();
119 if(!
GetFieldsByName(&dest_objs, objInfo, dest_field) || dest_objs.empty()) {
123CMQueryNodeValue::TObs::iterator src_it = src_objs.begin();
124CMQueryNodeValue::TObs::iterator dest_it = dest_objs.begin();
126 while(src_it != src_objs.end() && dest_it != dest_objs.end()) {
130m_QualsChangedCount += 2;
136 if(m_QualsChangedCount) {
137m_DataIter->SetModified();
141m_DataIter->RunCommand(
cmd, m_CmdComposite);
144report[
"swapping qualifiers"] = m_QualsChangedCount;
146x_LogChangedQuals(fnc_log);
150 boolCMacroFunction_SwapRelatedFeaturesQual_Depr::x_ValidArguments()
const 152 if(m_Args.size() != 3) {
156 if(!(m_Args[0]->IsString() || m_Args[0]->AreObjects() || m_Args[0]->IsRef()))
159 for(
size_tindex = 1; index < m_Args.size(); ++index) {
185 const string& field_name = m_Args[0]->GetString();
190res_oi = m_Args[0]->GetObjects();
193x_GetObjectsFromRef(res_oi, 0);
196 if(res_oi.empty()) {
200m_QualsChangedCount = s_RemoveFields(m_DataIter, res_oi);
202 if(m_QualsChangedCount) {
204report[
"removal of qualifiers"] = m_QualsChangedCount;
206x_LogChangedQuals(fnc_log);
212 if(
m_Args.empty())
return false;
213 boolfirst_ok = (
m_Args[0]->IsString() ||
m_Args[0]->AreObjects() ||
m_Args[0]->IsRef());
214 return(
m_Args.size() == 1 && first_ok);
222 Int4quals_changed = 0;
226 boolis_gene_suppressed_before =
false;
227 boolis_gene_suppressed_after =
false;
232is_gene_suppressed_before = gene_xref && gene_xref->
IsSuppressed();
267dataiter->SetToDelete(
true);
284dataiter->SetToDelete(
true);
294 cleanup.BasicCleanup(*seq_feat);
299 if(!is_gene_suppressed_before && is_gene_suppressed_after)
308bsrc->
SetOrg().ResetDb();
313dataiter->SetModified();
315 returnquals_changed;
324bsrc.
SetOrg().SetOrgname().ResetMod();
342void CMacroFunction_RemoveModifier::TheFunction()
346x_GetObjectsFromRef(res_oi, 0);
347 if(res_oi.empty()) {
361m_QualsChangedCount++;
365 if(m_QualsChangedCount) {
369m_DataIter->SetModified();
372report[
"removing source modifiers"] = m_QualsChangedCount;
374x_LogChangedQuals(fnc_log);
378 boolCMacroFunction_RemoveModifier::x_ValidArguments()
const 403res_oi = m_Args[0]->GetObjects();
406x_GetObjectsFromRef(res_oi, 0);
410 if(res_oi.empty()) {
416x_RmvOutsideFields(res_oi, *options);
418 if(m_QualsChangedCount) {
420m_DataIter->SetModified();
423 log<< m_DataIter->GetBestDescr() <<
": removed text outside string in "<< m_QualsChangedCount <<
" qualifiers";
425 boolupdate_mrna = (m_Args.size() == 10) ? m_Args[9]->GetBool() :
false;
431 CRef<CScope>scope = m_DataIter->GetScopedObject().scope;
436m_DataIter->RunCommand(
cmd, m_CmdComposite);
437 log<<
", applied "+ prot_product +
" to mRNA product name ";
440x_LogFunction(
log);
447 stringleft_del =
m_Args[start_index + 1]->GetString();
448 boolremove_before_match =
false;
449 if(
m_Args[start_index]->GetBool()) {
461remove_before_match =
m_Args[start_index + 2]->GetBool();
466 stringright_del =
m_Args[start_index + 4]->GetString();
467 boolremove_after_match =
false;
468 if(
m_Args[start_index + 3]->GetBool()) {
480remove_after_match =
m_Args[start_index + 5]->GetBool();
483 boolcase_insensitive =
m_Args[start_index + 6]->GetBool();
484 boolwhole_word =
m_Args[start_index + 7]->GetBool();
487after_match, right_del, remove_after_match,
488case_insensitive, whole_word));
494 for(
auto& it : resolved_objs) {
497 for(
auto& iter : objs) {
559 for(
size_t i= index;
i<
m_Args.size(); ++
i) {
580 const string& action_type = m_Args[++index]->GetString();
582 boolremove_field =
false;
583x_GetOptionalArgs(
delimiter, remove_field, index);
590 if(remove_field && newValue.empty()) {
594 else if(!newValue.empty() && !
SetFieldsByName(&res_oi, oi, m_Args[0]->GetString())) {
599res_oi = m_Args[0]->GetObjects();
602x_GetObjectsFromRef(res_oi, 0);
605 if(res_oi.empty()) {
609 if(!newValue.empty()) {
610vector<string> new_values;
612x_SetFields(res_oi, newValue, existing_text, new_values);
614m_Result->SetBool(
false);
615 if(m_QualsChangedCount) {
617m_DataIter->SetModified();
618m_Result->SetBool(
true);
621 for(
size_t i= 0;
i< new_values.size(); ++
i) {
622 log<< m_DataIter->GetBestDescr() <<
": set '"<< new_values[
i] <<
"' as a new value\n";
624x_LogFunction(
log);
627 else if(remove_field) {
629 if(m_QualsChangedCount) {
631 log<< m_DataIter->GetBestDescr() <<
": removed "<< m_QualsChangedCount <<
" qualifiers";
632x_LogFunction(
log);
640 size_targ_nr =
m_Args.size();
641 if(arg_nr < 3 && arg_nr > 5) {
646 boolfirst_ok =
m_Args[index]->IsString() ||
m_Args[index]->AreObjects() ||
m_Args[index]->IsRef();
647 if(!first_ok)
return false;
651 boolsecond_ok =
m_Args[index]->IsString() ||
m_Args[index]->IsInt() ||
m_Args[index]->IsDouble();
652 if(!second_ok)
return false;
654 if(!
m_Args[++index]->IsString())
return false;
656 if(arg_nr > 3 && (!
m_Args[++index]->IsString() && !
m_Args[index]->IsBool()))
return false;
658 if(arg_nr > 4 && !
m_Args[++index]->IsBool())
return false;
666 for(
auto& it : objs) {
677new_values.push_back(newValue);
694new_values.push_back(newValue);
699new_values.push_back(newValue);
704 if(objs.size() > 1) {
716new_values.push_back(newValue);
744new_values.push_back(orig_value);
751new_values.push_back(newValue);
760void CMacroFunction_SetRnaProduct::TheFunction()
763 const CSeq_feat* seq_feat =
dynamic_cast<const CSeq_feat*
>(
object.GetPointer());
764 CRef<CScope>scope = m_DataIter->GetScopedObject().scope;
765 if(!seq_feat || !seq_feat->
GetData().
IsRna() || !scope)
770 const string& action_type = m_Args[++index]->GetString();
772 boolremove_field =
false;
773x_GetOptionalArgs(
delimiter, remove_field, index);
782 if(!newValue.empty()) {
786m_QualsChangedCount++;
787 if(!remainder.empty()) {
795 else if(remove_field) {
798m_QualsChangedCount++;
801 if(m_QualsChangedCount) {
802m_DataIter->SetModified();
805 log<< m_DataIter->GetBestDescr();
806 if(newValue.empty() && remove_field) {
807 log<<
": removed rna product";
810 log<<
": set '"<< orig_value <<
"' as new rna product value";
816 boolCMacroFunction_SetRnaProduct::x_ValidArguments()
const 819 size_targ_nr = m_Args.size();
820 if(arg_nr < 2 && arg_nr > 4) {
826 boolfirst_ok = m_Args[index]->IsString() || m_Args[index]->IsInt() || m_Args[index]->IsDouble();
827 if(!first_ok)
return false;
829 if(!m_Args[++index]->IsString())
return false;
830 if(arg_nr > 2 && (!m_Args[++index]->IsString() && !m_Args[index]->IsBool()))
return false;
831 if(arg_nr > 3 && !m_Args[++index]->IsBool())
return false;
843void CMacroFunction_GetRnaProduct::TheFunction()
847 CRef<CScope>scope = m_DataIter->GetScopedObject().scope;
848m_Result->SetNotSet();
855 if(m_Nested == eNotNested) {
856m_Result->SetString(
value);
861new_node->SetString(
value);
862m_Result->SetRef(new_node);
866 boolCMacroFunction_GetRnaProduct::x_ValidArguments()
const 868 return(m_Args.empty());
875void CMacroFunction_RemoveRnaProduct::TheFunction()
879 CRef<CScope>scope = m_DataIter->GetScopedObject().scope;
880 if(!edit_feat || !edit_feat->
GetData().
IsRna() || !scope)
887m_DataIter->SetModified();
888m_QualsChangedCount++;
891report[
"removing RNA product"] = m_QualsChangedCount;
893x_LogChangedQuals(fnc_log);
896 boolCMacroFunction_RemoveRnaProduct::x_ValidArguments()
const 898 return(m_Args.empty());
913 const string&
location= m_Args[++index]->GetString();
914 boolcase_sensitive = m_Args[++index]->GetBool();
915 boolis_regex = (++index < m_Args.size()) ? m_Args[index]->GetBool() :
false;
917m_Result->SetBool(
false);
928res_oi = m_Args[0]->GetObjects();
931x_GetObjectsFromRef(res_oi, 0);
935 if(res_oi.empty()) {
939x_EditFields(res_oi, find_txt, repl_txt, s_GetLocFromName(
location), case_sensitive, is_regex);
940 if(m_QualsChangedCount) {
943m_DataIter->SetModified();
944m_Result->SetBool(
true);
947 log<< m_DataIter->GetBestDescr() <<
": edited "<< m_QualsChangedCount <<
" qualifiers, replaced "<< find_txt;
949repl_txt.assign(
"''");
951 log<<
" with "<< repl_txt;
952x_LogFunction(
log);
957 const string& replace,
ESearchLocloc,
boolcase_sensitive,
boolis_regex)
981 while(pos !=
NPOS) {
982 str=
str.substr(0, pos) + replace +
str.substr(pos + find.length());
983 if(case_sensitive) {
999 else if(loc ==
eEnd) {
1001pos =
str.length() - find.length();
1005 str=
str.substr(0, pos) + replace +
str.substr(pos + find.length());
1017 const string& find_txt,
1018 const string& repl_txt,
1020 boolcase_sensitive,
1023 for(
auto& it : resolved_objs) {
1026 for(
auto& iter : objs) {
1030 if(
s_EditText(
value, find_txt, repl_txt, loc, case_sensitive, is_regex)) {
1048 if(
s_EditText(orig_val, find_txt, repl_txt, loc, case_sensitive, is_regex)) {
1063 if(
s_EditText(
value, find_txt, repl_txt, loc, case_sensitive, is_regex)) {
1099 boolfirst_ok =
m_Args[0]->IsString() ||
m_Args[0]->AreObjects() ||
m_Args[0]->IsRef();
1104 for(
size_tindex = 1; index < 3; index++) {
1105 if(!
m_Args[index]->IsString() && !
m_Args[index]->IsInt()) {
1109 if(
m_Args.size() == 6) {
1110 if(!
m_Args.back()->IsBool())
1113 return(
m_Args[3]->IsString() &&
m_Args[4]->IsBool());
1120vector<string>
kSatelliteTypes= {
"satellite",
"microsatellite",
"minisatellite"};
1121vector<string> kMobileETypeTypes = {
1122 "insertion sequence",
1126 "non-LTR retrotransposon",
1132 "transposable element",
1139 boolIstRNAProductField(
const CSeq_feat& feat,
const string& field_name);
1144 const CSeq_feat* seq_feat =
dynamic_cast<const CSeq_feat*
>(
object.GetPointer());
1146 returnGetBioSourceDestObjects(oi, field_name,
result);
1150 returnSetFeatDestinationField(
Ref(feat), field_name,
result);
1158 if(field_name.empty())
1161 size_torig_size = dest_objs.size();
1174 if((*subsrc)->IsSetSubtype() && (*subsrc)->GetSubtype() ==
st) {
1175 CObjectInfosubsrc_oi((*subsrc).GetPointer(), (*subsrc)->GetTypeInfo());
1181 if(dest_objs.empty()) {
1183sub_src->SetSubtype(
st);
1185 CObjectInfosubsrc_oi(sub_src.GetPointer(), sub_src->GetTypeInfo());
1195 if((*orgmod)->IsSetSubtype() && (*orgmod)->GetSubtype() ==
st) {
1196 CObjectInfoorgmod_oi((*orgmod).GetPointer(), (*orgmod)->GetTypeInfo());
1202 if(dest_objs.empty()) {
1204orgmod->SetSubtype(
st);
1208orgname->SetMod().push_back(orgmod);
1209bsrc->
SetOrg().SetOrgname(*orgname);
1212bsrc->
SetOrg().SetOrgname().SetMod().push_back(orgmod);
1214 CObjectInfoorgmod_oi(orgmod.GetPointer(), orgmod->GetTypeInfo());
1224 returndest_objs.size() - orig_size > 0;
1230 if(feat.
IsNull() || field_name.empty())
1238 size_torig_size =
result.size();
1239 stringfield = field_name;
1241field =
"satellite";
1244field =
"mobile-element-type";
1249 if((*gbq_it)->IsSetQual() &&
NStr::EqualNocase((*gbq_it)->GetQual(), field)) {
1250 CObjectInfogbqual_oi((*gbq_it).GetPointer(), (*gbq_it)->GetTypeInfo());
1261feat->
SetQual().push_back(new_gbqual);
1262 CObjectInfogbqual_oi(new_gbqual.GetPointer(), new_gbqual->GetTypeInfo());
1267 return result.size() - orig_size > 0;
1272 if(field_name.empty())
1280 stringfield = field_name;
1282field =
"satellite";
1285field =
"mobile-element-type";
1290 if((*gbq_it)->IsSetQual() &&
NStr::EqualNocase((*gbq_it)->GetQual(), field)) {
1291 CObjectInfogbqual_oi((*gbq_it).GetPointer(), (*gbq_it)->GetTypeInfo());
1296 return(!
result.empty());
1299 boolIstRNAProductField(
const CSeq_feat& feat,
const string& field_name)
1313 returnCreateNewGene(src_feat, scope);
1318 returnCreateNewProtein(src_feat, scope);
1353new_gene->SetLocation(*gene_loc);
1382list<CMappedFeat> cds_feats;
1384 for(
auto& it : cds_feats) {
1385 if(it.IsSetProduct()) {
1423 if(!x_GetSourceFields(oi, index, src_objs))
1427 if(!x_GetDestFields(oi, ++index, dest_objs))
1430 const string& action_type = m_Args[++index]->GetString();
1431 string delimiter= (++index < m_Args.size()) ? m_Args[index]->GetString() :
kEmptyStr;
1436 if(src_feat && m_Args[1]->IsString() &&
NStr::EndsWith(m_Args[1]->GetString(),
"::product")) {
1438 for(
auto&& it : src_objs) {
1443 stringsrc_val = x_GetSourceString(src);
1446edit_feat->
SetData().SetRna().SetRnaProductName(src_val, remainder);
1447m_QualsChangedCount++;
1451ChangeFields(src_objs, dest_objs);
1454 if(m_QualsChangedCount) {
1455 if(!dest_objs.empty()) {
1458m_DataIter->SetModified();
1460 log<< m_DataIter->GetBestDescr() <<
": copied "<< m_QualsChangedCount <<
" qualifiers";
1461x_LogFunction(
log);
1467 size_targ_size =
m_Args.size();
1468 if(arg_size != 3 && arg_size != 4) {
1472 for(
size_t i= 0;
i< 2; ++
i) {
1481 for(
size_t i= 2;
i< arg_size; ++
i) {
1514 if(!src_feat || !scope)
1517 const string& dest_field =
m_Args[2]->GetString();
1518 if(dest_field.empty())
1530 boolchanged =
false,
created=
false;
1533 if(!feat_list.empty() && feat_list.size() == 1) {
1535dest_feat->
Assign(*feat_list.front());
1536 if(!SetFeatDestinationField(dest_feat, dest_field, dest_objs)) {
1544dest_feat = CreateNewRelatedFeature(*src_feat, dest_field, *scope);
1545 if(!dest_feat)
return;
1546 if(!SetFeatDestinationField(dest_feat, dest_field, dest_objs)) {
1553 if((*it)->IsSetData() && (*it)->GetData().IsProt()) {
1554dest_feat->
SetData().SetProt().Assign((*it)->GetData().GetProt());
1555edit_feat->
SetXref().erase(it);
1559 if(edit_feat->
GetXref().empty()) {
1566 boolupdate_mrna =
m_Args[index]->GetBool();
1567 const string& action_type =
m_Args[++index]->GetString();
1572 if(IstRNAProductField(*dest_feat, dest_field)) {
1573 for(
auto&& it : src_objs) {
1581dest_feat->
SetData().SetRna().SetRnaProductName(src_val, remainder);
1595 if(changed && fh) {
1610 cmd->AddCommand(*upd_cmd);
1611 log<<
", "<< message;
1619 cmd->AddCommand(*upd_cmd);
1620 log<<
", applied "+ prot_product +
" to mRNA product name ";
1638 for(
size_tindex = 1; index <
m_Args.size(); ++index) {
1661 if(!rna_feat || !scope)
1667 const string& src_feat =
m_Args[0]->GetString();
1668 const string& dest_feat =
m_Args[2]->GetString();
1669 if(src_feat ==
"rna"&& src_feat == dest_feat)
1672 if((src_feat !=
"rna"&& src_feat !=
"gene") || (dest_feat !=
"rna"&& dest_feat !=
"gene"))
1676 const string& action_type =
m_Args[index]->GetString();
1680 if(src_feat ==
"rna"&& dest_feat ==
"gene") {
1686 const stringdest_field =
m_Args[3]->GetString();
1690 boolchanged =
false,
created=
false;
1693 if(!feat_list.empty() && feat_list.size() == 1) {
1695dest_feat->
Assign(*feat_list.front());
1696 if(!SetFeatDestinationField(dest_feat, dest_field, dest_objs)) {
1704dest_feat = CreateNewRelatedFeature(*rna_feat, dest_field, *scope);
1705 if(!dest_feat)
return;
1706 if(!SetFeatDestinationField(dest_feat, dest_field, dest_objs)) {
1716 if(changed && fh) {
1732 else if(src_feat ==
"gene"&& dest_feat ==
"gene") {
1738 if(!feat_list.empty() && feat_list.size() == 1) {
1740gene_feat->
Assign(*feat_list.front());
1771 else if(src_feat ==
"gene"&& dest_feat ==
"rna") {
1776 if(!feat_list.empty() && feat_list.size() == 1) {
1778gene_feat->
Assign(*feat_list.front());
1795 for(
auto&& it : src_objs) {
1803edit_feat->
SetData().SetRna().SetRnaProductName(src_val, remainder);
1825 if(!
m_Args[0]->IsString() || !
m_Args[2]->IsString() || !
m_Args[4]->IsString())
1828 for(
size_tindex = 1; index < 4; index += 2) {
1829 if(!(
m_Args[index]->IsString() ||
m_Args[index]->AreObjects() ||
m_Args[index]->IsRef()))
1847 if(!src_feat || !scope)
1851 const string& field_name =
m_Args[1]->GetString();
1857 const string& action_type =
m_Args[++index]->GetString();
1859 boolremove_field =
false;
1860 boolupdate_mrna =
false;
1861 size_targ_nr =
m_Args.size();
1863 if(++index < arg_nr) {
1864 if(
m_Args[index]->IsString()) {
1866 if(++index < arg_nr) {
1867remove_field =
m_Args[index]->GetBool();
1868 if(++index < arg_nr)
1869update_mrna =
m_Args[index]->GetBool();
1872 else if(
m_Args[index]->IsBool()) {
1873remove_field =
m_Args[index]->GetBool();
1874 if(++index < arg_nr)
1875update_mrna =
m_Args[index]->GetBool();
1880 if(!newValue.empty()) {
1882 boolchanged =
false,
created=
false;
1885 if(!feat_list.empty() && feat_list.size() == 1) {
1887dest_feat->
Assign(*feat_list.front());
1888 if(!SetFeatDestinationField(dest_feat, field_name, objs)) {
1897dest_feat = CreateNewRelatedFeature(*src_feat, field_name, *scope);
1898 if(!dest_feat)
return;
1899 if(!SetFeatDestinationField(dest_feat, field_name, objs)) {
1906 if((*it)->IsSetData() && (*it)->GetData().IsProt()) {
1907dest_feat->
SetData().SetProt().Assign((*it)->GetData().GetProt());
1908edit_feat->
SetXref().erase(it);
1913 if(edit_feat->
GetXref().empty()) {
1919vector<string> new_values;
1920 x_SetFields(objs, newValue, existing_text, new_values);
1926 for(
size_t i= 0;
i< new_values.size(); ++
i) {
1927 log<<
": set '"<< new_values[
i] <<
"' as a new value";
1930 if(changed && fh) {
1937 cmd->AddCommand(*upd_cmd);
1938 log<<
", applied "+ prot_product +
" to mRNA product name ";
1951 cmd->AddCommand(*upd_cmd);
1952 log<<
", "<< message;
1961 else if(remove_field) {
1965 if(!feat_list.empty() && feat_list.size() == 1) {
1967dest_feat->
Assign(*feat_list.front());
1968 if(!GetFeatDestinationField(dest_feat, field_name, objs)) {
1974 for(
auto& it : objs) {
1984 cleanup.BasicCleanup(*dest_feat);
1994 cmd->AddCommand(*upd_cmd);
1995 log<<
", "<< message;
2008 size_targ_nr =
m_Args.size();
2009 if(arg_nr < 4 && arg_nr > 7) {
2015 for(; index < 4; ++index) {
2016 if(!
m_Args[index]->IsString())
2020 if(index < arg_nr && (!
m_Args[index]->IsString() && !
m_Args[index]->IsBool()))
return false;
2021 if(++index < arg_nr && !
m_Args[index]->IsBool())
return false;
2022 if(++index < arg_nr && !
m_Args[index]->IsBool())
return false;
2037 if(!src_feat || !scope)
2044 boolcase_sensitive =
m_Args[++index]->GetBool();
2045 boolis_regex = (++index <
m_Args.size()) ?
m_Args[index]->GetBool() :
false;
2048 const string& field_name =
m_Args[1]->GetString();
2055 if(!feat_list.empty() && feat_list.size() == 1) {
2057dest_feat->
Assign(*feat_list.front());
2058 if(!GetFeatDestinationField(dest_feat, field_name, objs)) {
2075repl_txt.assign(
"''");
2077 log<<
" with "<< repl_txt;
2087 for(
size_tindex = 2; index < 4; index++) {
2093 if(
m_Args.size() == 7) {
2108void CMacroFunction_RmvRelFeatQual::TheFunction()
2112 CRef<CScope>scope = m_DataIter->GetScopedObject().scope;
2113 if(!src_feat || !scope)
2117 const string& field_name = m_Args[1]->GetString();
2124 if(!feat_list.empty() && feat_list.size() == 1) {
2126dest_feat->
Assign(*feat_list.front());
2127 if(!GetFeatDestinationField(dest_feat, field_name, objs)) {
2133 for(
auto& it : objs) {
2135m_QualsChangedCount++;
2140 if(m_QualsChangedCount) {
2143 cleanup.BasicCleanup(*dest_feat);
2147m_DataIter->RunCommand(
cmd, m_CmdComposite);
2150 log<< m_DataIter->GetBestDescr() <<
": removed "<< m_QualsChangedCount <<
" qualifiers";
2155 boolCMacroFunction_RmvRelFeatQual::x_ValidArguments()
const 2157 if(m_Args.size() != 2)
2161 return(m_Args[0]->IsString() && m_Args[1]->IsString());
2176 CRef<CScope>scope = m_DataIter->GetScopedObject().scope;
2177 if(!src_feat || !scope)
2181 const string& field_name = m_Args[1]->GetString();
2189 if(!feat_list.empty() && feat_list.size() == 1) {
2191dest_feat->
Assign(*feat_list.front());
2192 if(!GetFeatDestinationField(dest_feat, field_name, objs)) {
2199x_RmvOutsideFields(objs, *options);
2200 if(m_QualsChangedCount) {
2204m_DataIter->RunCommand(
cmd, m_CmdComposite);
2208 log<< m_DataIter->GetBestDescr() <<
": removed text outside string in "<< m_QualsChangedCount <<
" qualifiers";
2210 boolupdate_mrna = (m_Args.size() == 11) ? m_Args[10]->GetBool() :
false;
2213 CRef<CScope>scope = m_DataIter->GetScopedObject().scope;
2217m_DataIter->RunCommand(
cmd, m_CmdComposite);
2218 log<<
", applied "+ prot_product +
" to mRNA product name ";
2222x_LogFunction(
log);
2241 _ASSERT(!src_objs.empty() && !dest_objs.empty());
2242CMQueryNodeValue::TObs::iterator src_it = src_objs.begin();
2243CMQueryNodeValue::TObs::iterator dest_it = dest_objs.begin();
2245 while(src_it != src_objs.end()) {
2252 CObjectInfonew_oi(dest_it->field.AddNewElement());
2255 for(
auto& it : src_prim_objs) {
2261 if(dest_it == dest_objs.end()) {
2269 if(index >=
m_Args.size())
2287 return(!
result.empty());
2296 const string& dest_field =
m_Args[index]->GetString();
2298 boolvalid = GetDestinationObjects(
object, oi, dest_field,
result);
2299 if(valid &&
result.empty())
2308 return!
result.empty();
2337 if(src.
GetName() ==
"Dbtag") {
2340 tag->GetLabel(&src_val);
2362 if(!x_GetSourceFields(oi, index, src_objs))
2366 if(!x_GetDestFields(oi, ++index, dest_objs))
2369 const string& capitalization = m_Args[++index]->GetString();
2373 const string& action_type = m_Args[++index]->GetString();
2374 string delimiter= (++index < m_Args.size()) ? m_Args[index]->GetString() :
kEmptyStr;
2380 if(src_feat && m_Args[1]->IsString() &&
NStr::EndsWith(m_Args[1]->GetString(),
"::product")) {
2382 for(
auto&& it : src_objs) {
2387 stringsrc_val = x_GetSourceString(src);
2390edit_feat->
SetData().SetRna().SetRnaProductName(src_val, remainder);
2391m_QualsChangedCount++;
2395ChangeFields(src_objs, dest_objs);
2398 if(m_QualsChangedCount) {
2399 if(!dest_objs.empty()) {
2402m_DataIter->SetModified();
2404 log<< m_DataIter->GetBestDescr() <<
": converted "<< m_QualsChangedCount <<
" qualifiers";
2405x_LogFunction(
log);
2436 size_tas =
m_Args.size();
2437 if(!(as == 5 || as == 6)) {
2441 for(
size_t i= 0;
i< 2; ++
i) {
2478 size_tsrc_index = 0, dest_index = 1;
2481|| m_Args.size() == 4) {
2486 boolsrc_set = x_DoFieldsExist(oi, src_objs, src_index);
2487 booldest_set = x_DoFieldsExist(oi, dest_objs, dest_index);
2489 if(!src_set && !dest_set)
2493 boolis_gene_suppressed_before =
false;
2494 boolis_gene_suppressed_after =
false;
2499is_gene_suppressed_before = gene_xref && gene_xref->
IsSuppressed();
2503x_SetFields(oi, src_objs, src_index);
2506x_SetFields(oi, dest_objs, dest_index);
2509 if(src_set && dest_set) {
2510CMQueryNodeValue::TObs::iterator src_it = src_objs.begin();
2511CMQueryNodeValue::TObs::iterator dest_it = dest_objs.begin();
2513 while(src_it != src_objs.end() && dest_it != dest_objs.end()) {
2520 CObjectInfonew_oi(dest_it->field.AddNewElement());
2523x_SwapFields(src_prim_objs.front().field, dest_prim_objs.front().field);
2531 else if(!src_set) {
2533x_CopyFields(dest_objs, src_objs);
2544 else if(!dest_set) {
2546x_CopyFields(src_objs, dest_objs);
2561 cleanup.BasicCleanup(*seq_feat);
2564is_gene_suppressed_after = gene_xref->
IsSuppressed();
2565 if(!is_gene_suppressed_before && is_gene_suppressed_after)
2573bsrc->
SetOrg().ResetDb();
2577 if(m_QualsChangedCount) {
2578m_DataIter->SetModified();
2580 log<< m_DataIter->GetBestDescr() <<
": swapped "<< m_QualsChangedCount <<
" qualifiers";
2581x_LogFunction(
log);
2587 if(
m_Args.size() < 2) {
2591 for(
auto& it :
m_Args) {
2603 if(index >=
m_Args.size())
2617 return(!
result.empty());
2622 if(index >=
m_Args.size())
2634 return(!
result.empty());
2639 if(field_name.empty())
2665orgname->
SetMod().push_back(orgmod);
2666bsrc->
SetOrg().SetOrgname(*orgname);
2669orgname =
Ref(&(bsrc->
SetOrg().SetOrgname()));
2670orgname->
SetMod().push_back(orgmod);
2684 if(field_name.empty())
2692feat->
SetQual().push_back(new_gbqual);
2753 boolswapped =
false;
2830CMQueryNodeValue::TObs::iterator src_it = src_objs.begin();
2831CMQueryNodeValue::TObs::iterator dest_it = dest_objs.begin();
2833 while(src_it != src_objs.end() && dest_it != dest_objs.end()) {
2841 CObjectInfonew_oi(dest_it->field.AddNewElement());
2844 x_CopyFields(src_prim_objs.front().field, dest_prim_objs.front().field);
2882 CRef<CScope>scope = m_DataIter->GetScopedObject().scope;
2883 if(!src_feat || !scope)
2886 size_tsrc_index = 0, dest_index = 1;
2887 if(m_Args.size() == 5) {
2890 if(m_Args[dest_index]->GetString().empty() || m_Args[dest_index + 1]->GetString().empty())
2893 const string& dest_feattype = m_Args[dest_index]->GetString();
2894 const string& dest_field = m_Args[dest_index + 1]->GetString();
2896m_Args[src_index]->GetString() :
kEmptyStr;
2899m_ConstDestFeat.Reset(
nullptr);
2900m_EditDestFeat.Reset(
nullptr);
2901m_CreatedFeat.Reset(
nullptr);
2909 boolsrc_set = x_DoFieldsExist(oi, src_objs, src_index);
2910 if(IstRNAProductField(*src_feat, src_field)) {
2913 booldest_set = x_DoDestFeatFieldsExist(*src_feat, dest_objs, dest_feattype, dest_field);
2915 if(!src_set && !dest_set)
2919x_SetFields(oi, src_objs, src_index);
2922x_SetOrCreateDestFeatFields(*src_feat, dest_objs, dest_index + 1);
2925 if(src_set && dest_set) {
2926CMQueryNodeValue::TObs::iterator src_it = src_objs.begin();
2927CMQueryNodeValue::TObs::iterator dest_it = dest_objs.begin();
2929 while(src_it != src_objs.end() && dest_it != dest_objs.end()) {
2936 CObjectInfonew_oi(dest_it->field.AddNewElement());
2939x_SwapFields(src_prim_objs.front().field, dest_prim_objs.front().field);
2945 if(m_EditDestFeat && IstRNAProductField(*m_EditDestFeat, dest_field)) {
2946 while(src_it != src_objs.end()) {
2950 stringdest_str = m_EditDestFeat->GetData().GetRna().GetRnaProductName();
2957m_EditDestFeat->SetData().SetRna().SetRnaProductName(
tmp, remainder);
2958m_QualsChangedCount++;
2963 else if(IstRNAProductField(*src_feat, src_field)) {
2964 while(dest_it != dest_objs.end()) {
2969 CObjectInfonew_oi(dest_it->field.AddNewElement());
2980seq_feat->
SetData().SetRna().SetRnaProductName(
tmp, remainder);
2981m_QualsChangedCount++;
2987 else if(!src_set) {
2989x_CopyFields(dest_objs, src_objs);
2991 if(IstRNAProductField(*seq_feat, src_field)) {
2992CMQueryNodeValue::TObs::iterator dest_it = dest_objs.begin();
2994 while(dest_it != dest_objs.end()) {
3008seq_feat->
SetData().SetRna().SetRnaProductName(dest_val, remainder);
3009m_QualsChangedCount++;
3014 if(m_EditDestFeat && IstRNAProductField(*m_EditDestFeat, dest_field)) {
3015CMQueryNodeValue::TObs::iterator src_it = src_objs.begin();
3017 while(src_it != src_objs.end()) {
3021 stringrna_str = m_EditDestFeat->GetData().GetRna().GetRnaProductName();
3024m_QualsChangedCount++;
3030 if(m_EditDestFeat && IstRNAProductField(*m_EditDestFeat, dest_field)) {
3032m_EditDestFeat->SetData().SetRna().SetRnaProductName(
kEmptyStr, remainder);
3036 if(it->parent.GetName() ==
"Gb-qual"&& m_EditDestFeat) {
3037 const string& qual_name = m_Args[m_Args.size() - 2]->GetString();
3038m_EditDestFeat->RemoveQualifier(qual_name);
3045 else if(!dest_set) {
3047x_CopyFields(src_objs, dest_objs);
3049 if(m_EditDestFeat && IstRNAProductField(*m_EditDestFeat, dest_field)) {
3050CMQueryNodeValue::TObs::iterator src_it = src_objs.begin();
3052 while(src_it != src_objs.end()) {
3066m_EditDestFeat->SetData().SetRna().SetRnaProductName(src_val, remainder);
3067m_QualsChangedCount++;
3072 if(IstRNAProductField(*seq_feat, src_field)) {
3073CMQueryNodeValue::TObs::iterator dest_it = dest_objs.begin();
3075 while(dest_it != dest_objs.end()) {
3082m_QualsChangedCount++;
3088 if(IstRNAProductField(*seq_feat, src_field)) {
3097 boolupdate_mrna = (m_Args.back()->GetDataType() ==
CMQueryNodeValue::eBool) ? m_Args.back()->GetBool() :
false;
3100 cleanup.BasicCleanup(*seq_feat);
3101 if(m_EditDestFeat) {
3102 cleanup.BasicCleanup(*m_EditDestFeat);
3104 else if(m_CreatedFeat) {
3105 cleanup.BasicCleanup(*m_CreatedFeat);
3108 if(m_QualsChangedCount) {
3109m_DataIter->SetModified();
3111 log<< m_DataIter->GetBestDescr() <<
": swapped "<< m_QualsChangedCount <<
" qualifiers";
3114 if(m_ConstDestFeat && m_EditDestFeat) {
3122 cmd->AddCommand(*upd_cmd);
3123 log<<
", "<< message;
3127 else if(m_CreatedFeat) {
3135 cmd->AddCommand(*upd_cmd);
3136 log<<
", "<< message;
3141m_DataIter->RunCommand(
cmd, m_CmdComposite);
3149m_DataIter->RunCommand(upd_cmd, m_CmdComposite);
3150 log<<
", applied "+ prot_product +
" to mRNA product name ";
3153x_LogFunction(
log);
3163 if(!feat_list.empty() && feat_list.size() == 1) {
3170 return(!
m_EditDestFeat->GetData().GetRna().GetRnaProductName().empty());
3174 return(!
result.empty());
3179 if(index >=
m_Args.size())
3181 const string& dest_field =
m_Args[index]->GetString();
3199 if((*it)->IsSetData() && (*it)->GetData().IsProt()) {
3200 m_CreatedFeat->SetData().SetProt().Assign((*it)->GetData().GetProt());
3201edit_feat->
SetXref().erase(it);
3205 if(edit_feat->
GetXref().empty()) {
3218 boolfirst_ok = (
m_Args[0]->IsString() ||
m_Args[0]->AreObjects() ||
m_Args[0]->IsRef());
3222 for(
size_tindex = 1; index <
m_Args.size() - 1; ++index) {
3223 if(!
m_Args[index]->IsString()) {
3227 return(
m_Args.back()->IsBool());
3245 if(!src_feat || !scope)
3248 const string& dest_field =
m_Args[2]->GetString();
3249 if(dest_field.empty())
3261 boolchanged =
false,
created=
false;
3264 if(!feat_list.empty() && feat_list.size() == 1) {
3266dest_feat->
Assign(*feat_list.front());
3267 if(!SetFeatDestinationField(dest_feat, dest_field, dest_objs)) {
3275dest_feat = CreateNewRelatedFeature(*src_feat, dest_field, *scope);
3276 if(!dest_feat)
return;
3277 if(!SetFeatDestinationField(dest_feat, dest_field, dest_objs)) {
3284 if((*it)->IsSetData() && (*it)->GetData().IsProt()) {
3285dest_feat->
SetData().SetProt().Assign((*it)->GetData().GetProt());
3286edit_feat->
SetXref().erase(it);
3290 if(edit_feat->
GetXref().empty()) {
3297 const string& capitalization =
m_Args[index]->GetString();
3301 boolupdate_mrna =
m_Args[++index]->GetBool();
3302 const string& action_type =
m_Args[++index]->GetString();
3308 if(IstRNAProductField(*dest_feat, dest_field)) {
3309 for(
auto&& it : src_objs) {
3317dest_feat->
SetData().SetRna().SetRnaProductName(src_val, remainder);
3331 if(changed && fh) {
3346 cmd->AddCommand(*upd_cmd);
3347 log<<
", "<< message;
3355 cmd->AddCommand(*upd_cmd);
3356 log<<
", applied "+ prot_product +
" to mRNA product name ";
3373 for(
size_tindex = 1; index <
m_Args.size(); ++index) {
3395 if(!rna_feat || !scope)
3401 const string& src_feat =
m_Args[0]->GetString();
3402 const string& dest_feat =
m_Args[2]->GetString();
3403 if(src_feat ==
"rna"&& src_feat == dest_feat)
3406 if((src_feat !=
"rna"&& src_feat !=
"gene") || (dest_feat !=
"rna"&& dest_feat !=
"gene"))
3410 const string& capitalization =
m_Args[index]->GetString();
3414 const string& action_type =
m_Args[++index]->GetString();
3419 if(src_feat ==
"rna"&& dest_feat ==
"gene") {
3425 const stringdest_field =
m_Args[3]->GetString();
3429 boolchanged =
false,
created=
false;
3432 if(!feat_list.empty() && feat_list.size() == 1) {
3434dest_feat->
Assign(*feat_list.front());
3435 if(!SetFeatDestinationField(dest_feat, dest_field, dest_objs)) {
3443dest_feat = CreateNewRelatedFeature(*rna_feat, dest_field, *scope);
3444 if(!dest_feat)
return;
3445 if(!SetFeatDestinationField(dest_feat, dest_field, dest_objs)) {
3455 if(changed && fh) {
3471 else if(src_feat ==
"gene"&& dest_feat ==
"gene") {
3477 if(!feat_list.empty() && feat_list.size() == 1) {
3479gene_feat->
Assign(*feat_list.front());
3510 else if(src_feat ==
"gene"&& dest_feat ==
"rna") {
3515 if(!feat_list.empty() && feat_list.size() == 1) {
3517gene_feat->
Assign(*feat_list.front());
3534 for(
auto&& it : src_objs) {
3542edit_feat->
SetData().SetRna().SetRnaProductName(src_val, remainder);
3561 autonr_args =
m_Args.size();
3562 if(nr_args < 7 || nr_args > 8)
3565 if(!
m_Args[0]->IsString() || !
m_Args[2]->IsString())
3568 for(
size_tindex = 1; index < 4; index += 2) {
3569 if(!(
m_Args[index]->IsString() ||
m_Args[index]->AreObjects() ||
m_Args[index]->IsRef()))
3573 for(
size_tindex = 4; index < nr_args; ++index) {
3574 if(index != 5 && !
m_Args[index]->IsString())
3577 return(
m_Args[5]->IsBool());
3598 const string& capitalization =
m_Args[++index]->GetString();
3599 const string& action_type =
m_Args[++index]->GetString();
3609 for(
auto&& it : src_objs) {
3617edit_feat->
SetData().SetRna().SetRnaProductName(src_val, remainder);
3625 if(!dest_objs.empty()) {
3662 size_tas =
m_Args.size();
3663 if(as < 1 || as > 5) {
3666 for(
size_t i= 0;
i< 2; ++
i) {
3670 for(
size_tindex = 2; index < as; ++index) {
3671 if(!
m_Args[index]->IsString()) {
3691 if(!src_feat || !scope)
3694 const string& dest_field =
m_Args[2]->GetString();
3695 if(dest_field.empty())
3707 boolchanged =
false,
created=
false;
3710 if(!feat_list.empty() && feat_list.size() == 1) {
3712dest_feat->
Assign(*feat_list.front());
3713 if(!SetFeatDestinationField(dest_feat, dest_field, dest_objs)) {
3721dest_feat = CreateNewRelatedFeature(*src_feat, dest_field, *scope);
3722 if(!dest_feat)
return;
3723 if(!SetFeatDestinationField(dest_feat, dest_field, dest_objs)) {
3730 if((*it)->IsSetData() && (*it)->GetData().IsProt()) {
3731dest_feat->
SetData().SetProt().Assign((*it)->GetData().GetProt());
3732edit_feat->
SetXref().erase(it);
3736 if(edit_feat->
GetXref().empty()) {
3743 const string& capitalization =
m_Args[index]->GetString();
3744 boolupdate_mrna =
m_Args[++index]->GetBool();
3745 const string& action_type =
m_Args[++index]->GetString();
3751 if(IstRNAProductField(*dest_feat, dest_field)) {
3752 for(
auto&& it : src_objs) {
3760dest_feat->
SetData().SetRna().SetRnaProductName(src_val, remainder);
3774 if(changed && fh) {
3789 cmd->AddCommand(*upd_cmd);
3790 log<<
", "<< message;
3798 cmd->AddCommand(*upd_cmd);
3799 log<<
", applied "+ prot_product +
" to mRNA product name ";
3820 for(
size_tindex = 1; index <
m_Args.size(); ++index) {
3842 if(!rna_feat || !scope)
3848 const string& src_feat =
m_Args[0]->GetString();
3849 const string& dest_feat =
m_Args[2]->GetString();
3850 if(src_feat ==
"rna"&& src_feat == dest_feat)
3853 if((src_feat !=
"rna"&& src_feat !=
"gene") || (dest_feat !=
"rna"&& dest_feat !=
"gene"))
3857 const string& capitalization =
m_Args[index]->GetString();
3858 const string& action_type =
m_Args[++index]->GetString();
3863 if(src_feat ==
"rna"&& dest_feat ==
"gene") {
3869 const stringdest_field =
m_Args[3]->GetString();
3873 boolchanged =
false,
created=
false;
3876 if(!feat_list.empty() && feat_list.size() == 1) {
3878dest_feat->
Assign(*feat_list.front());
3879 if(!SetFeatDestinationField(dest_feat, dest_field, dest_objs)) {
3887dest_feat = CreateNewRelatedFeature(*rna_feat, dest_field, *scope);
3888 if(!dest_feat)
return;
3889 if(!SetFeatDestinationField(dest_feat, dest_field, dest_objs)) {
3899 if(changed && fh) {
3915 else if(src_feat ==
"gene"&& dest_feat ==
"gene") {
3921 if(!feat_list.empty() && feat_list.size() == 1) {
3923gene_feat->
Assign(*feat_list.front());
3954 else if(src_feat ==
"gene"&& dest_feat ==
"rna") {
3958 if(!feat_list.empty() && feat_list.size() == 1) {
3960gene_feat->
Assign(*feat_list.front());
3977 for(
auto&& it : src_objs) {
3985edit_feat->
SetData().SetRna().SetRnaProductName(src_val, remainder);
4007 if(!
m_Args[0]->IsString() || !
m_Args[2]->IsString())
4010 for(
size_tindex = 1; index < 4; index += 2) {
4011 if(!(
m_Args[index]->IsString() ||
m_Args[index]->AreObjects() ||
m_Args[index]->IsRef()))
4014 for(
size_tindex = 4; index <
m_Args.size(); ++index) {
4015 if(!
m_Args[index]->IsString())
4040 stringtext_portion = parsed_obj.
GetString();
4041 if(text_portion.empty()) {
4050 const string& dest_field =
m_Args[index]->GetString();
4052GetDestinationObjects(obj, oi, dest_field, dest_objs);
4055dest_objs =
m_Args[index]->GetObjects();
4061 const string& capitalization =
m_Args[++index]->GetString();
4062 const string& action_type =
m_Args[++index]->GetString();
4077edit_feat->
SetData().SetRna().SetRnaProductName(text_portion, remainder);
4081 if(dest_objs.empty())
4106 CObjectInfonew_oi(dest_objs.front().field.AddNewElement());
4124 size_tas =
m_Args.size();
4125 if(as != 4 && as != 5) {
4140 for(
size_tindex = 2; index < as; ++index) {
4159 if(!src_feat || !scope)
4170 stringtext_portion = parsed_obj.
GetString();
4171 if(text_portion.empty()) {
4175 const string& dest_field =
m_Args[2]->GetString();
4176 if(dest_field.empty())
4183 boolchanged =
false,
created=
false;
4187 if(!feat_list.empty() && feat_list.size() == 1) {
4189dest_feat->
Assign(*feat_list.front());
4190 if(!SetFeatDestinationField(dest_feat, dest_field, dest_objs)) {
4198dest_feat = CreateNewRelatedFeature(*src_feat, dest_field, *scope);
4199 if(!dest_feat)
return;
4200 if(!SetFeatDestinationField(dest_feat, dest_field, dest_objs)) {
4207 if((*it)->IsSetData() && (*it)->GetData().IsProt()) {
4208dest_feat->
SetData().SetProt().Assign((*it)->GetData().GetProt());
4209edit_feat->
SetXref().erase(it);
4213 if(edit_feat->
GetXref().empty()) {
4220 const string& capitalization =
m_Args[index]->GetString();
4221 boolupdate_mrna =
m_Args[++index]->GetBool();
4222 const string& action_type =
m_Args[++index]->GetString();
4230 if(IstRNAProductField(*dest_feat, dest_field)) {
4232dest_feat->
SetData().SetRna().SetRnaProductName(text_portion, remainder);
4244 if(changed && fh) {
4261 log<<
", "<< message;
4277 for(
size_tindex = 1; index <
m_Args.size(); ++index) {
4296 CRef<CScope>scope = m_DataIter->GetScopedObject().scope;
4297 if(!scope || !
object)
4304 stringtext_portion;
4309 const string& field = m_Args[0]->GetString();
4314res_oi = m_Args[index]->GetObjects();
4315 if(!res_oi.empty()) {
4325 if(!res_oi.empty()) {
4335text_portion = text_holder.
GetString();
4338 if(text_portion.empty())
4341x_SetFieldType(m_Args[++index]->GetString());
4342 stringfieldname = (m_Type == eFieldValue) ? m_Args[++index]->GetString() :
kEmptyStr;
4343 if(m_Type == eFieldError) {
4344 NCBI_THROW(
CMacroExecException, eWrongArguments,
"Wrong structured comment fieldname is given (consider replacing it with either 'fieldvalue', 'dbname' or 'fieldname'");
4347 stringcapitalization, action_type;
4348 if(++index < m_Args.size()) {
4349capitalization = m_Args[index]->GetString();
4351 if(++index < m_Args.size()) {
4352action_type = m_Args[index]->GetString();
4354 if(capitalization.empty() || action_type.empty()) {
4358 string delimiter= (++index < m_Args.size()) ? m_Args[index]->GetString() :
kEmptyStr;
4372 for( ; strcomm_it; ++strcomm_it) {
4377 const string kPrefix=
"StructuredCommentPrefix";
4378 const string kSuffix=
"StructuredCommentSuffix";
4382new_desc->
Assign(*strcomm_it);
4387 if(m_Type == eFieldValue) {
4388user_object.
AddField(fieldname, text_portion);
4389m_QualsChangedCount++;
4393 if(m_Type == eFieldValue) {
4394 if(user_object.
HasField(fieldname)) {
4399user_field.
SetData().SetStr(orig_val);
4400m_QualsChangedCount++;
4406user_object.
AddField(fieldname, text_portion);
4407m_QualsChangedCount++;
4410 else if(m_Type == eDbName) {
4414 else if(m_Type == eFieldName) {
4422user_field.
SetLabel().SetStr(orig_val);
4423m_QualsChangedCount++;
4429 if(m_QualsChangedCount) {
4435 cmd->AddCommand(*ecmd);
4451user_object.
AddField(fieldname, text_portion);
4452m_QualsChangedCount++;
4457m_QualsChangedCount++;
4461m_QualsChangedCount++;
4467 if(m_QualsChangedCount) {
4474m_DataIter->RunCommand(
cmd, m_CmdComposite);
4477 string msg=
"parsing text to structured comment ";
4480 msg+=
"field '"+ fieldname +
"'";
4483 msg+=
"database name";
4486 msg+=
"fieldname";
4491report[
msg] = m_QualsChangedCount;
4493x_LogChangedQuals(fnc_log);
4505 for(
size_tindex = 1; index <
m_Args.size(); ++index) {
4546 const string& field =
m_Args[0]->GetString();
4557res_oi =
m_Args[0]->GetObjects();
4564 if(res_oi.empty())
return;
4575 stringparsed_text = options->GetSelectedText(full_text);
4578 if(options->ShouldRemoveFromParsed()) {
4581 if(
CSeqdesc* desc =
dynamic_cast<CSeqdesc*
>(it->second.GetNCPointer())) {
4582 if(desc->IsTitle()) {
4583 stringorig_val = desc->GetTitle();
4584options->RemoveSelectedText(orig_val);
4585 if(!orig_val.empty()) {
4586desc->SetTitle() = orig_val;
4590 cmd->AddCommand(*chg_cmd);
4597 else if(!res_oi.empty()) {
4605options->RemoveSelectedText(orig_val);
4606 if(orig_val.empty()) {
4626 size_tas =
m_Args.size();
4627 if(as < 7 || as > 10) {
4633 if(!
m_Args[1]->IsString() || !
m_Args[2]->IsBool() || !
m_Args[3]->IsString()) {
4637 for(
size_t i= 4;
i< as; ++
i) {
4647 if(bsh && bsh.
IsAa()) {
4653 if(!bsh)
return false;
4657 if(title_ci && !title_ci->
GetTitle().empty()) {
4659new_desc->
Assign(*title_ci);
4673 if(!user.
GetData().empty()) {
4704 const string& left_del =
m_Args[start_index]->GetString();
4706options->SetStartDigits();
4709options->SetStartLetters();
4712options->SetStartText(left_del);
4714options->SetIncludeStart(
m_Args[++start_index]->GetBool());
4716 const string& right_del =
m_Args[++start_index]->GetString();
4718options->SetStopDigits();
4721options->SetStopLetters();
4724options->SetStopText(right_del);
4726options->SetIncludeStop(
m_Args[++start_index]->GetBool());
4728options->SetCaseInsensitive(!
m_Args[++start_index]->GetBool());
4729options->SetWholeWord(
m_Args[++start_index]->GetBool());
4731 autonr_args =
m_Args.size();
4732 if(++start_index < nr_args) {
4733options->SetShouldRemove(
m_Args[start_index]->GetBool());
4735 if(++start_index < nr_args) {
4736options->SetShouldRmvBeforePattern(
m_Args[start_index]->GetBool());
4738 if(++start_index < nr_args) {
4739options->SetShouldRmvAfterPattern(
m_Args[start_index]->GetBool());
4761 if(!rna_feat || !scope)
4767 const string& src_feat =
m_Args[0]->GetString();
4768 if(src_feat !=
"gene")
4775 if(!feat_list.empty() && feat_list.size() == 1) {
4777gene_feat->
Assign(*feat_list.front());
4781 if(
m_Args[index]->IsString()) {
4785 else if(
m_Args[index]->AreObjects()) {
4786res_oi =
m_Args[index]->GetObjects();
4788 else if(
m_Args[index]->IsRef()) {
4808 stringparsed_text = options->GetSelectedText(full_text);
4811 if(!parsed_text.empty() && options->ShouldRemoveFromParsed()) {
4819options->RemoveSelectedText(orig_val);
4820 if(orig_val.empty()) {
4839 size_tas =
m_Args.size();
4840 if(as < 8 || as > 11) {
4846 if(!
m_Args[2]->IsString() || !
m_Args[3]->IsBool() || !
m_Args[4]->IsString()) {
4850 for(
size_t i= 5;
i< as; ++
i) {
4862void CMacroFunction_LocalID::TheFunction()
4870 if(!user.
GetData().empty()) {
4887 if(m_Result->IsNotSet()) {
4891 if(m_Result->IsNotSet()) {
4898 boolCMacroFunction_LocalID::x_ValidArguments()
const 4900 return(m_Args.empty());
4923res_oi = m_Args[0]->GetObjects();
4926x_GetObjectsFromRef(res_oi, 0);
4929 if(res_oi.empty()) {
4935m_QualsChangedCount++;
4939 if(m_QualsChangedCount) {
4941m_DataIter->SetModified();
4943 log<< m_DataIter->GetBestDescr() <<
": set new value to "<< m_QualsChangedCount <<
" qualifiers";
4944x_LogFunction(
log);
4953 if(
m_Args.size() != 2 || !first_ok)
4956 if(!
m_Args[1]->IsSimpleType()) {
4980 CRef<CScope>scope = m_DataIter->GetScopedObject().scope;
4981 if(!scope || !bseq || bseq->
IsAa())
4985 const string& dblink = m_Args[index]->GetString();
4987 const string& existing_text_option = m_Args[++index]->GetString();
4989 boolremove_field =
false;
4990x_GetOptionalArgs(
delimiter, remove_field, index);
4995 if(!newValue.empty()) {
4996vector<pair<CSeqdesc_CI, CRef<CSeqdesc>>> changed_descs;
5002 if(desc_it->GetUser().GetType().IsStr() && desc_it->GetUser().GetType().GetStr() ==
"DBLink") {
5004new_desc->
Assign(*desc_it);
5006 boolfound_user_field =
false;
5010found_user_field =
true;
5014m_QualsChangedCount++;
5022m_QualsChangedCount++;
5026 for(
auto& it : field.
SetData().SetStrs()) {
5027 stringorig_value = it;
5030m_QualsChangedCount++;
5039m_QualsChangedCount++;
5041changed_descs.push_back(make_pair(desc_it, new_desc));
5045 if(changed_descs.empty()) {
5049m_QualsChangedCount++;
5054 else if(!changed_descs.empty()) {
5056 for(
auto& it : changed_descs) {
5058 cmd->AddCommand(*chg_cmd);
5062 if(m_QualsChangedCount) {
5064report[
"setting new value to "+ dblink] = m_QualsChangedCount;
5066x_LogChangedQuals(fnc_log);
5069 else if(remove_field) {
5075 if(desc_it->GetUser().GetType().IsStr() && desc_it->GetUser().GetType().GetStr() ==
"DBLink") {
5077new_desc->
Assign(*desc_it);
5083m_QualsChangedCount++;
5091 cmd->AddCommand(*(
new CCmdDelDesc(desc_it.GetSeq_entry_Handle(), *desc_it)));
5098 cmd->AddCommand(*chg_cmd);
5102 if(m_QualsChangedCount) {
5104report[
"removal of "+ dblink +
" value"] = m_QualsChangedCount;
5106x_LogChangedQuals(fnc_log);
5110 if(m_QualsChangedCount) {
5111m_DataIter->RunCommand(
cmd, m_CmdComposite);
5117 if(!user_object_desc || dblink.empty())
5121new_field->
SetLabel().SetStr(dblink);
5123 stringdel = (newValue.find(
',') !=
NPOS) ?
",":
kEmptyStr;
5124 if(del.empty() && newValue.find(
';') !=
NPOS) {
5130new_field->
SetData().SetStrs().push_back(newValue);
5146vector<string> values;
5148 for(
auto&& it : values)
5158 if(!tmp_values.empty()) {
5159tmp_values += del +
" ";
5164 if(!tmp_values.empty()) {
5165tmp_values += del +
" ";
5167tmp_values += newValue;
5173 stringdel = (newValue.find(
',') !=
NPOS) ?
",":
kEmptyStr;
5174 if(del.empty() && newValue.find(
';') !=
NPOS) {
5179user_field.
SetData().SetStrs().push_back(newValue);
5192 autoarg_nr =
m_Args.size();
5193 if(arg_nr < 3 || arg_nr > 5) {
5198 if(!
m_Args[index]->IsString())
return false;
5200 if(!
m_Args[index]->IsString() && !
m_Args[index]->IsInt())
5203 if(!
m_Args[++index]->IsString())
return false;
5204 if(arg_nr > 3 && (!
m_Args[++index]->IsString() && !
m_Args[index]->IsBool()))
return false;
5205 if(arg_nr > 4 && !
m_Args[++index]->IsBool())
return false;
5217 voidCMacroFunction_AddUnverified::TheFunction()
5221 CRef<CScope>scope = m_DataIter->GetScopedObject().scope;
5222 if(!scope || !bseq || bseq->
IsAa())
5229vector<pair<CSeqdesc_CI, CRef<CSeqdesc>>> changed_descs;
5233 if(desc_it->GetUser().IsUnverified()) {
5234 const auto& present_user = desc_it->GetUser();
5245new_desc->Assign(*desc_it);
5247changed_descs.push_back(make_pair(desc_it, new_desc));
5251 if(changed_descs.empty()) {
5254m_QualsChangedCount++;
5258m_DataIter->RunCommand(
cmd, m_CmdComposite);
5262 for(
auto& it : changed_descs) {
5264 cmd->AddCommand(*chg_cmd);
5265m_QualsChangedCount++;
5267m_DataIter->RunCommand(
cmd, m_CmdComposite);
5270 if(m_QualsChangedCount) {
5272 log<< m_QualsChangedCount <<
";adding new Unverified user object ";
5300 boolCMacroFunction_AddUnverified::x_ValidArguments()
const 5302 return(m_Args.size() == 1 && m_Args[0]->IsString());
5311void CMacroFunction_ParseToDBLink::TheFunction()
5315 CRef<CScope>scope = m_DataIter->GetScopedObject().scope;
5316 if(!scope || !bseq || bseq->
IsAa())
5323 stringtext_portion;
5326 if(m_Args[index]->IsString()) {
5327 const string& field = m_Args[index]->
GetString();
5331 else if(m_Args[index]->AreObjects()) {
5332res_oi = m_Args[index]->GetObjects();
5333 if(!res_oi.empty()) {
5337 else if(m_Args[index]->IsRef()) {
5343 if(!res_oi.empty()) {
5353text_portion = text_holder.
GetString();
5356 if(text_portion.empty())
5361 if(m_Args[++index]->IsString()) {
5362dblink = m_Args[index]->GetString();
5368 stringcapitalization = m_Args[++index]->GetString();
5369 stringaction_type = m_Args[++index]->GetString();
5370 string delimiter= (++index < m_Args.size()) ? m_Args[index]->GetString() :
kEmptyStr;
5379vector<pair<CSeqdesc_CI, CRef<CSeqdesc>>> changed_descs;
5385 if(desc_it->GetUser().GetType().IsStr() && desc_it->GetUser().GetType().GetStr() ==
"DBLink") {
5387new_desc->Assign(*desc_it);
5389 boolfound_user_field =
false;
5393found_user_field =
true;
5397m_QualsChangedCount++;
5405m_QualsChangedCount++;
5410 for(
auto& it : field.
SetData().SetStrs()) {
5411 stringorig_value = it;
5414m_QualsChangedCount++;
5423m_QualsChangedCount++;
5425changed_descs.push_back(make_pair(desc_it, new_desc));
5429 if(changed_descs.empty()) {
5431new_desc->SetUser().SetType().SetStr(
"DBLink");
5433m_QualsChangedCount++;
5438 else if(!changed_descs.empty()) {
5440 for(
auto& it : changed_descs) {
5442 cmd->AddCommand(*chg_cmd);
5446 if(m_QualsChangedCount) {
5447m_DataIter->RunCommand(
cmd, m_CmdComposite);
5450report[
"parsing text to "+ dblink] = m_QualsChangedCount;
5452x_LogChangedQuals(fnc_log);
5456 boolCMacroFunction_ParseToDBLink::x_ValidArguments()
const 5458 if(m_Args.size() > 5 || m_Args.size() < 4) {
5461 if(!(m_Args[0]->IsString() || m_Args[0]->AreObjects() || m_Args[0]->IsRef()))
5464 for(
size_tindex = 1; index < m_Args.size(); ++index) {
5486 const string& subtype_name = m_Args[index]->GetString();
5488 const string& action_type = m_Args[++index]->GetString();
5490 boolremove_field =
false;
5491x_GetOptionalArgs(
delimiter, remove_field, index);
5497 if(!newValue.empty()) {
5498vector<string> new_values;
5503 const CSeq_feat* const_feat =
dynamic_cast<const CSeq_feat*
>(
object.GetPointer());
5504 if(const_bsrc && m_IsBiosrc) {
5505x_AddBioSrcModifier(subtype_name, newValue);
5507 else if(const_feat && !m_IsBiosrc) {
5509m_QualsChangedCount += s_AddGBQualifier(*seqfeat, subtype_name, newValue);
5511new_values.push_back(newValue);
5519 for(
auto&& it : res_oi) {
5534SetQualStringValue(value_oi, sat_value);
5535new_values.push_back(sat_value);
5538 stringorig_sat_type = sat_type;
5541 boolgood_type = (found_it !=
kSatelliteTypes.end()) ?
true:
false;
5548 if(!sat_name.empty()) {
5549sat_name = sat_type +
":"+ sat_name;
5552sat_name = sat_type;
5556SetQualStringValue(value_oi, sat_value);
5557new_values.push_back(sat_value);
5572SetQualStringValue(value_oi, met_value);
5573new_values.push_back(met_value);
5577 stringorig_met_type = met_type;
5579 autofound_it = find(kMobileETypeTypes.begin(), kMobileETypeTypes.end(), met_type);
5580 boolgood_type = (found_it != kMobileETypeTypes.end()) ?
true:
false;
5590SetQualStringValue(value_oi, met_value);
5591new_values.push_back(met_value);
5602m_QualsChangedCount++;
5606new_values.push_back(new_val.
GetString());
5612 if(m_QualsChangedCount) {
5613m_DataIter->SetModified();
5615 log<< m_DataIter->GetBestDescr();
5616 for(
size_t i= 0;
i< new_values.size(); ++
i) {
5617 log<<
" '"<< new_values[
i] <<
"' has been set as a new value";
5619x_LogFunction(
log);
5622 else if(remove_field) {
5623 if(!res_oi.empty()) {
5625 for(
auto&& it : res_oi) {
5639 if(!newValue.empty()) {
5640SetQualStringValue(value_oi, newValue);
5645m_QualsChangedCount++;
5651 for(
auto&& it : res_oi) {
5665 if(!newValue.empty()) {
5666SetQualStringValue(value_oi, newValue);
5671m_QualsChangedCount++;
5677 for(
auto&& it : res_oi) {
5679m_QualsChangedCount++;
5685 if(m_QualsChangedCount) {
5691 cleanup.BasicCleanup(*seq_feat);
5698m_DataIter->SetModified();
5700 log<< m_DataIter->GetBestDescr() <<
": removed "<< m_QualsChangedCount <<
" modifiers";
5701x_LogFunction(
log);
5715 size_targ_size =
m_Args.size();
5716 if(arg_size < 5 || arg_size > 7)
5724 if(!
m_Args[1]->IsString() || !
m_Args[2]->IsString())
return false;
5727 booltype_ok =
m_Args[3]->IsString() ||
m_Args[3]->IsInt() ||
m_Args[3]->IsDouble();
5728 if(!type_ok)
return false;
5730 if(!
m_Args[4]->IsString())
return false;
5732 if(arg_size > 5 && (!
m_Args[5]->IsString() && !
m_Args[5]->IsBool()))
return false;
5734 if(arg_size > 6 && !
m_Args[6]->IsBool())
return false;
5771 stringqualifier = qual_name;
5772 stringapply_value = newValue;
5776qualifier =
"satellite";
5780qualifier =
"satellite";
5791 if(!apply_value.empty()) {
5801 booladded =
false;
5807orgname->
SetMod().push_back(orgmod);
5808bsrc.
SetOrg().SetOrgname(*orgname);
5812bsrc.
SetOrg().SetOrgname().SetMod().push_back(orgmod);
5820 booladded =
false;
5842 CRef<CScope>scope = m_DataIter->GetScopedObject().scope;
5843m_Result->SetNotSet();
5844 if(!feat || !scope || !feat->
IsSetQual())
5847 const string& qual_value = feat->
GetNamedQual(
"satellite");
5848 if(!qual_value.empty()) {
5850 switch(m_FieldType) {
5851 caseeSatelliteType:
5852 value= s_GetSatelliteType(qual_value);
5854 caseeSatelliteName:
5855 value= s_GetSatelliteName(qual_value);
5859 if(m_Nested == eNotNested) {
5860m_Result->SetString(
value);
5866m_Result->SetRef(new_node);
5875 return value.substr(0, pos);
5895 stringnew_type =
type;
5897 if(!name.empty()) {
5898new_name =
":"+ name;
5900 if(
type.empty()) {
5905 boolgood_type = (found_it !=
kSatelliteTypes.end()) ?
true:
false;
5909new_name =
":"+
type+ new_name;
5912 returnnew_type + new_name;
5917 return(
m_Args.empty());
5932 CRef<CScope>scope = m_DataIter->GetScopedObject().scope;
5933m_Result->SetNotSet();
5934 if(!feat || !scope || !feat->
IsSetQual())
5938 if(!qual_value.empty()) {
5940 switch(m_FieldType) {
5941 caseeMobileElemTType:
5942 value= s_GetMobileElemTType(qual_value);
5944 caseeMobileElemTName:
5945 value= s_GetMobileElemTName(qual_value);
5949 if(m_Nested == eNotNested) {
5950m_Result->SetString(
value);
5956m_Result->SetRef(new_node);
5966 autoit = find(kMobileETypeTypes.begin(), kMobileETypeTypes.end(),
type);
5970 autoit = find(kMobileETypeTypes.begin(), kMobileETypeTypes.end(),
value);
5979 stringname =
value.substr(pos + 1,
NPOS);
5980 autoit = find(kMobileETypeTypes.begin(), kMobileETypeTypes.end(),
type);
5981 return(it != kMobileETypeTypes.end()) ? name :
value;
5984 autoit = find(kMobileETypeTypes.begin(), kMobileETypeTypes.end(),
value);
5992 if(!
type.empty()) {
5993 autofound_it = find(kMobileETypeTypes.begin(), kMobileETypeTypes.end(),
type);
5994 boolgood_type = (found_it != kMobileETypeTypes.end()) ?
true:
false;
5997 if(!name.empty()) {
6013 return(
m_Args.empty());
6021void CMacroFunction_EditSubfield::TheFunction()
6024 const string& subfield = m_Args[1]->GetString();
6025 if(subfield.empty())
6030 const string&
location= m_Args[++index]->GetString();
6031 boolcase_sensitive = m_Args[++index]->GetBool();
6032 boolis_regex = (++index < m_Args.size()) ? m_Args[index]->GetBool() :
false;
6035 if(m_Args[0]->AreObjects()) {
6038 else if(m_Args[0]->IsRef()) {
6039x_GetObjectsFromRef(objs, 0);
6046 for(
auto&& it : objs) {
6058SetQualStringValue(value_oi, newValue);
6062 stringorig_sat_type = sat_type;
6065 boolgood_type = (found_it !=
kSatelliteTypes.end()) ?
true:
false;
6071 if(!sat_name.empty())
6072sat_name = sat_type +
":"+ sat_name;
6075SetQualStringValue(value_oi, newValue);
6085SetQualStringValue(value_oi, newValue);
6089 stringorig_met_type = met_type;
6091 autofound_it = find(kMobileETypeTypes.begin(), kMobileETypeTypes.end(), met_type);
6092 boolgood_type = (found_it != kMobileETypeTypes.end()) ?
true:
false;
6100SetQualStringValue(value_oi, newValue);
6106 stringinst, coll, id;
6122SetQualStringValue(value_oi, newValue);
6127 if(m_QualsChangedCount) {
6128m_DataIter->SetModified();
6130 log<< m_DataIter->GetBestDescr() <<
": edited "<< m_QualsChangedCount <<
" qualifiers, replaced "<< find_txt;
6132repl_txt.assign(
"''");
6134 log<<
" with "<< repl_txt;
6139 boolCMacroFunction_EditSubfield::x_ValidArguments()
const 6141 if(m_Args.size() != 7)
6144 boolfirst_ok = m_Args[0]->AreObjects() || m_Args[0]->IsRef();
6145 if(!first_ok || !m_Args[1]->IsString()) {
6149 for(
size_tindex = 2; index < 4; index++) {
6150 if(!m_Args[index]->IsString() && !m_Args[index]->IsInt()) {
6154 return(m_Args[4]->IsString() && m_Args[5]->IsBool() && m_Args[6]->IsBool());
6163void CMacroFunction_RemoveSubfield::TheFunction()
6165 const string& subfield = m_Args[1]->GetString();
6166 if(subfield.empty())
6170 if(m_Args[0]->AreObjects()) {
6171objs = m_Args[0]->GetObjects();
6173 else if(m_Args[0]->IsRef()) {
6174x_GetObjectsFromRef(objs, 0);
6180 for(
auto&& it : objs) {
6204 stringinst, coll, id;
6217 if(!newValue.empty()) {
6218SetQualStringValue(value_oi, newValue);
6223m_QualsChangedCount++;
6228 if(m_QualsChangedCount) {
6230 CRef<CScope>scope = m_DataIter->GetScopedObject().scope;
6235 cleanup.BasicCleanup(*seq_feat);
6242m_DataIter->SetModified();
6244 log<< m_DataIter->GetBestDescr() <<
": removed "<< m_QualsChangedCount <<
" qualifiers";
6250 boolCMacroFunction_RemoveSubfield::x_ValidArguments()
const 6252 returnm_Args.size() == 2 && (m_Args[0]->AreObjects() || m_Args[0]->IsRef()) && m_Args[1]->IsString();
6263 if(ch ==
'A'|| ch ==
'T'|| ch ==
'G'|| ch ==
'C'|| ch ==
'U') {
6274 "AC",
"AG",
"CG",
"ACG",
"AT",
"CT",
"ACT",
"GT",
"AGT",
"CGT",
"ACGT"};
6279 if(pos != string::npos) {
6290vector<string> replacements;
6292 if(codon.length() == 3 &&
s_IsATGC(codon.c_str()[0])) {
6293 stringthis_codon = codon.substr(0, 1);
6294replacements.push_back(this_codon);
6296 for(
int i= 1;
i< 3;
i++) {
6298 size_tnum_now = replacements.size();
6300 for(
unsigned intj = 1; j < ch.length(); j++) {
6301 for(
unsigned intk = 0; k < num_now; k++) {
6302 stringcpy = replacements[k];
6303replacements.push_back(cpy);
6306 for(
unsigned intk = 0; k < num_now; k++) {
6307 for(
unsigned intj = 0; j < ch.length(); j++) {
6308replacements[j * num_now + k].append(ch.substr(j, 1));
6314replacements.push_back(codon);
6316 returnreplacements;
6320void CMacroFunction_SetCodonsRecognized::TheFunction()
6329 if(m_Args[0]->IsRef()) {
6337 else if(m_Args[0]->IsString()) {
6338 value= m_Args[0]->GetString();
6341 if(
value.empty()) {
6349edit_feat->
SetData().SetRna().SetExt().SetTRNA().ResetCodon();
6353 if(
value.empty())
6357 for(
unsigned intj = 0; j <
codons.size(); j++)
6362edit_feat->
SetData().SetRna().SetExt().SetTRNA().SetCodon().push_back(val);
6366m_DataIter->SetModified();
6369 log<< m_DataIter->GetBestDescr() <<
": set codons-recognized";
6374 boolCMacroFunction_SetCodonsRecognized::x_ValidArguments()
const 6376 return(m_Args.size() == 1 && (m_Args[0]->IsRef() || m_Args[0]->IsString()));
6386void CMacroFunction_SetStructCommField::TheFunction()
6389 const CBioseq* bioseq =
dynamic_cast<const CBioseq*
>(
object.GetPointer());
6391 if(!(bioseq && bioseq->
IsNa()) &&
6401 const string& field_name = m_Args[index]->GetString();
6402 const string& field_value = m_Args[++index]->GetString();
6403 const string& existing_text_option = m_Args[++index]->GetString();
6405 boolremove_field =
false;
6406x_GetOptionalArgs(
delimiter, remove_field, index);
6409 if(!field_value.empty()) {
6415user_object->
AddField(field_name, field_value);
6416m_QualsChangedCount++;
6419 if(user_object->
HasField(field_name)) {
6424user_field.
SetData().SetStr(orig_val);
6425m_QualsChangedCount++;
6431user_object->
AddField(field_name, field_value);
6432m_QualsChangedCount++;
6436 if(m_QualsChangedCount) {
6450 if(!edit_bseq)
return;
6453 if(!seqdesc)
return;
6461user_field.
SetData().SetStr(orig_val);
6462m_QualsChangedCount++;
6466user_field.
SetData().SetStr(field_value);
6467m_QualsChangedCount++;
6473m_QualsChangedCount++;
6476 if(m_QualsChangedCount) {
6482 if(m_QualsChangedCount) {
6483m_DataIter->SetModified();
6485 log<< m_DataIter->GetBestDescr() <<
": applied ('"<< field_name <<
"', '"<< field_value <<
"') field-value pair";
6489 else if(remove_field) {
6494m_QualsChangedCount++;
6505 if(!edit_bseq)
return;
6509 if(!seqdesc)
return;
6512m_QualsChangedCount++;
6516 if(m_QualsChangedCount) {
6517m_DataIter->SetModified();
6519 log<< m_DataIter->GetBestDescr() <<
": removed "<< m_QualsChangedCount <<
" structured comment fields";
6525 boolCMacroFunction_SetStructCommField::x_ValidArguments()
const 6527 if(m_Args.size() < 3 || m_Args.size() > 6)
6530 if(m_Args[0]->IsRef()) {
6536 else if(!m_Args[0]->IsString()) {
6541 for(
size_t i= 1;
i< m_Args.size(); ++
i) {
6542 if(!m_Args[
i]->IsString() && !m_Args[
i]->IsBool()) {
6559 const CBioseq* bioseq =
dynamic_cast<const CBioseq*
>(
object.GetPointer());
6561 if(!(bioseq && bioseq->
IsNa()) &&
6567 const string& db_name = m_Args[index]->GetString();
6568 const string kPrefix=
"StructuredCommentPrefix";
6569 const string kSuffix=
"StructuredCommentSuffix";
6570 const string& existing_text_option = m_Args[++index]->GetString();
6572 boolremove_field =
false;
6573x_GetOptionalArgs(
delimiter, remove_field, index);
6576 if(!db_name.empty()) {
6582m_DataIter->SetModified();
6586 boolfound_user =
false;
6590new_seqdesc->
Assign(*desc_it);
6591m_QualsChangedCount += s_UpdateStructCommentDb(*new_seqdesc,
kPrefix, db_name, existing_text);
6592m_QualsChangedCount += s_UpdateStructCommentDb(*new_seqdesc,
kSuffix, db_name, existing_text);
6594 if(m_QualsChangedCount) {
6598 cmd->AddCommand(*ecmd);
6599m_DataIter->RunCommand(
cmd, m_CmdComposite);
6605m_DataIter->SetModified();
6613m_QualsChangedCount += s_UpdateStructCommentDb(*user_object,
kPrefix, db_name, existing_text);
6614m_QualsChangedCount += s_UpdateStructCommentDb(*user_object,
kSuffix, db_name, existing_text);
6615m_DataIter->SetModified();
6617 if(m_QualsChangedCount) {
6618 log<< m_DataIter->GetBestDescr() <<
": applied structured comment database name '"<< db_name <<
"'";
6620x_LogFunction(
log);
6622 else if(remove_field) {
6628m_QualsChangedCount++;
6629m_DataIter->SetModified();
6632m_QualsChangedCount++;
6633m_DataIter->SetModified();
6647new_seqdesc->
Assign(*desc_it);
6649m_QualsChangedCount++;
6651m_QualsChangedCount++;
6653 if(m_QualsChangedCount) {
6656 cmd->AddCommand(*ecmd);
6657m_DataIter->RunCommand(
cmd, m_CmdComposite);
6663 if(m_QualsChangedCount) {
6665 log<< m_DataIter->GetBestDescr() <<
": removed "<< m_QualsChangedCount <<
" structured comment fields";
6666x_LogFunction(
log);
6678seqdesc->
SetUser(*user_obj);
6682 if(!edit_bseq)
return false;
6684 auto& descriptors = edit_bseq->
SetDescr().Set();
6685descriptors.push_back(seqdesc);
6702 if(!
m_Args[0]->IsString() || !
m_Args[1]->IsString()) {
6706 if(
m_Args.size() > 2 && (!
m_Args[index]->IsString() && !
m_Args[index]->IsBool()))
6708 if(
m_Args.size() > 3 && !
m_Args[++index]->IsBool())
6716 if(!seqdesc.
IsUser()) {
6737user_field.
SetData().SetStr(orig_val);
6742user_field.
SetData().SetStr(root);
6756 if(!user_object.
IsSetData())
return;
6757 auto& user_fields = user_object.
SetData();
6759 for(CUser_object::TData::iterator it = user_fields.begin(); it != user_fields.end(); ++it) {
6763 swap(*it, *(user_fields.end() - 1));
6776 voidCMacroFunction_ValueFromTable::TheFunction()
6778 const string&
table_name= m_Args[0]->GetString();
6779 intcol = (
int)m_Args[1]->GetInt();
6784m_Result->SetNotSet();
6786 string value= m_DataIter->GetValueFromTable(col - 1);
6787m_Result->SetString(
value);
6791 boolCMacroFunction_ValueFromTable::x_ValidArguments()
const 6793 if(m_Args.size() != 2)
6796 return(m_Args[0]->IsString() && m_Args[1]->IsInt());
6805 voidCMacroFunction_GeneQual::TheFunction()
6813 stringfield_name = m_Args[0]->GetString();
6819field_name =
"data.gene."+ field_name;
6829 boolfound_qual =
false;
6841 for(
auto&& it : tmp_result.
SetObjects()) {
6845m_Result->SetObjects().push_back(it);
6851 if(!found_qual && feat->
IsSetXref()) {
6853 for(
auto&& it : feat->
SetXref()) {
6854 if(it->IsSetData() && it->GetData().IsGene()) {
6855gene_xref = &(it->SetData().SetGene());
6868m_Result->GetObjects().empty()) {
6869m_Result->SetNotSet();
6873 boolCMacroFunction_GeneQual::x_ValidArguments()
const 6895 stringvoucher_type;
6896 stringvoucher_part = m_Args[index]->GetString();
6898 const string& action_type = m_Args[++index]->GetString();
6900 boolremove_field =
false;
6901x_GetOptionalArgs(
delimiter, remove_field, index);
6906 if(m_Args[0]->IsString()) {
6907voucher_type = m_Args[0]->
GetString();
6909 else if(m_Args[0]->AreObjects()) {
6910objs = m_Args[0]->GetObjects();
6912 else if(m_Args[0]->IsRef()) {
6913x_GetObjectsFromRef(objs, 0);
6916 if(voucher_type.empty() && objs.empty()) {
6926 if(!voucher_type.empty()) {
6933 if(!newValue.empty()) {
6935 boolhas_voucher =
false;
6937 autoorgmod = *mod_it;
6938 if(orgmod->IsSetSubtype() && orgmod->GetSubtype() == subtype) {
6939x_ApplyPart(*orgmod, part, newValue, existing_text);
6940has_voucher =
true;
6945 autonew_mod = x_AddNewQual(subtype, part, newValue);
6946bsrc->
SetOrg().SetOrgname().SetMod().push_back(new_mod);
6947m_QualsChangedCount++;
6951 autonew_mod = x_AddNewQual(subtype, part, newValue);
6952bsrc->
SetOrg().SetOrgname().SetMod().push_back(new_mod);
6953m_QualsChangedCount++;
6956 else if(remove_field) {
6958 autoorgmod = *mod_it;
6959 if(orgmod->IsSetSubtype() && orgmod->GetSubtype() == subtype) {
6960x_RemovePart(*orgmod, part);
6961m_QualsChangedCount++;
6962 if(orgmod->GetSubname().empty())
6967bsrc->
SetOrg().SetOrgname().ResetMod();
6972 for(
auto&& it : objs) {
6977 if(!
mod)
continue;
6979 if(!newValue.empty()) {
6981x_ApplyPart(*
mod, part, newValue, existing_text);
6984 autonew_mod = x_AddNewQual(
mod->GetSubtype(), part, newValue);
6985bsrc->
SetOrg().SetOrgname().SetMod().push_back(new_mod);
6986m_QualsChangedCount++;
6989 else if(remove_field) {
6990x_RemovePart(*
mod, part);
6992m_QualsChangedCount++;
6999 if(m_QualsChangedCount) {
7000m_DataIter->SetModified();
7003 if(!newValue.empty()) {
7004report[
"setting new value to structured voucher "+ voucher_part] = m_QualsChangedCount;
7006 else if(remove_field) {
7007report[
"removal of structured voucher "+ voucher_part] = m_QualsChangedCount;
7010x_LogChangedQuals(fnc_log);
7018 autoarg_nr =
m_Args.size();
7019 if(arg_nr < 4 || arg_nr > 6)
7022 boolfirst_ok =
m_Args[0]->IsString() ||
m_Args[0]->AreObjects() ||
m_Args[0]->IsRef();
7023 if(!first_ok)
return false;
7025 if(!
m_Args[1]->IsString())
return false;
7028 boolthird_ok =
m_Args[2]->IsString() ||
m_Args[2]->IsInt() ||
m_Args[2]->IsDouble();
7029 if(!third_ok)
return false;
7031 if(!
m_Args[3]->IsString())
return false;
7033 if(arg_nr > 4 && (!
m_Args[4]->IsString() && !
m_Args[4]->IsBool()))
return false;
7035 if(arg_nr > 5 && !
m_Args[5]->IsBool())
return false;
7044 stringorig_inst, orig_coll, orig_id;
7049 autoupdate = [&newValue, existing_text,
this](
string&
value,
const string& orig_value)
7056 stringinst{ orig_inst }, coll{ orig_coll },
id{ orig_id };
7069 stringinst, coll, id;
7088 stringinst, coll, id;
7104void CMacroFunction_SetAutodefOption::TheFunction()
7113 stringfield_name = m_Args[index]->GetString();
7115 const string& field_value = m_Args[++index]->GetString();
7116 const string& existing_text_option = m_Args[++index]->GetString();
7118 boolremove_field =
false;
7119x_GetOptionalArgs(
delimiter, remove_field, index);
7127user_object->
AddField(field_name, field_value);
7128m_QualsChangedCount++;
7131 if(user_object->
HasField(field_name)) {
7136user_field.
SetData().SetStr(orig_val);
7137m_QualsChangedCount++;
7143user_object->
AddField(field_name, field_value);
7144m_QualsChangedCount++;
7148 if(m_QualsChangedCount) {
7149m_DataIter->SetModified();
7151 log<< m_DataIter->GetBestDescr() <<
": applied ('"<< field_name <<
"', '"<< field_value <<
"') field-value pair";
7157 boolCMacroFunction_SetAutodefOption::x_ValidArguments()
const 7159 if(m_Args.size() < 3 || m_Args.size() > 4)
7162 for(
size_t i= 0;
i< m_Args.size(); ++
i) {
7163 if(!m_Args[
i]->IsString()) {
User-defined methods of the data storage class.
@ eExtreme_Biological
5' and 3'
bool IsSetOrgMod(void) const
bool IsSetOrgname(void) const
static bool CleanupUserObject(CUser_object &object)
@Gb_qual.hpp User-defined methods of the data storage class.
static int CodonToIndex(char base1, char base2, char base3)
bool IsSuppressed(void) const
Subclass of the IQueryParseUserObject which is held as the user-defined object in each CQueryParseNod...
class CMacroExecException
@Name_std.hpp User-defined methods of the data storage class.
@OrgMod.hpp User-defined methods of the data storage class.
static bool IsValidSubtypeName(const string &str, EVocabulary vocabulary=eVocabulary_raw)
static TSubtype GetSubtypeValue(const string &str, EVocabulary vocabulary=eVocabulary_raw)
static string MakeStructuredVoucher(const string &inst, const string &coll, const string &id)
static bool ParseStructuredVoucher(const string &str, string &inst, string &coll, string &id)
@RNA_ref.hpp User-defined methods of the data storage class.
string GetRnaProductName(void) const
void SetRnaProductName(const string &product, string &remainder)
ESubtype GetSubtype(void) const
@ eSubtype_mat_peptide_aa
namespace ncbi::objects::
const string & GetNamedQual(const CTempString &qual_name) const
Return a named qualifier.
void AddQualifier(const string &qual_name, const string &qual_val)
Add a qualifier to this feature.
const CGene_ref * GetGeneXref(void) const
See related function in util/feature.hpp.
static TSubtype GetSubtypeValue(const string &str, EVocabulary vocabulary=eVocabulary_raw)
static bool IsValidSubtypeName(const string &str, EVocabulary vocabulary=eVocabulary_raw)
CUser_field & SetValue(int value)
set a data field to a given value Int8 and TGi values can be stored into 'str' field if the value doe...
void SetObjectType(EObjectType obj_type)
void AddUnverifiedOrganism()
void AddUnverifiedContaminant()
bool RemoveNamedField(const string &field_name, NStr::ECase ecase=NStr::eCase)
@ eObjectType_StructuredComment
bool HasField(const string &str, const string &delim=".", NStr::ECase use_case=NStr::eCase) const
Verify that a named field exists.
bool IsAutodefOptions() const
CUser_object & AddField(const string &label, const string &value, EParseField parse=eParse_String)
add a data field to the user object that holds a given value
void AddUnverifiedMisassembled()
CUser_field & SetField(const string &str, const string &delim=".", const string &obj_subtype=kEmptyStr, NStr::ECase use_case=NStr::eCase)
Access a named field in this user object.
EObjectType GetObjectType() const
void AddUnverifiedFeature()
static auto & FixCapitalizationInString
static const string kSatelliteTypes[]
static void cleanup(void)
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
static const char table_name[]
static const char * str(char *buf, int n)
static const char location[]
Utility macros and typedefs for exploring NCBI objects from general.asn.
#define EDIT_EACH_USERFIELD_ON_USEROBJECT(Itr, Var)
#define ERASE_USERFIELD_ON_USEROBJECT(Itr, Var)
ERASE_USERFIELD_ON_USEROBJECT.
const TResidue codons[4][4]
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
void swap(NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair1, NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair2)
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
const CMemberId & GetId(void) const
const string & GetName(void) const
objects::ECapChange ConvertStringtoCapitalOption(const string &cap_name)
virtual bool x_ValidArguments(void) const
Tests the number and the type of function arguments.
virtual bool x_ChangeFields(CObjectInfo &src, CObjectInfo &dest)
virtual void TheFunction()
class CMacroFunction_EditStringQual Usage: EditStringQual(field_name|rt_obj, find_text,...
bool StringsAreEquivalent(const string &name1, const string &name2)
bool RemoveFirstName(objects::CName_std &std_name)
static bool s_EditText(string &str, const string &find, const string &repl, ESearchLoc loc, bool case_sensitive, bool is_regex=false)
bool SetQualStringValue(CObjectInfo &oi, const string &value)
Functions make the action and collect statistics.
void CleanupForTaxnameChange(CObjectInfo oi)
void SetString(const string &data)
Set/get underlying data type.
void x_RemovePart(objects::COrgMod &orgmod, NMacroUtil::EStructVoucherPart part)
static void s_MoveSuffixToTheEnd(objects::CUser_object &user_object)
virtual void TheFunction()
Function implementation.
static bool s_IsATGC(char ch)
CMacroFunction_SetCodonsRecognized SetCodonsRecognized(field_name) The field_name specifies one of th...
virtual bool x_ValidArguments() const
Tests the number and the type of function arguments.
void x_SetOrCreateDestFeatFields(const objects::CSeq_feat &src_feat, CMQueryNodeValue::TObs &result, size_t index)
virtual bool x_ValidArguments(void) const
Tests the number and the type of function arguments.
objects::CSeqFeatData::ESubtype GetFeatSubtype(const string &feat_type)
void x_SetFields(CMQueryNodeValue::TObs &objs, const string &newValue, objects::edit::EExistingText existing_text, vector< string > &new_values)
CRef< CMacroCmdComposite > m_CmdComposite
static void s_ResetModSubsrcQuals(CBioSource &bsrc)
static bool s_AddSrcSubSource(objects::CBioSource &bsrc, int subtype, const string &value)
const char * kMobileElementTType
static string s_GetMobileElemTType(const string &value)
static vector< string > ParseDegenerateCodons(string codon)
bool x_GetSourceFields(CObjectInfo oi, size_t index, CMQueryNodeValue::TObs &result)
virtual bool x_ChangeFields(CObjectInfo &src, CObjectInfo &dest)=0
virtual void TheFunction()
Function implementation.
static bool s_SetEnumValue(CObjectInfo &obj, const string &str)
virtual bool x_ValidArguments(void) const
Tests the number and the type of function arguments.
bool x_GetSpecialField(const string &field, CMQueryNodeValue::TObs &objs, objects::CScope &scope)
CMQueryNodeValue::EType GetPrimitiveFromRef(CMQueryNodeValue &node)
void x_SetNewPrimitiveValue(CObjectInfo &oi, const string &newValue, objects::edit::EExistingText existing_text, vector< string > &new_values)
virtual bool x_ValidArguments(void) const
Tests the number and the type of function arguments.
static void s_AddNewDBlinkValue(CUser_field &user_field, const string &newValue)
AddDBLink(dblink_type, newValue, existing_text, delimiter, remove_blank) The last parameter is option...
static string s_GetMobileElemTName(const string &value)
virtual void TheFunction()
class CMacroFunction_ConvertStringQual ConvertStringQual(src_field, dst_field, capitalization,...
bool ResolveAndSetSimpleTypeValue(CObjectInfo &oi, const string &field_name, const CMQueryNodeValue &value, objects::edit::EExistingText existing_text=objects::edit::eExistingText_replace_old)
Resolve dot qualified ASN.1 node_name using the object information instance provided as a parameter (...
bool RemoveFieldByName(CMQueryNodeValue::SResolvedField &res_field)
Remove the object information instance corresponding to field, using information about its parent nod...
list< SResolvedField > TObs
virtual bool x_ValidArguments(void) const
Tests the number and the type of function arguments.
virtual void TheFunction()
Function implementation.
static string s_GetEnumValue(CObjectInfo &obj)
bool GetSimpleTypeValue(CObjectInfo &oi, const string &field_name, CMQueryNodeValue &value)
Get single node data from the node specified by parameter of type CObjectInfo and additionally field ...
virtual void TheFunction()
class CMacroFunction_SetStringQual Expected Syntax: SetStringQual(field_name, newValue,...
bool x_CheckArguments(size_t index) const
virtual bool x_ValidArguments(void) const
Tests the number and the type of function arguments.
void Dereference()
If it is a reference it is resolved to the first non reference type in the hierarchy.
const TObs & GetObjects() const
virtual bool x_ValidArguments() const
Tests the number and the type of function arguments.
bool x_SetFields(CObjectInfo oi, CMQueryNodeValue::TObs &result, size_t index)
void GetPrimitiveObjInfosWithContainers(CMQueryNodeValue::TObs &objs, const CMQueryNodeValue::SResolvedField &info)
bool ResolveIdentToObjects(const CObjectInfo &oi, const string &identifier, CMQueryNodeValue &v)
Resolve name to the list of objects.
static void s_SetFeatField(CRef< CSeq_feat > feat, CObjectInfo &oi, const string &field_name, CMQueryNodeValue::TObs &result)
const char * kStrCommFieldValue
bool SetSimpleTypeValue(CObjectInfo &oi, const CMQueryNodeValue &value, objects::edit::EExistingText existing_text=objects::edit::eExistingText_replace_old)
Set single node data to the node specified by parameter of type CObjectInfo.
static const string s_GetExpansion(const string &ch)
virtual bool x_ValidArguments(void) const
Tests the number and the type of function arguments.
CConstRef< objects::CSeq_feat > m_ConstDestFeat
void RemoveGeneXref(objects::CSeq_feat &feat)
void ChangeFields(CMQueryNodeValue::TObs &src_objs, CMQueryNodeValue::TObs &dest_objs)
void SetDataType(EType dt)
bool x_MakeNewStructuredComment(const string &db_name, const string &kPrefix, const string &kSuffix)
string GetStringValue(CRef< CMQueryNodeValue > &value)
converts ints and doubles into string, by changing the type of the value
virtual bool x_ValidArguments(void) const
Tests the number and the type of function arguments.
void x_AddBioSrcModifier(const string &subtype, const string &newValue)
void x_ParseFields(CMQueryNodeValue::TObs &dest_objs, const string &text_portion, objects::edit::EExistingText existing_text)
string x_GetSourceString(CObjectInfo &src)
static bool s_AddNewUserField(CRef< CSeqdesc > &user_object_desc, const string &dblink, const string &newValue)
const char * kSatelliteType
const char * kSatelliteName
virtual bool x_ValidArguments() const
Tests the number and the type of function arguments.
void x_RmvOutsideFields(CMQueryNodeValue::TObs &resolved_objs, const CRemoveTextOptions &options)
CObjectInfo GetPrimitiveObjInfo(const CObjectInfo &info)
bool x_GetDestFields(CObjectInfo oi, size_t index, CMQueryNodeValue::TObs &result)
const string & GetString() const
virtual bool x_ValidArguments(void) const
Tests the number and the type of function arguments.
EType GetDataType() const
CRef< CRemoveTextOptions > x_GetRemoveTextOptions(size_t start_index) const
virtual bool x_ValidArguments(void) const
Tests the number and the type of function arguments.
CRef< objects::CSeq_feat > m_EditDestFeat
const char * kStrCommFieldName
bool x_DoFieldsExist(CObjectInfo oi, CMQueryNodeValue::TObs &result, size_t index)
virtual bool x_ValidArguments(void) const
Tests the number and the type of function arguments.
void GetPrimitiveObjectInfos(CMQueryNodeValue::TObs &objs, const CMQueryNodeValue::SResolvedField &info)
virtual void TheFunction()
class CMacroFunction_ConvertStringQual ConvertStringQual(src_field, dst_field, capitalization,...
EStructVoucherPart GetSVPartFromString(const string voucher_part)
virtual bool x_ValidArguments() const
Tests the number and the type of function arguments.
virtual void TheFunction()
Function implementation.
static string s_MakeSatellite(const string &type, const string &name)
Int4 m_QualsChangedCount
Number of changed qualifiers during the function call.
bool GetFieldsByName(CMQueryNodeValue::TObs *results, const CObjectInfo &oi_i, const string &field_name)
Resolve existing dot qualified ASN.1 name (field_name) starting from the object information instance ...
virtual bool x_ValidArguments(void) const
Tests the number and the type of function arguments.
bool x_DoDestFeatFieldsExist(const objects::CSeq_feat &src_feat, CMQueryNodeValue::TObs &result, const string &dest_feattype, const string &dest_field)
bool IsTaxname(CMQueryNodeValue::SResolvedField &res)
virtual bool x_ValidArguments() const
Tests the number and the type of function arguments.
virtual void TheFunction()
class CMacroFunction_CopyStringQual Expected syntax: CopyStringQual( src_field, dest_field,...
CRef< objects::edit::CParseTextOptions > x_GetParseOptions(size_t start_index)
static string s_GetSatelliteName(const string &value)
virtual bool x_ValidArguments(void) const
Tests the number and the type of function arguments.
static const string kAmbiguities
static int s_AddGBQualifier(objects::CSeq_feat &feat, const string &qual_name, const string &newValue)
static void s_SetVectorValue(CUser_field &user_field, const string &newValue, const string &del)
virtual void TheFunction()
Function implementation.
virtual bool x_ValidArguments(void) const
Tests the number and the type of function arguments.
CRef< objects::COrgMod > x_AddNewQual(objects::COrgMod::TSubtype subtype, NMacroUtil::EStructVoucherPart part, const string &newValue)
bool ResolveIdentToSimple(const CObjectInfo &oi, const string &identifier, CMQueryNodeValue &v)
Resolve name to simple types value.
bool SetFieldsByName(CMQueryNodeValue::TObs *results, CObjectInfo &oi_i, const string &field_name)
Resolve not necessarily existing dot qualified ASN.1 name (field_name) starting from the object infor...
void x_CopyFields(CMQueryNodeValue::TObs &src_objs, CMQueryNodeValue::TObs &dest_objs)
virtual void TheFunction()
Function implementation.
static string s_GatherExistingValues(CUser_field &user_field, const string &newValue, const string &del)
virtual bool x_ValidArguments(void) const
Tests the number and the type of function arguments.
void x_GetObjectsFromRef(CMQueryNodeValue::TObs &objects, const size_t &index)
objects::edit::EExistingText ActionTypeToExistingTextOption(const string &action_type, const string &delimiter)
CRef< CMQueryNodeValue > m_Result
virtual bool x_ValidArguments(void) const
Tests the number and the type of function arguments.
static Int4 s_RemoveFields(CIRef< IMacroBioDataIter > &dataiter, CMQueryNodeValue::TObs &objs)
virtual bool x_ValidArguments(void) const
Tests the number and the type of function arguments.
void x_SetFieldType(const string &strcomm_field)
bool IsSatelliteSubfield(const string &field)
static int s_UpdateStructCommentDb(objects::CSeqdesc &seqdesc, const string &field, const string &db_name, objects::edit::EExistingText existing_text)
objects::ECapChange m_CapChange
static ESearchLoc s_GetLocFromName(const string &name)
bool IsMobileElementTSubfield(const string &field)
const char * kMobileElementTQual
static string s_MakeMobileElementT(const string &type, const string &name)
virtual void TheFunction()
class CMacroFunction_CopyStringQual Expected syntax: CopyStringQual( src_field, dest_field,...
static const string kReplacements[]
bool x_SwapFields(CObjectInfo &src, CObjectInfo &dest)
static void s_AddUnverifiedType(CUser_object &user, NMacroUtil::EUnverifiedType type)
class CMacroFunction_AddUnverified AddUnverified("Features"); The user object will be added only to n...
string x_GetSourceString(CObjectInfo &src)
void x_LogFunction(CNcbiOstrstream &logstr)
virtual bool x_ValidArguments(void) const
Tests the number and the type of function arguments.
bool ApplyFirstName(objects::CName_std &std_name, const string &newValue, objects::edit::EExistingText existing_text)
virtual bool x_ValidArguments() const
Tests the number and the type of function arguments.
bool IsBiosourceModifier(const string &field)
virtual bool x_ValidArguments(void) const
Tests the number and the type of function arguments.
virtual bool x_ChangeFields(CObjectInfo &src, CObjectInfo &dest)
static void s_SetBioSourceField(CRef< CBioSource > bsrc, CObjectInfo &oi, const string &field_name, CMQueryNodeValue::TObs &dest_objs)
bool EditText(string &str) const
virtual bool x_ValidArguments() const
Tests the number and the type of function arguments.
CRef< objects::CSeq_feat > m_CreatedFeat
void x_SetField(CConstRef< CObject > &obj, const string &fieldname, CMQueryNodeValue::TObs &result)
void SwapGbQualWithValues(CMQueryNodeValue::TObs &objs)
void SetObjects(const TObs &obs)
static const char * sm_FunctionName
EditRelatedFeatureQual(feat_type, field_name, find_text, repl_text, location, case_sensitive,...
virtual bool x_ValidArguments() const
Tests the number and the type of function arguments.
string x_GetSourceString(CObjectInfo &src)
const char * kMobileElementTName
DEFINE_MACRO_FUNCNAME(CMacroFunction_CopyFeatQual, "CopyFeatureQual")
CopyFeatureQual(src_field, dest_feature_type, dest_feature_field, update_mrna, existing_text_opt,...
virtual bool x_ChangeFields(CObjectInfo &src, CObjectInfo &dest)
void x_ApplyPart(objects::COrgMod &orgmod, NMacroUtil::EStructVoucherPart part, const string &newValue, objects::edit::EExistingText existing_text)
static bool s_AddSrcOrgMod(objects::CBioSource &bsrc, int subtype, const string &value)
EUnverifiedType GetUnverifiedType(const string &value)
virtual bool x_ValidArguments() const
Tests the number and the type of function arguments.
CIRef< IMacroBioDataIter > m_DataIter
static bool s_SwapFields(CObjectInfo &src, CObjectInfo &dest)
vector< CConstRef< objects::CSeq_feat > > TVecFeatList
virtual bool x_ValidArguments(void) const
Tests the number and the type of function arguments.
vector< pair< objects::CSeqdesc_CI, CRef< objects::CSeqdesc > > > m_ChangedDescriptors
virtual void TheFunction()
Function implementation.
objects::edit::EExistingText m_ExistingText
void RemoveEmptyDescriptors(objects::CBioseq &bseq)
const char * kStrCommDbname
virtual bool x_ValidArguments() const
Tests the number and the type of function arguments.
void x_EditFields(CMQueryNodeValue::TObs &resolved_objs, const string &find_txt, const string &repl_txt, ESearchLoc loc, bool case_sensitive, bool is_regex)
static string s_GetSatelliteType(const string &value)
size_t TMemberIndex
Type used for indexing class members and choice variants.
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
virtual const CTypeInfo * GetThisTypeInfo(void) const =0
static const TObjectType * SafeCast(TTypeInfo type)
@ ePrimitiveValueString
string|char*|const char*
@ ePrimitiveValueInteger
(signed|unsigned) (char|short|int|long)
@ ePrimitiveValueChar
char
@ ePrimitiveValueBool
bool
@ ePrimitiveValueEnum
enum
@ ePrimitiveValueReal
float|double
CElementIterator BeginElements(void) const
Create container elements iterator.
CObjectInfo AddNewPointedElement(void) const
add new pointer element, create new pointed object and return it
CObjectInfo GetPointedObject(void) const
Get data and type information of object to which this type refers.
bool GetPrimitiveValueBool(void) const
Get boolean data.
const CMemberInfo * GetMemberInfo(void) const
TObjectPtr GetObjectPtr(void) const
Get pointer to object.
CObjectInfo GetMember(void) const
Get class member data.
void SetPrimitiveValueString(const string &value)
void SetPrimitiveValueBool(bool value)
Set boolean data.
int GetPrimitiveValueInt(void) const
Get data as int.
void SetPrimitiveValueInt8(Int8 value)
void SetPrimitiveValueInt4(Int4 value)
CObjectInfo AddNewElement(void) const
Add and return new element object.
CMemberIterator GetClassMemberIterator(TMemberIndex index) const
Create class member iterator that initially points to specified member.
ETypeFamily GetTypeFamily(void) const
Get data type family.
void GetPrimitiveValueString(string &value) const
Get string data.
double GetPrimitiveValueDouble(void) const
Get data as double.
CMemberIterator FindClassMember(const string &memberName) const
Find class member by its name.
Int4 GetPrimitiveValueInt4(void) const
Get data as Int4.
void SetPrimitiveValueDouble(double value)
const string & GetName(void) const
Get type name.
void SetPrimitiveValueInt(int value)
EPrimitiveValueType GetPrimitiveValueType(void) const
Get type of primitive value.
Int8 GetPrimitiveValueInt8(void) const
Get data as Int8.
bool IsSet(void) const
Is member assigned a value.
CObjectTypeInfo GetElementType(void) const
Get type information of an element of container.
void GetCdssForGene(const CMappedFeat &gene_feat, list< CMappedFeat > &cds_feats, CFeatTree *feat_tree=0, const SAnnotSelector *base_sel=0)
CMappedFeat GetBestMrnaForCds(const CMappedFeat &cds_feat, CFeatTree *feat_tree=0, const SAnnotSelector *base_sel=0)
CMappedFeat GetBestCdsForMrna(const CMappedFeat &mrna_feat, CFeatTree *feat_tree=0, const SAnnotSelector *base_sel=0)
CRef< CSeq_loc > Seq_loc_Merge(const CSeq_loc &loc, CSeq_loc::TOpFlags flags, CScope *scope)
Merge ranges in the seq-loc.
const CSeq_feat * GetCDSForProduct(const CBioseq &product, CScope *scope)
Get the encoding CDS feature of a given protein sequence.
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
CSeq_feat_Handle GetSeq_featHandle(const CSeq_feat &feat, EMissing action=eMissing_Default)
CConstRef< CBioseq > GetCompleteBioseq(void) const
Get the complete bioseq.
CSeq_entry_Handle GetSeq_entry_Handle(void) const
Get parent Seq-entry handle.
virtual const CSeq_loc & GetProduct(void) const
bool IsSetProduct(void) const
virtual const CSeq_loc & GetLocation(void) const
CConstRef< CSeq_feat > GetOriginalSeq_feat(void) const
CSeq_entry_Handle GetSeq_entry_Handle(void) const
TObjectType * GetPointer(void) const THROWS_NONE
Get pointer,.
TObjectType * GetNCPointer(void) const THROWS_NONE
Get pointer,.
CConstRef< C > ConstRef(const C *object)
Template function for conversion of const object pointer to CConstRef.
CRef< C > Ref(C *object)
Helper functions to get CRef<> and CConstRef<> objects.
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
void Reset(void)
Reset reference object.
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.
int32_t Int4
4-byte (32-bit) signed integer
int64_t Int8
8-byte (64-bit) signed integer
size_t Replace(CTempStringEx search, CTempString replace, CRegexp::TCompile compile_flags=CRegexp::fCompile_default, CRegexp::TMatch match_flags=CRegexp::fMatch_default, size_t max_replace=0)
Replace occurrences of a substring within a string by pattern.
unsigned int TCompile
Type definitions used for code clarity.
string GetResult(void)
Get result string.
#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.
static bool StringToBool(const CTempString str)
Convert string to bool.
NCBI_NS_STD::string::size_type SIZE_TYPE
static string Int8ToString(Int8 value, TNumToStringFlags flags=0, int base=10)
Convert Int8 to string.
static string DoubleToString(double value, int precision=-1, TNumToStringFlags flags=0)
Convert double to string.
static Int8 StringToInt8(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to Int8.
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 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 IsBlank(const CTempString str, SIZE_TYPE pos=0)
Check if a string is blank (has no text).
static const string BoolToString(bool value)
Convert bool to string.
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.
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 SIZE_TYPE FindCase(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 sensitive search.
static long StringToLong(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to long.
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 EqualNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive equality of a substring with another string.
static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
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 & 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.
static string & ToUpper(string &str)
Convert string to upper case â string& version.
@ fConvErr_NoThrow
Do not throw an exception on error.
@ eNocase
Case insensitive compare.
@ eCase
Case sensitive compare.
const TSubtype & GetSubtype(void) const
Get the Subtype member data.
void SetSubtype(TSubtype value)
Assign a value to Subtype data member.
bool IsSetOrg(void) const
Check if a value has been assigned to Org data member.
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.
void SetName(const TName &value)
Assign a value to Name data member.
TSubtype & SetSubtype(void)
Assign a value to Subtype data member.
void ResetSubtype(void)
Reset Subtype data member.
const TStr & GetStr(void) const
Get the variant data.
bool IsSetData(void) const
the object itself Check if a value has been assigned to Data data member.
bool IsStr(void) const
Check if variant Str is selected.
bool IsStrs(void) const
Check if variant Strs is selected.
const TStrs & GetStrs(void) const
Get the variant data.
const TData & GetData(void) const
Get the Data member data.
bool IsStr(void) const
Check if variant Str is selected.
bool IsSetLabel(void) const
field label Check if a value has been assigned to Label data member.
TData & SetData(void)
Assign a value to Data data member.
void SetNum(TNum value)
Assign a value to Num data member.
const TStr & GetStr(void) const
Get the variant data.
void SetLabel(TLabel &value)
Assign a value to Label data member.
const TData & GetData(void) const
Get the Data member data.
void SetType(TType &value)
Assign a value to Type data member.
void ResetNum(void)
Reset Num data member.
void SetData(TData &value)
Assign a value to Data data member.
const TLabel & GetLabel(void) const
Get the Label member data.
const TType & GetType(void) const
Get the Type member data.
bool IsSetData(void) const
Check if a value has been assigned to Data data member.
E_Choice Which(void) const
Which variant is currently selected.
@ e_not_set
No variant selected.
const TMod & GetMod(void) const
Get the Mod member data.
bool IsSetDb(void) const
ids in taxonomic or culture dbases Check if a value has been assigned to Db data member.
const TSubname & GetSubname(void) const
Get the Subname member data.
void SetSubtype(TSubtype value)
Assign a value to Subtype data member.
const TDb & GetDb(void) const
Get the Db member data.
bool IsSetSubname(void) const
Check if a value has been assigned to Subname data member.
TMod & SetMod(void)
Assign a value to Mod data member.
void SetSubname(const TSubname &value)
Assign a value to Subname data member.
const TOrgname & GetOrgname(void) const
Get the Orgname member data.
@ eSubtype_specimen_voucher
@ eSubtype_culture_collection
const TName & GetName(void) const
Get the Name member data.
TType GetType(void) const
Get the Type member data.
bool IsSetType(void) const
Check if a value has been assigned to Type data member.
TXref & SetXref(void)
Assign a value to Xref data member.
bool IsSetComment(void) const
Check if a value has been assigned to Comment data member.
bool IsSetData(void) const
the specific data Check if a value has been assigned to Data data member.
bool IsSetQual(void) const
qualifiers Check if a value has been assigned to Qual data member.
bool IsProt(void) const
Check if variant Prot is selected.
bool IsCdregion(void) const
Check if variant Cdregion is selected.
void SetComment(const TComment &value)
Assign a value to Comment data member.
bool IsSetXref(void) const
cite other relevant features Check if a value has been assigned to Xref data member.
const TLocation & GetLocation(void) const
Get the Location member data.
bool IsGene(void) const
Check if variant Gene is selected.
const TData & GetData(void) const
Get the Data member data.
void SetData(TData &value)
Assign a value to Data data member.
const TProduct & GetProduct(void) const
Get the Product member data.
const TProt & GetProt(void) const
Get the variant data.
const TXref & GetXref(void) const
Get the Xref member data.
vector< CRef< CSeqFeatXref > > TXref
void ResetXref(void)
Reset Xref data member.
const TRna & GetRna(void) const
Get the variant data.
TQual & SetQual(void)
Assign a value to Qual data member.
bool IsSetProduct(void) const
product of process Check if a value has been assigned to Product data member.
bool IsRna(void) const
Check if variant Rna is selected.
bool IsSetLocation(void) const
feature made from Check if a value has been assigned to Location data member.
bool IsGenbank(void) const
Check if variant Genbank is selected.
const TUser & GetUser(void) const
Get the variant data.
const TTitle & GetTitle(void) const
Get the variant data.
const TGenbank & GetGenbank(void) const
Get the variant data.
void SetDescr(TDescr &value)
Assign a value to Descr data member.
TUser & SetUser(void)
Select the variant.
bool IsUser(void) const
Check if variant User is selected.
@ e_User
user defined object
@ e_Title
a title for this sequence
unsigned int
A callback function used to compare two keys in a database.
Functions that resolve field names described in asn format.
const struct ncbi::grid::netcache::search::fields::CREATED created
const GenericPointer< typename T::ValueType > T2 value
static const char delimiter[]
Utility macros and typedefs for exploring NCBI objects from seqfeat.asn.
#define ERASE_ORGMOD_ON_BIOSOURCE(Itr, Var)
ERASE_ORGMOD_ON_BIOSOURCE.
#define EDIT_EACH_ORGMOD_ON_BIOSOURCE(Itr, Var)
#define EDIT_EACH_SUBSOURCE_ON_BIOSOURCE(Itr, Var)
#define EDIT_EACH_GBQUAL_ON_SEQFEAT(Itr, Var)
static SLJIT_INLINE sljit_ins st(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
@ eExistingText_append_semi
@ eExistingText_leave_old
@ eExistingText_replace_old
bool AddValueToString(string &str, const string &value, EExistingText existing_text)
Add text to an existing string, using the "existing_text" directive to combine new text with existing...
C++ wrappers for the Perl-compatible regular expression (PCRE) library.
CRef< CCmdComposite > UpdatemRNAProduct(const objects::CSeq_feat &protein, objects::CScope &scope, string &message)
void SetProteinFeature(objects::CSeq_feat &prot, objects::CBioseq_Handle product, const objects::CSeq_feat &cds)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4