295 for (
CSeq_loc_CI subloc(loc, objects::CSeq_loc_CI::eEmpty_Skip); subloc; ++subloc)
301 for (
CFeat_CI gene(bsh, subtype); gene; ++gene)
303 feature_handles.
insert(gene->GetSeq_feat_Handle());
307 for (
auto gene : feature_handles)
311 const CSeq_loc& gene_loc = gene.GetLocation();
312 bool any_match =
false;
313 for (
auto bsh : seen_bsh)
317 if (!subloc || !gene_subloc)
319 bool sub_exact =
false;
323 exact = exact && sub_exact;
324 if (sub_diff < INT_MAX)
344 best_non_exact = gene;
352 return best_non_exact;
365 CRangeWithFuzz(
const TParent& rg)
370 : TParent(it.GetRange()),
387 x_AddFuzz(m_Fuzz_from, rg.m_Fuzz_from, rg.m_Strand);
393 x_AddFuzz(m_Fuzz_to, rg.m_Fuzz_to, rg.m_Strand);
406 void CopyFrom(
const CRangeWithFuzz& rg)
412 void CopyTo(
const CRangeWithFuzz& rg)
426 else if (old_from == rg.GetFrom()) {
430 if (old_to !=
GetTo()) {
433 else if (old_to == rg.GetTo()) {
448 if (old_to !=
GetTo()) {
458 TFuzz copy_from_cref;
459 if (copy_from == fuzz) copy_from_cref.
Reset(copy_from);
465 new_fuzz->
Assign(*copy_from);
467 fuzz.Reset(new_fuzz);
478 x_SetFuzz(fuzz, other.GetPointerOrNull());
486 if (fuzz->Which() != other->Which()) {
496 switch ( fz.
Which() ) {
502 bool other_rev =
IsReverse(other_strand);
521 if ((!this_rev && other_lt) ||
522 (this_rev && other_gt)) {
527 if ((!this_rev && other_gt) ||
528 (this_rev && other_lt)) {
533 if (other_lim == this_lim) {
547 new_fuzz->
SetAlt().insert(
560 if (min1 > min2 || max1 < max2) {
600 class CSeq_id_Handle_Wrapper
608 if (
id.IsLocal() &&
id.GetLocal().IsStr()) {
617 bool operator== (
const CSeq_id_Handle_Wrapper& handle)
const
622 bool operator!= (
const CSeq_id_Handle_Wrapper& handle)
const
626 bool operator< (
const CSeq_id_Handle_Wrapper& handle)
const
675 TSynonymMap::iterator id_syn = m_SynMap.find(idh);
676 if (id_syn != m_SynMap.end()) {
677 return id_syn->second;
693 if (rank < best_rank) {
704 m_SynMap[syn_set->GetSeq_id_Handle(syn_it)] = best;
710 <<
" instead of GI " << gi);
721 CDefaultSynonymMapper syn_mapper(&scope);
723 CRangeWithFuzz total_rg(CRangeWithFuzz::GetEmpty());
724 CSeq_id_Handle_Wrapper prev_id;
729 CSeq_id_Handle_Wrapper next_id(syn_mapper.GetBestSynonym(it.GetSeq_id()), it.GetSeq_id());
740 else if (prev_id != next_id || prev_strand != next_strand)
743 id->Assign(*prev_id.GetSeqId());
745 if ( total_rg.IsSetFuzzFrom() )
747 interval->
SetFuzz_from().Assign(total_rg.GetFuzzFrom());
749 if ( total_rg.IsSetFuzzTo() )
751 interval->
SetFuzz_to().Assign(total_rg.GetFuzzTo());
754 total_rg = CRangeWithFuzz(CRangeWithFuzz::GetEmpty());
757 total_rg += CRangeWithFuzz(it);
759 prev_strand = next_strand;
762 if (!total_rg.Empty())
765 id->Assign(*prev_id.GetSeqId());
767 if ( total_rg.IsSetFuzzFrom() )
769 interval->
SetFuzz_from().Assign(total_rg.GetFuzzFrom());
771 if ( total_rg.IsSetFuzzTo() )
773 interval->
SetFuzz_to().Assign(total_rg.GetFuzzTo());
778 gene_loc->
SetInt(*interval);
931 new_prot_loc->
Assign(prot_loc);
988 if ((*annot_ci).IsFtable())
1079 new_prot_loc->
Assign(prot_loc);
1207 if ((*it)->IsSetData() && (*it)->GetData().IsGene())
1218 :
IEditingActionFeat(seh, subtype, feat_type, ncRNA_class,
"CEditingActionFeatComment")
1244 :
IEditingActionFeat(seh, subtype, feat_type, ncRNA_class,
"CEditingActionFeatException")
1273 const string &qual,
const string &name)
1289 if ((*gbqual_it) && (*gbqual_it)->IsSetQual() && (*gbqual_it)->GetQual() ==
m_qual)
1323 else if (!
value.empty())
1339 const string &qual1,
const string &qual2)
1340 :
CEditingActionFeatGbQual(seh, subtype, feat_type, ncRNA_class, qual1,
"CEditingActionFeatGbQualTwoNames"), m_qual2(qual2)
1355 if ((*gbqual_it) && (*gbqual_it)->IsSetQual() && ((*gbqual_it)->GetQual() ==
m_qual || (*gbqual_it)->GetQual() ==
m_qual2))
1392 string element_type, element_name;
1394 return !element_type.empty();
1406 string element_type, element_name;
1408 element_type =
value;
1409 if (!element_name.empty())
1410 element_type +=
":" + element_name;
1423 string element_type, element_name;
1425 return element_type;
1433 string element_type, element_name;
1435 if (!element_name.empty())
1455 string element_type, element_name;
1457 return !element_name.empty();
1469 string element_type, element_name;
1471 element_name =
value;
1472 if (!element_type.empty())
1473 element_name = element_type +
":" + element_name;
1486 string element_type, element_name;
1488 return element_name;
1496 string element_type, element_name;
1498 if (!element_type.empty())
1561 if (!db.empty() && !
tag.empty())
1577 dbtag->
SetTag().SetId(
id);
1593 return db +
":" +
tag;
1604 :
IEditingActionFeat(seh, subtype, feat_type, ncRNA_class,
"CEditingActionFeatEvidence")
1633 :
IEditingActionFeat(seh, subtype, feat_type, ncRNA_class,
"CEditingActionFeatPseudo")
1667 :
CEditingActionFeatGbQual(seh, subtype, feat_type, ncRNA_class,
"codons_recognized",
"CEditingActionFeatCodonsRecognized")
1678 return is_trna || is_qual;
1683 if (ch ==
'A' || ch ==
'T' || ch ==
'G' || ch ==
'C' || ch ==
'U') {
1693 "AC",
"AG",
"CG",
"ACG",
"AT",
"CT",
"ACT",
"GT",
"AGT",
"CGT",
"ACGT" };
1698 if (pos != string::npos) {
1708 vector<string> replacements;
1710 if (codon.length() == 3 &&
s_IsATGC(codon.c_str()[0])) {
1711 string this_codon = codon.substr(0, 1);
1712 replacements.push_back(this_codon);
1714 for (
int i = 1;
i < 3;
i++) {
1716 auto num_now = replacements.size();
1718 for (
unsigned int j = 1; j < ch.length(); j++) {
1719 for (
auto k = 0; k < num_now; k++) {
1720 string cpy = replacements[k];
1721 replacements.push_back(cpy);
1724 for (
auto k = 0; k < num_now; k++) {
1725 for (
unsigned int j = 0; j < ch.length(); j++) {
1726 replacements[j * num_now + k].append(ch.substr(j, 1));
1731 replacements.push_back(codon);
1733 return replacements;
1751 for (
unsigned int j = 0; j <
codons.size(); j++)
1793 :
CEditingActionFeatGbQual(seh, subtype, feat_type, ncRNA_class,
"transl_except",
"CEditingActionFeatTranslExcept")
1844 string loc_label = v[0];
1851 cb_loc->
SetPnt().SetPoint(start);
1884 vector<char> seqData;
1907 if (!loc_label.empty())
1937 return is_trna || is_qual;
1947 rval = (
string)
"complement(" + (partial3 ?
"<" :
"")
1949 +
".." + (partial5 ?
">" :
"")
1952 rval = (partial5 ?
"<" :
"")
1954 +
".." + (partial3 ?
">" :
"")
1991 else if (loc.
IsMix())
1996 if ( (*it)->IsInt())
2002 r =
"complex location";
2027 :
IEditingActionFeat(seh, subtype, feat_type, ncRNA_class,
"CEditingActionFeatRnaQual"), m_qual(qual), m_erase(
false)
2041 if ((*rnaqual_it)->IsSetQual() && (*rnaqual_it)->GetQual() ==
m_qual)
2063 if ((*gbqual_it)->IsSetQual() && (*gbqual_it)->GetQual() ==
m_qual)
2251 string str = (*it)->GetName();
2252 int id = (*it)->GetId();
2279 string str = (*it)->GetName();
2280 int id = (*it)->GetId();
2354 :
IEditingActionFeat(seh, subtype, feat_type, ncRNA_class,
"CEditingActionFeatNcRnaClass")
2445 if (!before && after)
2505 if (!before && after)
2512 :
IEditingActionFeat(seh, subtype, feat_type, ncRNA_class,
"CEditingActionFeatSynonym"), m_erase(
false), m_syn(
NULL), m_qual(
"synonym")
2548 if (!before && after)
2560 if ((*gbqual_it)->IsSetQual() && (*gbqual_it)->GetQual() ==
m_qual)
2686 if (!before && after)
2693 :
IEditingActionFeat(seh, subtype, feat_type, ncRNA_class,
"CEditingActionFeatActivity"), m_erase(
false), m_activity(
NULL), m_qual(
"activity")
2725 if ((*gbqual_it)->IsSetQual() && (*gbqual_it)->GetQual() ==
m_qual)
2796 :
IEditingActionFeat(seh, subtype, feat_type, ncRNA_class,
"CEditingActionFeatPartial")
2898 :
IEditingActionFeat(seh, subtype, feat_type, ncRNA_class,
"CEditingActionFeatEcNumber"), m_erase(
false), m_ec(
NULL), m_qual(
"EC_number")
2945 if ((*gbqual_it)->IsSetQual() && (*gbqual_it)->GetQual() ==
m_qual)
3028 const string& ncRNA_class)
3029 :
IEditingActionFeat(seh, subtype, feat_type, ncRNA_class,
"CEditingActionFeatProduct"), m_erase(
false), m_name(
NULL), m_qual(
"product")
3082 if ((*gbqual_it)->IsSetQual() && (*gbqual_it)->GetQual() ==
m_qual)
3128 if (
val ==
"fM" ||
val ==
"iM")
3130 if (
val ==
"fMet" ||
val ==
"iMet")
3215 return is_gene || is_xref || is_qual;
3262 if (!before && after)
3347 if ((*annot_ci).IsFtable())
3425 vector<CRef<CSeq_loc>> already_created;
3459 else if (!
IsNOOP(action))
3467 auto created = find_if(already_created.begin(), already_created.end(),[gene_loc](
CRef<CSeq_loc> loc) {return loc->Equals(*gene_loc);});
3468 if (
created == already_created.end())
3470 already_created.push_back(gene_loc);
3536 vector<CSeq_feat_Handle> feat_handles;
3544 feat_handles.push_back(fh);
3556 feat_handles.push_back(fh);
3560 vector<CRef<CSeq_loc>> already_created;
3561 for (
size_t i = 0;
i < feat_handles.size();
i++)
3576 auto created = find_if(already_created.begin(), already_created.end(),[gene_loc](
CRef<CSeq_loc> loc) {return loc->Equals(*gene_loc);});
3577 if (
created == already_created.end())
3579 already_created.push_back(gene_loc);
3604 m_Name =
"CEditingActionFeatRnaToGeneDesc";
3634 m_Name =
"CEditingActionFeatRnaToGeneMaploc";
3661 m_Name =
"CEditingActionFeatRnaToGeneLocus_tag";
3688 m_Name =
"CEditingActionFeatRnaToGeneSynonym";
3715 m_Name =
"CEditingActionFeatRnaToGeneComment";
3740 :
IEditingActionFeat(seh, subtype, feat_type, ncRNA_class,
"CEditingActionFeatFunction"), m_erase(
false), m_function(
NULL), m_qual(
"function")
3786 if ((*gbqual_it)->IsSetQual() && (*gbqual_it)->GetQual() ==
m_qual)
3909 const string& ncRNA_class)
3912 if (field ==
"comment" || field ==
"note")
3914 if (field ==
"exception")
3916 if (field ==
"locus" || field ==
"gene locus")
3918 if (field ==
"rpt_unit_seq")
3920 if (field ==
"inference")
3922 if (field ==
"bound_moiety")
3924 if (field ==
"chromosome")
3926 if (field ==
"compare")
3928 if (field ==
"cons_slice")
3930 if (field ==
"direction")
3932 if (field ==
"environmental_sample")
3934 if (field ==
"experiment")
3936 if (field ==
"focus")
3938 if (field ==
"frequency")
3940 if (field ==
"function")
3942 if (field ==
"label")
3946 if (field ==
"mod_base")
3948 if (field ==
"mol_type")
3950 if (field ==
"number")
3952 if (field ==
"old_locus_tag")
3954 if (field ==
"operon")
3956 if (field ==
"organism")
3958 if (field ==
"pcr_conditions")
3960 if (field ==
"phenotype")
3962 if (field ==
"plasmid")
3964 if (field ==
"protein_id")
3966 if (field ==
"rearranged")
3968 if (field ==
"regulatory_class")
3970 if (field ==
"replace")
3972 if (field ==
"rpt_family")
3974 if (field ==
"rpt_type")
3976 if (field ==
"rpt_unit")
3978 if (field ==
"rpt_unit_range")
3980 if (field ==
"segment")
3982 if (field ==
"sequenced_mol")
3984 if (field ==
"standard_name")
3986 if (field ==
"tag_peptide")
3988 if (field ==
"transcript_id")
3990 if (field ==
"transgenic")
3992 if (field ==
"transl_except")
3994 if (field ==
"usedin")
3996 if (field ==
"mobile_element")
3998 if (field ==
"mobile_element_type")
4000 if (field ==
"mobile_element_type_type")
4002 if (field ==
"mobile_element_type_name")
4004 if (field ==
"satellite")
4006 if (field ==
"satellite_type")
4008 if (field ==
"satellite_name")
4010 if (field ==
"db_xref")
4012 if (field ==
"evidence")
4014 if (field ==
"pseudogene" || field ==
"pseudo")
4016 if (field ==
"codons_recognized" || field ==
"codons recognized")
4018 if (field ==
"anticodon")
4020 if (field ==
"tag_peptide" || field ==
"tag-peptide")
4022 if (field ==
"region")
4024 if (field ==
"codon_start")
4026 if (field ==
"transl_table")
4028 if (field ==
"product name" || field ==
"product" || field ==
"name")
4030 if (field ==
"desc" || field ==
"description")
4032 if (field ==
"ncrna class" || field ==
"ncrna_class")
4034 if (field ==
"locus_tag")
4036 if (field ==
"maploc")
4038 if (field ==
"synonym" || field ==
"gene_synonym")
4040 if (field ==
"allele")
4042 if (field ==
"activity")
4044 if (field ==
"partial")
4046 if (field ==
"ec_number")
4048 if (field ==
"translation")
4057 if (field ==
"gene locus")
4059 if (field ==
"gene description")
4061 if (field ==
"gene maploc")
4063 if (field ==
"gene locus tag")
4065 if (field ==
"gene synonym")
4067 if (field ==
"gene comment")
4078 if (field ==
"gene locus")
4080 if (field ==
"gene description" || field ==
"protein description" || field ==
"mat_peptide description")
4082 if (field ==
"gene maploc")
4084 if (field ==
"gene locus tag")
4086 if (field ==
"gene synonym")
4088 if (field ==
"gene comment" || field ==
"cds comment" || field ==
"mrna comment" || field ==
"mat_peptide comment" || field ==
"protein comment")
4090 if (field ==
"gene old_locus_tag")
4092 if (field ==
"gene allele")
4094 if (field ==
"gene inference" || field ==
"cds inference")
4096 if (field ==
"protein name" || field ==
"mrna product" || field ==
"mat_peptide name")
4098 if (field ==
"protein ec number" || field ==
"mat_peptide ec number")
4100 if (field ==
"protein activity" || field ==
"mat_peptide activity")
4102 if (field ==
"codon-start")
static CRef< CScope > m_Scope
bool IsReverse(ENa_strand s)
@ eExtreme_Positional
numerical value
@ eExtreme_Biological
5' and 3'
bool operator!=(const _Ht_iterator< _Val, _Nonconst_traits< _Val >, _Key, _HF, _ExK, _EqK, _All > &__x, const _Ht_iterator< _Val, _Const_traits< _Val >, _Key, _HF, _ExK, _EqK, _All > &__y)
virtual ~CDefaultSynonymMapper(void)
CDefaultSynonymMapper(CScope *scope)
map< CSeq_id_Handle, CSeq_id_Handle > TSynonymMap
CRef< CSeq_id_Mapper > m_IdMapper
virtual CSeq_id_Handle GetBestSynonym(const CSeq_id &id)
virtual bool Match(const string &value)
CEditingActionFeatActivity(CSeq_entry_Handle seh, const CSeqFeatData::ESubtype subtype, const CSeqFeatData::E_Choice feat_type, const string &ncRNA_class)
virtual void SetValue(const string &value)
virtual bool IsSetValue(void)
virtual string GetValue(void)
virtual void ResetValue(void)
virtual void Modify(EActionType action)
CRef< CGb_qual > m_GBqual
virtual void SetValue(const string &value)
virtual string GetValue(void)
virtual bool IsSetValue(void)
virtual void ResetValue(void)
CEditingActionFeatAllele(CSeq_entry_Handle seh, const CSeqFeatData::ESubtype subtype, const CSeqFeatData::E_Choice feat_type, const string &ncRNA_class)
virtual void SetValue(const string &value)
CEditingActionFeatAnticodon(CSeq_entry_Handle seh, const CSeqFeatData::ESubtype subtype, const CSeqFeatData::E_Choice feat_type, const string &ncRNA_class)
virtual string GetValue(void)
string GetIntervalString(const CSeq_interval &seq_int)
virtual bool IsSetValue(void)
virtual void ResetValue(void)
virtual string GetValue(void)
virtual void ResetValue(void)
virtual bool IsSetValue(void)
virtual void SetValue(const string &value)
CEditingActionFeatCodonStart(CSeq_entry_Handle seh, const CSeqFeatData::ESubtype subtype, const CSeqFeatData::E_Choice feat_type, const string &ncRNA_class)
virtual string GetValue(void)
virtual bool IsSetValue(void)
virtual void ResetValue(void)
virtual void SetValue(const string &value)
CEditingActionFeatCodonsRecognized(CSeq_entry_Handle seh, const CSeqFeatData::ESubtype subtype, const CSeqFeatData::E_Choice feat_type, const string &ncRNA_class)
virtual void Modify(EActionType action)
virtual bool IsSetValue(void)
virtual string GetValue(void)
virtual void ResetValue(void)
CEditingActionFeatDbxref(CSeq_entry_Handle seh, const CSeqFeatData::ESubtype subtype, const CSeqFeatData::E_Choice feat_type, const string &ncRNA_class)
virtual void SetValue(const string &value)
virtual bool IsSetValue(void)
virtual void SetValue(const string &value)
virtual void ResetValue(void)
virtual string GetValue(void)
CEditingActionFeatDesc(CSeq_entry_Handle seh, const CSeqFeatData::ESubtype subtype, const CSeqFeatData::E_Choice feat_type, const string &ncRNA_class)
virtual bool IsSetValue(void)
virtual string GetValue(void)
virtual void ResetValue(void)
virtual void SetValue(const string &value)
CEditingActionFeatDualVal1(CSeq_entry_Handle seh, const CSeqFeatData::ESubtype subtype, const CSeqFeatData::E_Choice feat_type, const string &ncRNA_class, const string &qual)
virtual void ResetValue(void)
CEditingActionFeatDualVal2(CSeq_entry_Handle seh, const CSeqFeatData::ESubtype subtype, const CSeqFeatData::E_Choice feat_type, const string &ncRNA_class, const string &qual)
virtual bool IsSetValue(void)
virtual void SetValue(const string &value)
virtual string GetValue(void)
virtual void Modify(EActionType action)
virtual void FindRelated(EActionType action)
virtual bool IsSetValue(void)
virtual void Find(EActionType action)
CEditingActionFeatEcNumber(CSeq_entry_Handle seh, const CSeqFeatData::ESubtype subtype, const CSeqFeatData::E_Choice feat_type, const string &ncRNA_class)
virtual void ResetValue(void)
virtual string GetValue(void)
CRef< CGb_qual > m_GBqual
virtual void SetValue(const string &value)
virtual string GetValue(void)
virtual void SetValue(const string &value)
virtual bool IsSetValue(void)
virtual void ResetValue(void)
CEditingActionFeatEvidence(CSeq_entry_Handle seh, const CSeqFeatData::ESubtype subtype, const CSeqFeatData::E_Choice feat_type, const string &ncRNA_class)
CEditingActionFeatException(CSeq_entry_Handle seh, const CSeqFeatData::ESubtype subtype, const CSeqFeatData::E_Choice feat_type, const string &ncRNA_class)
virtual string GetValue(void)
virtual void ResetValue(void)
virtual void SetValue(const string &value)
virtual bool IsSetValue(void)
virtual bool IsSetValue(void)
virtual void SetValue(const string &value)
virtual void ResetValue(void)
CEditingActionFeatFunction(CSeq_entry_Handle seh, const CSeqFeatData::ESubtype subtype, const CSeqFeatData::E_Choice feat_type, const string &ncRNA_class)
virtual string GetValue(void)
CRef< CGb_qual > m_GBqual
virtual void Modify(EActionType action)
virtual void Modify(EActionType action)
CEditingActionFeatGbQualTwoNames(CSeq_entry_Handle seh, const CSeqFeatData::ESubtype subtype, const CSeqFeatData::E_Choice feat_type, const string &ncRNA_class, const string &qual1, const string &qual2)
virtual void SetValue(const string &value)
virtual void ResetValue(void)
CRef< CGb_qual > m_GBqual
virtual void Modify(EActionType action)
virtual bool IsSetValue(void)
CEditingActionFeatGbQual(CSeq_entry_Handle seh, const CSeqFeatData::ESubtype subtype, const CSeqFeatData::E_Choice feat_type, const string &ncRNA_class, const string &qual, const string &name="CEditingActionFeatGbQual")
virtual string GetValue(void)