141 if (entry_ci->IsSetDescr()) {
143 if ((*dit)->IsSource()) {
144 const CBioSource& desc_src = (*dit)->GetSource();
145 if (&desc_src == &bsrc) {
151 if (entry_ci->IsSeq()) {
153 if (&(fi->GetData().GetBiosrc()) == &bsrc) {
169 for (
CBioseq_CI b_iter(tse); b_iter; ++b_iter) {
172 for (
CSeqdesc_CI desc_it(*b_iter); desc_it; ++desc_it) {
173 if (seqdesc == &(*desc_it)) {
181 if (bsrc == &(desc_it->GetSource())) {
189 if (molinfo == &(desc_it->GetMolinfo())) {
206 return info.GetPointedObject();
214 const string dbtag_name =
"Dbtag";
218 objs.push_back(
info);
227 while (elem.
Valid()) {
234 if (pointed.
GetName() == dbtag_name) {
243 if (obj.
GetName() == dbtag_name) {
244 objs.push_back(
info);
256 if (obj.
GetName() ==
"OrgMod") {
260 else if (obj.
GetName() ==
"SubSource") {
264 else if (obj.
GetName() ==
"Gb-qual") {
284 bool all_gbquals =
true;
285 for (
auto&& it : objs) {
292 if (all_gbquals && !objs.empty()) {
294 for (
auto&& it : objs) {
295 auto val_member = it.field.FindClassMember(
"val").GetMember();
305 if ((*it)->IsSetData() && (*it)->GetData().IsGene()) {
317 if ((*it)->IsTitle() && (*it)->GetTitle().empty()) {
320 else if ((*it)->IsComment() && (*it)->GetComment().empty()) {
323 else if ((*it)->IsGenbank() && (*it)->GetGenbank().IsEmpty()) {
333 if (
value->IsString()) {
334 newValue =
value->GetString();
336 else if (
value->IsInt()) {
338 newValue =
value->GetString();
340 else if (
value->IsDouble()) {
342 newValue =
value->GetString();
380 subtype =
f->GetSubtype();
381 string descr =
f->GetDescription();
399 string str1(name1), str2(name2);
461 user_obj->
SetType().SetStr(
"NcbiAutofix");
470 if (entry_ci->IsSetDescr()) {
510 return (issubsrc || isorgmod);
515 bool is_taxname =
false;
555 bool modified =
false;
561 string first_initials = (std_name.
IsSetFirst()) ?
566 if (first_initials.empty()) {
567 if (orig_initials.empty()) {
574 string middle_init = new_first_init + orig_initials;
580 if (orig_initials.empty()) {
581 string first_name = std_name.
GetFirst();
593 middle_init = orig_initials.substr(first_initials.length());
596 if (middle_init.empty()) {
597 string first_name = std_name.
GetFirst();
607 string first_name = std_name.
GetFirst();
612 new_init += middle_init;
633 bool modified =
false;
638 if (orig_initials.empty()) {
648 middle_init = orig_initials.substr(first_initials.length());
650 if (middle_init.empty()) {
663 bool modified =
false;
669 string first_initials = (std_name.
IsSetFirst()) ?
672 if (first_initials.empty()) {
673 if (orig_initials.empty()) {
678 string middle_init = orig_initials;
688 if (orig_initials.empty()) {
689 string inits = first_initials;
690 inits.append(newValue);
697 middle_init = orig_initials.substr(first_initials.length());
700 if (middle_init.empty()) {
701 middle_init = orig_initials + newValue;
706 string orig_val = middle_init;
729 bool modified =
false;
731 string first_initials = (std_name.
IsSetFirst()) ?
734 if (first_initials.empty()) {
740 string middle_init = orig_initials.substr(first_initials.length());
741 if (!middle_init.empty()) {
742 std_name.
SetInitials(orig_initials.substr(0, first_initials.length()));
754 if (newValue.empty())
757 vector<string>
names;
761 for (
auto&& it :
names) {
762 vector<string> full_name;
764 string first_name, last_name, middle_init, suffix;
766 if (full_name.size() == 4) {
767 first_name = full_name[0];
768 middle_init = full_name[1];
769 last_name = full_name[2];
770 suffix = full_name[3];
772 else if (full_name.size() == 3) {
773 first_name = full_name[0];
774 middle_init = full_name[1];
775 last_name = full_name[2];
777 else if (full_name.size() == 2) {
778 first_name = full_name[0];
779 last_name = full_name[1];
781 else if (full_name.size() == 1)
783 last_name = full_name[0];
786 if (!last_name.empty()) {
790 if (!first_name.empty())
795 if (!middle_init.empty()) {
800 initials.append(
".");
802 if (!initials.empty()) {
808 auth_list.
SetNames().SetStd().push_back(new_auth);
821 auto it = part_map.
find(voucher_part);
822 if (it != part_map.
end()) part = it->second;
837 for (
size_t i = 0;
i < line.size(); ++
i) {
838 if (line[
i] !=
' ' && (spaces == 0)) {
841 else if (line[
i] ==
' ') {
844 else if (line[
i] !=
' ' && (spaces > 0)) {
859 else if (spaces == 1)
866 string escaped =
str;
897 if (iter != sm_CLabelMap.end()) {
949 size_t start_pos = string::npos;
950 size_t start_len = 0;
963 while (start_pos <
str.length() && !
isdigit(
str.c_str()[start_pos])) {
966 if (start_pos <
str.length()) {
968 while (start_pos + start_len <
str.length() &&
isdigit(
str.c_str()[start_pos + start_len])) {
975 while (start_pos <
str.length() && !
isalpha(
str.c_str()[start_pos])) {
978 if (start_pos <
str.length()) {
980 while (start_pos + start_len <
str.length() &&
isalpha(
str.c_str()[start_pos + start_len])) {
986 if (start_pos == string::npos || start_pos ==
str.length()) {
993 size_t end_pos = string::npos;
999 end_pos =
str.length();
1006 end_pos = start_pos + start_len;
1007 while (end_pos <
str.length() && !
isdigit(
str.c_str()[end_pos])) {
1010 if (end_pos <
str.length()) {
1012 while (end_pos + end_len <
str.length() &&
isdigit(
str.c_str()[end_pos + end_len])) {
1018 end_pos = start_pos + start_len;
1019 while (end_pos <
str.length() && !
isalpha(
str.c_str()[end_pos])) {
1022 if (end_pos <
str.length()) {
1024 while (end_pos + end_len <
str.length() &&
isalpha(
str.c_str()[end_pos + end_len])) {
1030 if (end_pos == string::npos || (end_pos ==
str.length() &&
m_AfterMatch !=
eNone) || end_pos < start_pos) {
1035 bool any_change =
false;
1038 size_t stop = end_pos;
1042 if (stop <
str.length()) {
1043 str =
str.substr(0, stop);
1049 size_t start = start_pos;
@Auth_list.hpp User-defined methods of the data storage class.
CFeatListItem - basic configuration data for one "feature" type.
CConfigurableItems - a static list of items that can be configured.
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.
static bool IsValidSubtypeName(const string &str, EVocabulary vocabulary=eVocabulary_raw)
static const CFeatList * GetFeatList()
@ eSubtype_bad
These no longer need to match the FEATDEF values in the C toolkit's objfdef.h.
static CTempString SubtypeValueToName(ESubtype eSubtype)
Turns a ESubtype into its string value which is NOT necessarily related to the identifier of the enum...
namespace ncbi::objects::
const CGene_ref * GetGeneXref(void) const
See related function in util/feature.hpp.
Base class for all serializable objects.
class CStaticArrayMap<> is an array adaptor that provides an STLish interface to statically-defined a...
TBase::const_iterator const_iterator
static bool IsValidSubtypeName(const string &str, EVocabulary vocabulary=eVocabulary_raw)
const_iterator end() const
const_iterator find(const key_type &key) const
@ eCapChange_firstlower_restnochange
capitalize the first letter, the rest is not changed
@ eCapChange_capword_afterspacepunc
capitalize the first letter and letters after spaces
@ eCapChange_capword_afterspace
first letter is lower case, the rest is not changed
@ eCapChange_firstcap_restnochange
capitalize the first letter, the rest is lower case
@ eCapChange_firstcap_restlower
change each letter to upper case
@ eCapChange_tolower
no change
@ eCapChange_toupper
change each letter to lower case
static const struct name_t names[]
static const char * str(char *buf, int n)
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
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.
objects::ECapChange ConvertStringtoCapitalOption(const string &cap_name)
CConstRef< objects::CBioseq > GetBioseqForSeqdescObject(const CSerialObject *obj, const objects::CSeq_entry_Handle &tse)
static string s_GetFirstNameInitials(const string &first_name)
bool StringsAreEquivalent(const string &name1, const string &name2)
bool RemoveFirstName(objects::CName_std &std_name)
CLabel::ELabelType NameToLabelType(const string &name)
bool ApplyMiddleInitial(objects::CName_std &std_name, const string &newValue, objects::edit::EExistingText existing_text)
DEFINE_STATIC_ARRAY_MAP(TLabelTypeToNameMap, sm_CLabelMap, s_LabelTypeToName)
void CleanupForTaxnameChange(CObjectInfo oi)
void ConvertMultiSpaces(string &line, const string &delimiter)
replace any instance of 2 or more spaces with a single instance of 'delimiter'
static bool s_FixInitials(objects::CName_std &name)
const char * kColl_suffix
objects::CSeqFeatData::ESubtype GetFeatSubtype(const string &feat_type)
const char * kMobileElementTType
CMQueryNodeValue::EType GetPrimitiveFromRef(CMQueryNodeValue &node)
bool FindNcbiAutofixUserObject(const objects::CSeq_entry_Handle &tse)
void s_SetInitials(CName_std &std_name, const string &middle_init)
list< SResolvedField > TObs
void Dereference()
If it is a reference it is resolved to the first non reference type in the hierarchy.
void GetPrimitiveObjInfosWithContainers(CMQueryNodeValue::TObs &objs, const CMQueryNodeValue::SResolvedField &info)
const char * kStrCommFieldValue
bool IsStructVoucherPart(const string &field)
void RemoveGeneXref(objects::CSeq_feat &feat)
string GetStringValue(CRef< CMQueryNodeValue > &value)
converts ints and doubles into string, by changing the type of the value
unsigned ApplyAuthorNames(objects::CAuth_list &auth_list, const string &newValue)
const char * kSatelliteType
const char * kSatelliteName
CObjectInfo GetPrimitiveObjInfo(const CObjectInfo &info)
EType GetDataType() const
const char * kStrCommFieldName
void GetPrimitiveObjectInfos(CMQueryNodeValue::TObs &objs, const CMQueryNodeValue::SResolvedField &info)
objects::CRNA_ref::EType GetRNAType(const string &rna_type)
string TransformForCSV(const string &str)
EStructVoucherPart GetSVPartFromString(const string voucher_part)
bool IsTaxname(CMQueryNodeValue::SResolvedField &res)
bool RemoveMiddleInitial(objects::CName_std &std_name)
const char * kInst_suffix
objects::edit::EExistingText ActionTypeToExistingTextOption(const string &action_type, const string &delimiter)
bool GetLocusTagFromProtRef(const objects::CSeq_feat &prot_feat, objects::CScope &scope, string &locus_tag)
bool IsSatelliteSubfield(const string &field)
bool IsMobileElementTSubfield(const string &field)
const char * kMobileElementTQual
bool ApplyFirstName(objects::CName_std &std_name, const string &newValue, objects::edit::EExistingText existing_text)
bool GetLocusTagFromGene(const objects::CGene_ref &gene, string &locus_tag)
bool IsBiosourceModifier(const string &field)
const char * kSpecid_suffix
bool EditText(string &str) const
static const TFeatLabelMap s_LabelTypeToName[]
void SwapGbQualWithValues(CMQueryNodeValue::TObs &objs)
CRef< objects::CSeqdesc > MakeNcbiAutofixUserObject()
const char * kMobileElementTName
EUnverifiedType GetUnverifiedType(const string &value)
void RemoveEmptyDescriptors(objects::CBioseq &bseq)
const char * kStrCommDbname
objects::CSeq_entry_Handle GetParentEntryForBioSource(const objects::CBioSource &bsrc, const objects::CSeq_entry_Handle &tse)
static const TObjectType * SafeCast(TTypeInfo type)
CElementIterator BeginElements(void) const
Create container elements iterator.
CObjectInfo GetPointedObject(void) const
Get data and type information of object to which this type refers.
CObjectInfo GetElement(void) const
Get element data and type information.
TObjectPtr GetObjectPtr(void) const
Get pointer to object.
CObjectInfo GetMember(void) const
Get class member data.
bool Valid(void) const
Is iterator valid.
ETypeFamily GetTypeFamily(void) const
Get data type family.
CMemberIterator FindClassMember(const string &memberName) const
Find class member by its name.
const string & GetName(void) const
Get type name.
bool IsSet(void) const
Is member assigned a value.
const CSeq_feat * GetCDSForProduct(const CBioseq &product, CScope *scope)
Get the encoding CDS feature of a given protein sequence.
CConstRef< CSeq_feat > GetOverlappingGene(const CSeq_loc &loc, CScope &scope, ETransSplicing eTransSplicing=eTransSplicing_Auto)
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
CConstRef< CBioseq > GetCompleteBioseq(void) const
Get the complete bioseq.
@ fIncludeGivenEntry
Include the top (given) entry.
@ fRecursive
Iterate recursively.
TObjectType & GetNCObject(void) const
Get object.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define USING_SCOPE(ns)
Use the specified namespace.
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
#define BEGIN_SCOPE(ns)
Define a new scope.
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 list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Split a string using specified delimiters.
static bool 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 bool EqualCase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-sensitive equality of a substring with another string.
static string Quote(const CTempString str, char quote_char='"', char escape_char = '\\')
Quote string (generic version).
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 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.
@ fSplit_Tokenize
All delimiters are merged and trimmed, to get non-empty tokens only.
@ eCase
Case sensitive compare.
void ResetNames(void)
Reset Names data member.
void SetName(TName &value)
Assign a value to Name data member.
void SetNames(TNames &value)
Assign a value to Names data member.
bool IsSetLocus_tag(void) const
systematic gene name (e.g., MI0001, ORF0069) Check if a value has been assigned to Locus_tag data mem...
bool IsSetLocus(void) const
Official gene symbol Check if a value has been assigned to Locus data member.
const TLocus_tag & GetLocus_tag(void) const
Get the Locus_tag member data.
const TLocus & GetLocus(void) const
Get the Locus member data.
bool IsStr(void) const
Check if variant Str is selected.
bool IsSetType(void) const
type of object within class Check if a value has been assigned to Type data member.
void SetInitials(const TInitials &value)
Assign a value to Initials data member.
void ResetInitials(void)
Reset Initials data member.
const TInitials & GetInitials(void) const
Get the Initials member data.
void ResetFirst(void)
Reset First data member.
void SetLast(const TLast &value)
Assign a value to Last data member.
void SetFirst(const TFirst &value)
Assign a value to First data member.
bool IsSetInitials(void) const
first + middle initials Check if a value has been assigned to Initials data member.
TData & SetData(void)
Assign a value to Data data member.
const TStr & GetStr(void) const
Get the variant data.
void SetSuffix(const TSuffix &value)
Assign a value to Suffix data member.
void SetType(TType &value)
Assign a value to Type data member.
const TType & GetType(void) const
Get the Type member data.
const TFirst & GetFirst(void) const
Get the First member data.
bool IsSetFirst(void) const
Check if a value has been assigned to First data member.
@ eType_ncRNA
non-coding RNA; subsumes snRNA, scRNA, snoRNA
bool IsProt(void) const
Check if variant Prot is selected.
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.
const TGene & GetGene(void) const
Get the variant data.
const TXref & GetXref(void) const
Get the Xref member data.
void ResetXref(void)
Reset Xref data member.
list< CRef< CSeqdesc > > Tdata
TUser & SetUser(void)
Select the variant.
@ e_User
user defined object
@ e_Molinfo
info on the molecule and techniques
@ e_Source
source of materials, includes Org-ref
const GenericPointer< typename T::ValueType > T2 value
Miscellaneous common-use basic types and functionality.
SIZE_TYPE FindWithOptions(const string &str, const string &pattern, SIZE_TYPE start_search, bool case_insensitive, bool whole_word)
static const char delimiter[]
#define ERASE_SEQDESC_ON_BIOSEQ(Itr, Var)
ERASE_SEQDESC_ON_BIOSEQ.
#define EDIT_EACH_SEQDESC_ON_BIOSEQ(Itr, Var)
#define ERASE_SEQFEATXREF_ON_SEQFEAT(Itr, Var)
ERASE_SEQFEATXREF_ON_SEQFEAT.
#define EDIT_EACH_SEQFEATXREF_ON_SEQFEAT(Itr, Var)
bool RemoveOldName(objects::CBioSource &src)
bool RemoveTaxId(objects::CBioSource &src)
@ eExistingText_append_semi
@ eExistingText_append_space
@ eExistingText_prefix_colon
@ eExistingText_append_none
@ eExistingText_leave_old
@ eExistingText_prefix_none
@ eExistingText_prefix_space
@ eExistingText_append_colon
@ eExistingText_prefix_comma
@ eExistingText_append_comma
@ eExistingText_prefix_semi
@ 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...
Template structure SStaticPair is simlified replacement of STL pair<> Main reason of introducing this...