187 if (cf != created_features.
end())
212 cmd->AddCommand(*chgFeat);
214 cmd->AddCommand(*update_mrna_cmd);
215 if (retranslate_cds_cmd)
216 cmd->AddCommand(*retranslate_cds_cmd);
228 if (cd != created_descriptors.
end())
238 else if (dd != deleted_descriptors.
end())
241 const CSeqdesc *old_desc = it->first;
246 const CSeqdesc *old_desc = it->first;
267 auto ctxt_it = descr_contexts.
find(old_desc);
268 if (ctxt_it != descr_contexts.
end()) {
270 cmd->AddCommand(*ecmd);
282 cmd->AddCommand(*chg_submit);
308 prot_product = *name_it;
309 if (!prot_product.empty())
325 new_mrna->
Assign(*orig_mrna);
327 new_mrna->
SetData().SetRna().SetRnaProductName(prot_product, remainder);
337 bool cds_change(
false);
428 void IEditingAction::Edit(
const string& find,
const string& replace, macro::CMacroFunction_EditStringQual::ESearchLoc edit_loc,
bool case_insensitive,
bool is_regex)
466 source->SwapContext(
this);
472 source->IEditingAction::SwapContext(
this);
490 source->SwapContext(
this);
496 source->IEditingAction::SwapContext(
this);
514 source->SwapContext(
this);
520 source->IEditingAction::SwapContext(
this);
539 source->SwapContext(
this);
545 source->IEditingAction::SwapContext(
this);
814 parse_options.SetShouldRemove(
false);
828 action2->ResetChangedFeatures();
829 action2->ResetChangedDescriptors();
830 action2->ResetChangedInstances();
831 action2->ResetChangedIds();
832 action2->ResetChangedValues();
843 const string& ncRNA_class,
888 if (!field_name_panel)
895 if (field_name.empty())
905 if (field ==
"protein name" || field ==
"protein description" || field ==
"protein EC number"
906 || field ==
"protein activity" || field ==
"protein comment")
910 else if (field ==
"CDS comment" || field ==
"CDS inference" || field ==
"codon-start")
914 else if ( field ==
"gene description" || field ==
"gene comment"
915 || field ==
"gene inference" || field ==
"gene allele" || field ==
"gene maploc"
916 || field ==
"gene locus tag" || field ==
"gene synonym" || field ==
"gene old_locus_tag"
917 || field ==
"gene locus")
921 else if (field ==
"mRNA product" || field ==
"mRNA comment")
925 else if (field ==
"mat_peptide name" || field ==
"mat_peptide description" || field ==
"mat_peptide EC number"
926 || field ==
"mat_peptide activity" || field ==
"mat_peptide comment")
947 if (!rna_type.empty())
949 if (rna_type ==
"preRNA")
951 else if (rna_type ==
"mRNA")
953 else if (rna_type ==
"tRNA")
955 else if (rna_type ==
"rRNA")
957 else if (rna_type ==
"ncRNA") {
958 ncRNA_class = ncrna_class;
961 else if (rna_type ==
"tmRNA")
963 else if (rna_type ==
"miscRNA")
978 ncRNA_class =
"snRNA";
982 ncRNA_class =
"scRNA";
986 ncRNA_class =
"snoRNA";
993 const CSeqdesc * old_desc =
dynamic_cast<const CSeqdesc *
>(
object.GetPointer());
1000 new_desc->
Assign(*old_desc);
1001 new_obj = (
CObject *)new_desc;
1002 }
else if (old_feat) {
1005 new_feat->
Assign(*old_feat);
1006 new_obj = (
CObject *)new_feat;
1015 bool success =
false;
1023 if (seh && new_desc) {
1025 cmd->AddCommand(*ecmd);
1028 }
else if (old_feat) {
1042 const string &field,
1045 const string& ncRNA_class,
1050 action->SetConstraint(constraint);
1057 vector<CConstRef<CObject> > objs;
1058 for (
auto &fh : feathdlesmap)
1060 objs.emplace_back(fh.first.GetSeq_feat());
1062 for (
auto &dh : descrmap)
1066 for (
auto &bh : instmap)
1075 if (!descrmap.
empty() && descr_context) {
1077 descr_context->clear();
1078 for (
auto& it : contextmap) {
1079 descr_context->emplace_back(it.second);
CSeq_entry_Handle GetSeqEntryForSeqdesc(CRef< CScope > scope, const CSeqdesc &seq_desc)
bool IsGeneralIdProtPresent(objects::CSeq_entry_Handle tse)
virtual string GetFieldName(const bool subfield=false)
Returns the name of the field as selected in the panel.
void Add(CObject *obj, const CObject *new_obj)
string GetRnaTypeOnly(void)
string GetNcrnaType(void)
virtual bool Match(const string &value)
@ eFieldType_BankITComment
@ eFieldType_TaxnameAfterBinomial
@ eFieldType_StructuredComment
string GetRnaTypeOnly(void)
string GetNcrnaType(void)
static CRef< CCmdComposite > RetranslateCDSCommand(CScope &scope, const CSeq_feat &old_cds, CSeq_feat &cds, bool &cds_change, int &offset, bool create_general_only)
ESubtype GetSubtype(void) const
static E_Choice GetTypeFromSubtype(ESubtype subtype)
@ eSubtype_mat_peptide_aa
static ESubtype SubtypeNameToValue(CTempString sName)
Turn a string into its ESubtype which is NOT necessarily related to the identifier of the enum.
namespace ncbi::objects::
void SetExistingText(edit::EExistingText existing_text)
const string GetName(void) const
void SetTopSeqEntry(CSeq_entry_Handle seh)
virtual void FindRelated(EActionType action)=0
virtual void SetValue(const string &value)=0
edit::EExistingText m_existing_text
map< const CSeqdesc *, CSeq_entry_Handle > m_ContextForDescriptors
CRef< CSubmit_block > GetChangedSubmitBlock(void)
void ResetChangedFeatures(void)
virtual void Find(EActionType action)=0
void ConvertFrom(ECapChange cap_change, bool leave_on_original, const string &strip_name, IEditingAction *destination)
void Apply(const string &value)
virtual void Modify(EActionType action)=0
map< const CSeqdesc *, CSeq_entry_Handle > m_CreatedDescriptors
void SetConstraint(CRef< CEditingActionConstraint > constraint)
const vector< string > & GetChangedValues(void)
const map< const CSeqdesc *, CSeq_entry_Handle > & GetDeletedDescriptors(void)
CSeq_entry_Handle m_TopSeqEntry
void ResetChangedDescriptors(void)
CConstRef< objects::CSeq_submit > m_SeqSubmit
const map< CSeq_feat_Handle, CRef< CSeq_feat > > & GetChangedFeatures(void)
const map< CBioseq_Handle, CRef< CSeq_inst > > & GetChangedInstances(void)
void ConvertTo(const string &value, IEditingAction *source)
void ResetChangedIds(void)
map< const CSeqdesc *, CRef< CSeqdesc > > m_ChangedDescriptors
IEditingAction(CSeq_entry_Handle seh, const string &name, CConstRef< objects::CSeq_submit > submit=CConstRef< objects::CSeq_submit >(NULL))
macro::CMacroFunction_EditStringQual::ESearchLoc m_edit_loc
map< CSeq_feat_Handle, CRef< CSeq_feat > > m_ChangedFeatures
CRef< CCmdComposite > GetActionCommand(void)
CRef< CCmdComposite > GetRetranslateCdsCmd(const CSeq_feat_Handle fh, const CRef< CSeq_feat > feat, int &offset, bool create_general_only)
void DoRemoveOutside(void)
void RemoveOutside(CRef< macro::CRemoveTextOptions > options)
CRef< CSubmit_block > m_ChangedSubmitBlock
virtual bool SameObject()=0
const map< const CSeqdesc *, CSeq_entry_Handle > & GetContextForDescriptors(void)
bool IsTo(EActionType action)
int CheckForExistingText(CIRef< IEditingAction > action2, EActionType action_type, edit::CParseTextOptions parse_options=edit::CParseTextOptions())
void CopyTo(const string &value, IEditingAction *source)
CIRef< IEditCommand > GetUpdateMRNAProductNameCmd(const CSeq_feat_Handle fh, const CRef< CSeq_feat > feat)
CSeq_entry_Handle m_CurrentSeqEntry
void SwapFrom(IEditingAction *destination)
CConstRef< objects::CSeq_submit > GetSeqSubmit(void)
void CopyFrom(IEditingAction *destination)
void Action(EActionType action)
vector< string > m_ChangedValues
const map< const CSeqdesc *, CRef< CSeqdesc > > & GetChangedDescriptors(void)
void SwapTo(const string &value, IEditingAction *source)
void ParseFrom(edit::CParseTextOptions parse_options, IEditingAction *destination)
CRef< macro::CRemoveTextOptions > m_remove_options
map< CSeq_feat_Handle, CSeq_entry_Handle > m_CreatedFeatures
void ResetChangedInstances(void)
const vector< string > & GetValues(void)
@ eActionType_RemoveOutside
@ eActionType_ConvertFrom
edit::CParseTextOptions m_parse_options
virtual void SwapContext(IEditingAction *source)
bool IsFrom(EActionType action)
virtual bool IsSetValue(void)=0
const map< CSeq_feat_Handle, CSeq_entry_Handle > & GetCreatedFeatures(void)
virtual void ResetValue(void)=0
CRef< CEditingActionConstraint > m_constraint
void ResetChangedValues(void)
bool IsCreateNew(EActionType action)
const map< const CSeqdesc *, CSeq_entry_Handle > & GetCreatedDescriptors(void)
virtual void ResetScope()
map< const CSeqdesc *, CSeq_entry_Handle > m_DeletedDescriptors
void Edit(const string &find, const string &replace, macro::CMacroFunction_EditStringQual::ESearchLoc edit_loc, bool case_insensitive, bool is_regex)
void ParseTo(const string &value, IEditingAction *source)
virtual string GetValue(void)=0
bool IsNOOP(EActionType action)
void HandleValue(const string &value)
map< CBioseq_Handle, CRef< CSeq_inst > > m_ChangedInstances
const_iterator begin() const
const_iterator end() const
const_iterator find(const key_type &key) const
static void cleanup(void)
CChangeUnindexedObjectCommand< objects::CSubmit_block > CChangeSubmitBlockCommand
static auto & RemoveFieldNameFromString
static auto & FixCapitalizationInString
IEditingActionBiosource * CreateActionBiosource(CSeq_entry_Handle seh, string field)
IEditingActionDesc * CreateActionDesc(CSeq_entry_Handle seh, const string &field, CConstRef< objects::CSeq_submit > submit=CConstRef< objects::CSeq_submit >(NULL))
IEditingActionFeat * CreateActionCdsGeneProt(CSeq_entry_Handle seh, string field, const CSeqFeatData::ESubtype subtype, const string &ncRNA_class=kEmptyStr)
IEditingActionFeat * CreateActionFeat(CSeq_entry_Handle seh, string field, const CSeqFeatData::ESubtype subtype, const CSeqFeatData::E_Choice feat_type, const string &ncRNA_class)
IEditingActionFeat * CreateActionRna(CSeq_entry_Handle seh, string field, const CSeqFeatData::ESubtype subtype, const string &ncRNA_class)
IEditingAction * CreateActionMisc(CSeq_entry_Handle seh, const string &field)
CEditingActionSeqid * CreateActionSeqid(CSeq_entry_Handle seh, const string &field)
int CorrectForncRNASubtypes(CSeqFeatData::ESubtype subtype, string &ncRNA_class)
int GetSubtype(CFieldNamePanel *field_name_panel, string &ncRNA_class)
CRef< CCmdComposite > GetReplacementCommand(CConstRef< CObject > oldobj, CRef< CObject > newobj, CScope &scope, const string &cmd_name)
vector< CConstRef< CObject > > GetObjects(CSeq_entry_Handle seh, const string &field, CFieldNamePanel::EFieldType field_type, int subtype, const string &ncRNA_class, CConstRef< CSeq_submit > submit, CRef< CEditingActionConstraint > constraint, vector< CSeq_entry_Handle > *descr_context)
CRef< CObject > GetNewObject(CConstRef< CObject > object)
CIRef< IEditingAction > CreateAction(CSeq_entry_Handle seh, const string &field, CFieldNamePanel::EFieldType field_type, int subtype, const string &ncRNA_class, CConstRef< objects::CSeq_submit > submit)
void swap(NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair1, NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair2)
void CleanupForTaxnameChange(CObjectInfo oi)
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
const CSeq_feat * GetCDSForProduct(const CBioseq &product, CScope *scope)
Get the encoding CDS feature of a given protein sequence.
CConstRef< CSeq_feat > GetmRNAforCDS(const CSeq_feat &cds, CScope &scope)
GetmRNAforCDS A function to find a CSeq_feat representing the appropriate mRNA for a given CDS.
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)
TClass GetClass(void) const
virtual const CSeq_loc & GetLocation(void) const
CSeq_entry_Handle GetTopLevelEntry(void) const
Get top level Seq-entry handle.
bool IsSetClass(void) const
CScope & GetScope(void) const
Get scope this handle belongs to.
CConstRef< CSeq_feat > GetOriginalSeq_feat(void) const
bool HasParentEntry(void) const
Check if current seq-entry has a parent.
CSeq_entry_Handle GetParentEntry(void) const
Get parent Seq-entry handle.
TObjectType * GetPointer(void) const THROWS_NONE
Get pointer,.
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.
#define numeric_limits
Pre-declaration of the "numeric_limits<>" template Forcibly overrides (using preprocessor) the origin...
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static bool IsBlank(const CTempString str, SIZE_TYPE pos=0)
Check if a string is blank (has no text).
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 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.
bool IsSetOrg(void) const
Check if a value has been assigned to Org data member.
const TOrg & GetOrg(void) const
Get the Org member data.
const TTaxname & GetTaxname(void) const
Get the Taxname member data.
bool IsSetTaxname(void) const
preferred formal name Check if a value has been assigned to Taxname data member.
bool IsSetData(void) const
the specific data Check if a value has been assigned to Data data member.
bool IsCdregion(void) const
Check if variant Cdregion is selected.
const TData & GetData(void) const
Get the Data member data.
const TExcept_text & GetExcept_text(void) const
Get the Except_text member data.
bool IsSetExcept_text(void) const
explain if except=TRUE Check if a value has been assigned to Except_text data member.
void SetData(TData &value)
Assign a value to Data data member.
const TProt & GetProt(void) const
Get the variant data.
@ eClass_nuc_prot
nuc acid and coded proteins
const TSource & GetSource(void) const
Get the variant data.
bool IsSource(void) const
Check if variant Source is selected.
TSource & SetSource(void)
Select the variant.
const TSub & GetSub(void) const
Get the Sub member data.
const CharType(& source)[N]
Utility macros and typedefs for exploring NCBI objects from seqfeat.asn.
#define FOR_EACH_NAME_ON_PROTREF(Itr, Var)
FOR_EACH_NAME_ON_PROTREF EDIT_EACH_NAME_ON_PROTREF.
static const char * str(char *buf, int n)
@ 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...