85 mapper->SetMergeAll();
94 const int aln_stop = align.
GetSeqStop(oldseqRow);
96 const int aln_start_new = align.
GetSeqStart(newseqRow);
97 const int aln_stop_new = align.
GetSeqStop(newseqRow);
105 pTargetInt->
SetId().Assign(newId);
111 source.SetInt().Assign(origInterval);
114 if (mapped && !mapped->
IsNull()) {
129 pTargetInt->
SetTo(0);
133 if (orig_start < aln_start) {
135 offset = aln_stop_new + (aln_start - orig_start);
136 if (
offset > (
int)newLength - 1) {
142 offset = aln_start_new - (aln_start - orig_start);
148 }
else if (orig_start > aln_stop) {
150 offset = aln_start_new - (orig_start - aln_stop);
157 offset = aln_stop_new + (orig_start - aln_stop);
158 if (
offset > (
int)newLength - 1) {
166 if (orig_stop < aln_start) {
168 offset = aln_stop_new + (aln_start - orig_stop);
169 if (
offset > (
int)newLength - 1) {
175 offset = aln_start_new - (aln_start - orig_stop);
181 }
else if (orig_stop > aln_stop){
183 offset = aln_start_new - (orig_stop - aln_stop);
190 offset = aln_stop_new + (orig_stop - aln_stop);
191 if (
offset > (
int)newLength - 1) {
199 if (is_circular && pTargetInt->
GetFrom() > pTargetInt->
GetTo()) {
203 pTargetInt->
SetTo(start);
243 switch (origLoc.
Which()) {
247 shortInt->SetId().Assign(pnt.
GetId());
256 shortInt->SetFuzz_from().
Assign(fuzz);
259 shortInt->SetFuzz_to().Assign(fuzz);
263 CRef<CSeq_interval> pTargetInt = s_MapInterval(*shortInt, newId, align, is_circular, scope, newLength);
265 mappedLoc->SetInt(*pTargetInt);
273 mappedLoc->SetInt(*pTargetInt);
280 bool subloc_added =
false;
282 CRef<CSeq_interval> sub_interval = s_MapInterval(*cit, newId, align, is_circular, scope, newLength);
288 if (subloc_added)
return mappedLoc;
293 bool subloc_added =
false;
294 for (
auto&& cit : origLoc.
GetMix().
Get()) {
295 CRef<CSeq_loc> target_loc = s_MapLocation(*cit, newId, align, is_circular, scope, newLength);
301 if (subloc_added)
return mappedLoc;
334 if (!SameStrand(loc1, loc2) || loc1.
Compare(loc2)) {
350 if ((processed1 && !processed2) || (!processed1 && processed2)) {
353 if (processed1 && processed2
361 if (!SameStrand(loc1, loc2)) {
367 while (loc1_it && loc2_it) {
368 if (loc1_it.GetRange() != loc2_it.GetRange()) {
374 if (loc1_it || loc2_it) {
381 #define FUSE_STRINGFIELDS(Var1, Var2, Field) \
383 string orig_value = (Var1).IsSet##Field() ? (Var1).Get##Field() : kEmptyStr; \
384 string value = (Var2).IsSet##Field() ? (Var2).Get##Field() : kEmptyStr; \
385 if (!NStr::EqualNocase(orig_value, value) && edit::AddValueToString(orig_value, value, edit::eExistingText_append_semi)) { \
386 (Var1).Set##Field(orig_value); \
390 #define FUSE_BOOLEANFIELDS(Var1, Var2, Field) \
392 bool fused_value = (Var1).IsSet##Field() ? (Var1).Get##Field() : false; \
393 bool value = (Var2).IsSet##Field() ? (Var2).Get##Field() : false; \
394 if (fused_value || value) { \
395 (Var1).Set##Field(true); \
397 (Var1).Reset##Field(); \
401 #define FUSE_LISTFIELDS(Var1, Var2, Type, Field) \
402 if ((Var2).IsSet##Field() && !(Var2).Get##Field().empty()) { \
403 C##Type::T##Field& cont = (Var1).Set##Field(); \
404 copy((Var2).Get##Field().begin(), (Var2).Get##Field().end(), back_inserter(cont)); \
407 #define FUSE_VECTORFIELDS(Var1, Var2, Type, Field) \
409 if ((Var2).IsSet##Field() && !(Var2).Get##Field().empty()) { \
410 size_t new_size = (Var2).Get##Field().size(); \
411 new_size += (Var1).IsSet##Field() ? (Var1).Get##Field().size() : 0; \
412 C##Type::T##Field& cont = (Var1).Set##Field(); \
413 cont.reserve(new_size); \
414 copy((Var2).Get##Field().begin(), (Var2).Get##Field().end(), back_inserter(cont)); \
474 if (ci->IsFtable()) {
489 : m_OldBsh(updseq_in.GetNCOldBioseq()),
490 m_UpdBsh(updseq_in.GetUpdateBioseq()),
491 m_Align(updseq_in.GetAlignment()),
499 "Sequence can not be updated: either the update sequence or the alignment is missing");
504 "Sequence can not be updated: update parameters are not valid");
509 "The old sequence can not be updated: unsupported seq-gap");
516 "The update sequence contains gaps features.\nPlease convert your file so that gaps are runs of N's before updating the sequence.");
534 return old_raw || old_delta;
572 descr.assign(
"No change");
576 descr.assign(
"Replace sequence");
579 Patch(create_general_only);
580 descr.assign(
"Patch sequence");
584 descr.assign(
"Extend 5' end");
588 descr.assign(
"Extend 3' end");
628 newLength =
m_NewEntry->GetSeq().GetInst().GetLength();
632 if ((*it)->IsSeq()) {
633 newLength = (*it)->GetSeq().GetLength();
728 TSeqPos offset_old = 0, offset_import = 0;
730 offset_old =
m_UpdBsh.GetBioseqLength();
733 offset_import =
m_OldBsh.GetBioseqLength();
789 NCBI_THROW(
CSeqUpdateException, eInternal,
"Could not replace the old sequence: old sequence is neither raw nor it can be converted to raw.");
808 NCBI_THROW(
CSeqUpdateException, eInternal,
"Could not replace the old sequence: update sequence is neither raw nor it can be converted to raw.");
822 _ASSERT(oldseqRow != updseqRow);
840 if (aln_start < aln_start_upd)
843 aln_start -= aln_start_upd;
846 TSeqPos right_edge = upd_length - 1 - aln_stop_upd;
847 aln_stop += right_edge;
848 if (aln_stop > old_length - 1)
849 aln_stop = old_length - 1;
859 patched.append(old_5prime);
863 if (aln_start_upd < aln_stop_upd) {
865 upd_seq.
GetSeqData(aln_start_upd, aln_stop_upd + 1, middle);
866 patched.append(middle);
870 if (aln_stop + 1 < old_length) {
872 old_seq.
GetSeqData(aln_stop + 1, old_length, old_3prime);
873 patched.append(old_3prime);
891 _ASSERT(oldseqRow != updseqRow);
892 _ASSERT(oldseqRow > -1 && updseqRow > -1);
904 upd_seq.
GetSeqData(0, aln_stop_upd + 1, new_5prime);
905 new_seq.append(new_5prime);
910 new_seq.append(old_3prime);
921 new_seq.append(old_5prime);
926 new_seq.append(new_3prime);
936 if (extension.empty()) {
940 const string allowed(
"ATUCGRYSWKMBDHVN");
941 string small_allowed(allowed);
945 valid_extension.reserve(extension.size());
946 copy_if(extension.begin(), extension.end(),
947 back_inserter(valid_extension),
948 [&allowed, &small_allowed](
const char& c) {
return (allowed.find(c) !=
NPOS) || (small_allowed.find(c) !=
NPOS); });
950 return valid_extension;
956 if (extension.empty()
963 if (valid_extension.empty()) {
973 new_seq.assign(valid_extension);
974 new_seq.append(orig_seq);
976 new_seq.assign(orig_seq);
977 new_seq.append(valid_extension);
1000 new_inst->
SetLength(
static_cast<int>(upd_str.size()));
1018 shifted_feat->
Assign(feat);
1027 return shifted_feat;
1035 if ((*it)->IsSetLoc()) {
1036 const CSeq_loc& codebreak = (*it)->GetLoc();
1038 (*it)->SetLoc(*new_codebreak);
1060 shiftedLoc->
Assign(sourceLoc);
1063 for (; loc_it; ++loc_it) {
1087 if (feat_it->GetLocation().IsInt()) {
1090 if (start == 0 && stop ==
m_OldBsh.GetBioseqLength() - 1) {
1146 if (entry->
IsSeq()) {
1161 CBioseq_set::TSeq_set::iterator it = seqset.begin();
1162 while (it != seqset.end()) {
1164 if ((*it)->IsSeq() && (*it)->GetSeq().IsAa()) {
1165 it = seqset.erase(it);
1181 return m_OldBsh.GetSeq_entry_Handle();
1190 oldSeh =
m_OldBsh.GetSeq_entry_Handle();
1214 subtype.append(
" " +
label);
1241 return (stop > aln_start && start <= aln_stop);
1244 return (stop <= aln_start || start > aln_stop);
1269 if (
rna.IsSetExt() &&
1270 rna.GetExt().IsTRNA() &&
1271 rna.GetExt().GetTRNA().IsSetAnticodon()) {
1274 new_anticodon->
Assign(
rna.GetExt().GetTRNA().GetAnticodon());
1276 rna.SetExt().SetTRNA().SetAnticodon(*new_anticodon);
1283 if ((*it)->IsSetLoc()) {
1285 new_codebreak->
Assign((*it)->GetLoc());
1287 (*it)->SetLoc(*new_codebreak);
1293 return mappedFeature;
1320 if (
rna.IsSetExt() &&
1321 rna.GetExt().IsTRNA() &&
1322 rna.GetExt().GetTRNA().IsSetAnticodon()) {
1324 const CSeq_loc& anticodon =
rna.GetExt().GetTRNA().GetAnticodon();
1326 rna.SetExt().SetTRNA().SetAnticodon(*new_anticodon);
1333 if ((*it)->IsSetLoc()) {
1334 const CSeq_loc& codebreak = (*it)->GetLoc();
1336 (*it)->SetLoc(*new_codebreak);
1342 return mappedFeature;
1347 if (!fh || row < 0) {
1354 if (loc_id_type != align_id_type) {
1360 copy->SetLocation().SetId(alignId);
1363 if (
rna.IsSetExt() &&
1364 rna.GetExt().IsTRNA() &&
1365 rna.GetExt().GetTRNA().IsSetAnticodon()) {
1366 rna.SetExt().SetTRNA().SetAnticodon().SetId(alignId);
1369 else if (
copy->GetData().IsCdregion()) {
1373 if ((*it)->IsSetLoc()) {
1374 (*it)->SetLoc().SetId(alignId);
1404 "Could not form alignment between the subject sequence (old or update) and newly formed sequence");
1419 vector<CRef<CSeq_id> >& ids = denseg.
SetIds();
1438 bool deleteOld(
false);
1440 if (AreFeaturesDuplicates(**old_it, **imp_it)) {
1451 (*imp_it).Swap(fusedFeat);
1471 fusedFeat->
Assign(feat_upd);
1474 FuseCommonFeatureFields(*fusedFeat, feat_old);
1481 FuseGenes(fusedGene, gene);
1489 FuseProteins(*fusedFeat, feat_old);
1496 rna.IsSetExt() &&
rna.GetExt().IsName()) {
1498 string value =
rna.GetExt().GetName();
1501 fusedRna.
SetExt().SetName(orig_value);
1511 fusedFeat->
SetData().SetRegion(origRegion);
1535 for (
CFeat_CI prot_it(old_protsh); prot_it; ++prot_it) {
1537 new_feat->
Assign(*prot_it->GetSeq_feat());
1538 old_protfeats.push_back(new_feat);
1541 for (
CFeat_CI prot_it(fused_protsh); prot_it; ++prot_it) {
1543 new_feat->
Assign(*prot_it->GetSeq_feat());
1544 upd_protfeats.push_back(new_feat);
1547 TFeatList::iterator old_it = old_protfeats.begin();
1548 bool found_duplicate =
false;
1549 while (old_it != old_protfeats.end()) {
1550 TFeatList::iterator imp_it = upd_protfeats.begin();
1551 bool deleteOld(
false);
1552 while (imp_it != upd_protfeats.end() && !deleteOld) {
1553 if (AreProteinFeaturesDuplicates(**old_it, **imp_it)) {
1556 (*imp_it).Swap(fusedFeat);
1557 found_duplicate =
true;
1564 old_it = old_protfeats.erase(old_it);
1574 if (!found_duplicate) {
1589 newAnnot->
SetData().SetFtable().push_back(feat);
1594 newAnnot->
SetData().SetFtable().push_back(feat);
1605 bool has_non_cds =
false;
1612 seqAnnot->
SetData().SetFtable().push_back(feat);
1624 seqAnnot->
SetData().SetFtable().push_back(feat);
1666 bool has_cds =
false;
1696 CSeq_descr::Tdata::iterator desc_it = seq_descr.begin();
1697 while (desc_it != seq_descr.end()) {
1698 if ((*desc_it)->IsSource() || (*desc_it)->IsPub()) {
1700 cpy->Assign(**desc_it);
1702 desc_it = seq_descr.erase(desc_it);
1717 setAnnot->
SetData().SetFtable().push_back(feat);
1725 setAnnot->
SetData().SetFtable().push_back(feat);
1735 setAnnot->
SetData().SetFtable().push_back(feat);
1743 setAnnot->
SetData().SetFtable().push_back(feat);
1807 new_protein->
Assign(*prot_entry);
1853 cds->
SetProduct().SetWhole().Assign(*product_id);
1883 new_protein->
Assign(*prot_entry);
1895 cds->
SetProduct().SetWhole().Assign(*product_id);
1921 if (
rna.IsSetExt() &&
1922 rna.GetExt().IsTRNA() &&
1923 rna.GetExt().GetTRNA().IsSetAnticodon()) {
1924 rna.SetExt().SetTRNA().SetAnticodon().SetId(*bestId);
1931 if ((*it)->IsSetLoc()) {
1932 (*it)->SetLoc().SetId(*bestId);
1942 switch ((*desc_it)->Which()) {
1966 if (entry->
IsSeq()) {
1978 CBioseq_set::TSeq_set::iterator it = seqset.begin();
1979 while (it != seqset.end()) {
2016 if (!protein || protein->
IsSet() || protein->
GetSeq().
IsNa() || !newId) {
2027 (*prot_feat)->SetLocation().SetId(*newId);
2057 if (changedORadded_citsub &&
2066 if (changedORadded_citsub) {
2086 if ((*e_it)->IsSeq()) {
2087 for (
auto&& it : (*e_it)->GetSeq().GetId()) {
2094 for (
auto&& it :
m_NewEntry->GetSeq().GetId()) {
2118 return "Reverse complemented " + best_seqid;
2139 out <<
"Features from " << updseq_name;
2140 out <<
" were not imported as they were outside the " << align_label <<
" alignment range:\n";
User-defined methods of the data storage class.
User-defined methods of the data storage class.
ENa_strand Reverse(ENa_strand s)
@ eExtreme_Positional
numerical value
@ eExtreme_Biological
5' and 3'
bool SameOrientation(ENa_strand a, ENa_strand b)
User-defined methods of the data storage class.
User-defined methods of the data storage class.
CRef< objects::CSeq_id > GetNewProtId(objects::CBioseq_Handle bsh, int &offset, string &id_label, bool general_only)
TSeqPos GetLength(void) const
static CRef< objects::CSeqdesc > s_GetCitSubForUpdatedSequence(const objects::CBioseq_Handle &bsh, string &message, CConstRef< objects::CSeqdesc > &changedSeqdesc, objects::CSeq_entry_Handle &seh)
Generates/Creates a Cit-sub publication that will be added to the sequence.
static const char * sm_ChangeExistingCitSub
void AddCommand(IEditCommand &command)
void AddInterval(const CSeq_interval &ival)
for convenience
@RNA_ref.hpp User-defined methods of the data storage class.
ESubtype GetSubtype(void) const
static CTempString SubtypeValueToName(ESubtype eSubtype)
Turns a ESubtype into its string value which is NOT necessarily related to the identifier of the enum...
Sequence update exception class.
TSeqPos GetSeqStop(TDim row) const
TDim CheckNumRows(void) const
Validatiors.
const CSeq_id & GetSeq_id(TDim row) const
Get seq-id (the first one if segments have different ids).
TSeqPos GetSeqStart(TDim row) const
ENa_strand GetSeqStrand(TDim row) const
Get strand (the first one if segments have different strands).
bool IsFtable(void) const
void SetDescr(CSeq_descr &value)
namespace ncbi::objects::
bool IsPartialStop(ESeqLocExtremes ext) const
TSeqPos GetStart(ESeqLocExtremes ext) const
bool IsPartialStart(ESeqLocExtremes ext) const
TSeqPos GetStop(ESeqLocExtremes ext) const
void SetPartialStart(bool val, ESeqLocExtremes ext)
void SetPartialStop(bool val, ESeqLocExtremes ext)
Seq-loc iterator class – iterates all intervals from a seq-loc in the correct order.
Seq-loc iterator class – iterates all intervals from a seq-loc in the correct order.
void AddSeqLoc(const CSeq_loc &other)
static TSeqPos Pack(CSeq_data *in_seq, TSeqPos uLength=ncbi::numeric_limits< TSeqPos >::max())
static void s_Shift_tRNAAntiCodon(CRef< objects::CSeq_feat > feat, const TSeqPos &offset, const objects::CSeq_id *targetId=NULL)
void Patch(bool create_general_only)
void x_RetranslateOldCDSProduct(CRef< objects::CSeq_feat > cds, objects::CSeq_entry_EditHandle &eh, objects::CBioseq_Handle &newBsh, bool create_general_only)
static void s_Shift_CDSCodeBreaks(CRef< objects::CSeq_feat > feat, const TSeqPos &offset, const objects::CSeq_id *targetId=NULL)
static CRef< objects::CSeq_feat > s_OffsetFeature(const objects::CSeq_feat &feat, const TSeqPos offset, const objects::CSeq_id *newId=NULL)
Offsets the location of the feature.
bool IsAlignmentOK() const
SUpdateSeqParams m_Params
void ExtendOneEndOfSequence(bool create_general_only)
objects::CBioseq_Handle m_OldBsh
CIRef< IEditCommand > x_SwapOldWithNewSeq()
Creates command that swaps the old sequence with the new one.
static CRef< objects::CSeq_inst > s_ExtendOneEndOfSequence(const objects::CBioseq_Handle &bsh, const string &extension, SUpdateSeqParams::ESequenceUpdateType update_type)
Extends the 5' or 3' end of a NA sequence (no alignment is necessary).
CConstRef< objects::CSeq_id > m_NewId
Temporary seq-id of the new seq-entry.
void x_FixIDInNewEntry(CRef< objects::CSeq_entry > entry)
CRef< objects::CSeq_feat > x_MappedFeature_ChangeId(const objects::CSeq_feat_Handle &orig_fh)
Changes only the location ID of the feature.
void x_AdjustProteinFeature(CRef< objects::CSeq_entry > protein, CRef< objects::CSeq_id > newId=CRef< objects::CSeq_id >())
void x_ImportCDSProduct(CRef< objects::CSeq_feat > cds, objects::CSeq_entry_EditHandle &eh, objects::CBioseq_Handle &newBsh, bool create_general_only)
static CRef< objects::CSeq_loc > s_OffsetLocation(const objects::CSeq_loc &sourceLoc, const TSeqPos &offset, const objects::CSeq_id *targetId=NULL)
CConstRef< objects::CSeq_align > m_Align
vector< string > m_NotImportedFeats
List of features that were not imported as they were outside the alignment range.
void ShowCitSubMessage(void) const
void x_PrintNewEntryIds()
vector< CConstRef< objects::CSeq_align > > x_FormNewAlignment(const objects::CBioseq_Handle &subject)
Generates alignment between subject_bsh and the new sequence (query)
bool CheckParameters() const
CRef< objects::CSeq_inst > x_UpdateSeqInst(const string &upd_str)
CRef< objects::CSeq_inst > x_ReplaceSequence()
bool IsUpdateSequenceRaw() const
bool x_ShouldRemoveFeature(const objects::CSeq_feat_Handle &fh)
CRef< objects::CSeq_annot > x_GetSeqAnnot_WithoutCDS(bool &has_cds)
TFeatList m_ImportUpdFeats
CRef< objects::CSeq_entry > m_NewEntry
The new seq-entry.
void x_RemoveDescriptorsFromImportedProducts(CRef< objects::CSeq_entry > protein)
Removes RefGeneTracking user-object and create-date descriptors from imported cds products.
void x_MakeNewEntry(const objects::CSeq_inst &newInst)
Creates the new seq-entry. It is not added to the scope, yet.
void x_RetranslateImportedCDSProduct(CRef< objects::CSeq_feat > cds, objects::CSeq_entry_EditHandle &eh, objects::CBioseq_Handle &newBsh, bool create_general_only)
void x_MapOldAndImportedFeatsThroughNewAlign()
void x_AddCitSubToUpdatedSequence()
Attaches a cit-sub to the New sequence.
static string s_GetValidExtension(const string &extension)
void SetUpdateSeqParams(const SUpdateSeqParams ¶ms)
bool IsOldSequenceOK() const
const objects::CBioseq_Handle & m_UpdBsh
void x_UpdateProteinID(CRef< objects::CSeq_entry > protein, CRef< objects::CSeq_id > newId)
void x_ChangeIDInFeature(objects::CSeq_feat_Handle fh, const objects::CSeq_align &align, objects::CSeq_align::TDim row)
Replaces the location ID in the feature to match the alignment ID corresponding to the given row.
TSeqPos x_GetNewSeqLength()
void x_FixID_AttachFeatures(bool create_general_only)
CRef< objects::CSeq_inst > x_ExtendOneEnd()
objects::CSeq_entry_Handle x_GetOldBseq_EntryHandle(void)
string GetRevCompReport() const
CRef< objects::CSeq_feat > x_FuseFeatures(const objects::CSeq_feat &feat1, const objects::CSeq_feat &feat2)
Merges duplicate features.
void x_RemoveNewIDInFeature(CRef< objects::CSeq_feat > feat)
CSequenceUpdater(const CUpdateSeq_Input &updseq_in, const SUpdateSeqParams ¶ms)
void x_HandleDuplicateFeatures()
Decides which duplicate features will end up on the new sequence.
static CRef< objects::CSeq_inst > s_UpdateSeqInst(const objects::CBioseq_Handle &bsh, const string &upd_str)
void NoChange(bool create_general_only)
void Replace(bool create_general_only)
list< CRef< objects::CSeq_feat > > TFeatList
bool x_ShouldImportFeature(const objects::CSeq_feat_Handle &fh)
Determines whether the feature from update sequence should be imported to the new one.
void x_FuseProtFeatsForCDS(const objects::CSeq_feat &fusedFeat, const objects::CSeq_feat &feat_old)
Merges protein sequence features for duplicate coding regions.
void GetNotImportedFeatsReport(CNcbiOstream &out) const
TFeatList m_MappedOldFeats
List of features, originally belonging to the Old Sequence and update sequence, respectively.
CRef< CCmdComposite > Update(bool create_general_only)
Main function responsible to update the old sequence with the update sequence.
void x_ReplaceIdInOldFeatures()
void x_AdjustOldCDSProduct(CRef< objects::CSeq_feat > cds, objects::CSeq_entry_EditHandle &eh)
CRef< objects::CSeq_feat > x_MappedFeature_ThroughAlign(const objects::CSeq_feat_Handle &orig_fh, const objects::CSeq_align &align)
Maps feature's location through the alignment.
void x_PrepareNewEntry(CRef< objects::CSeq_entry > entry, const objects::CSeq_inst &newInst)
void x_SetOldIDInFeatures()
CConstRef< objects::CSeq_align > x_GetNewAlign_Replace(const objects::CBioseq_Handle &bsh)
void x_AttachFeaturesToNewSeq(bool create_general_only)
Removes newId in features and stores them in two seq-annots: one that will be attached to the sequenc...
static objects::CSeq_align::TDim FindRowInAlignment(const objects::CBioseq_Handle &bsh, const objects::CSeq_align &align)
CRef< objects::CSeq_inst > x_PatchSequence()
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
Stores parameters regarding the type of sequence update, on how to handle existing features and on ho...
@ eFeatUpdateAllExceptDups
@ eFeatUpdateAllReplaceDups
@ eFeatUpdateAllMergeDups
EFeatUpdateType m_FeatImportOption
ESequenceUpdateType m_SeqUpdateOption
TProtUpdFlags m_UpdateProteins
objects::CSeqFeatData::ESubtype m_FeatImportType
Defines the imported feature subtype.
bool m_AddCitSub
flag to attach a citation with the current date (false)
EFeatRemoveType m_FeatRemoveOption
bool m_ImportFeatures
Flag to indicate that features from the update sequence will be imported.
bool m_KeepProteinId
flag to update protein IDs, default is to update (false) - relevant only to imported protein IDs
@ eSeqUpdateReplace
do not change the old sequence
@ eSeqUpdateExtend3
extend the 5' end of old sequence with the update
@ eSeqUpdatePatch
replace old sequence with update sequence
@ eSeqUpdateExtend5
patch old sequence with update in the aligned region
static vector< CConstRef< objects::CSeq_align > > RunBlast2Seq(const objects::CBioseq_Handle &subject, const objects::CBioseq_Handle &query, bool accept_atleast_one, ICanceled *canceled=nullptr)
void SetMolinfoForProtein(CRef< objects::CSeq_entry > protein, bool partial5, bool partial3)
CRef< objects::CSeq_entry > CreateTranslatedProteinSequence(CRef< objects::CSeq_feat > cds, objects::CBioseq_Handle nuc_h, bool create_general_only, int *offset=nullptr)
std::ofstream out("events_result.xml")
main entry point for tests
unsigned int TSeqPos
Type for sequence locations and lengths.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
virtual const char * what(void) const noexcept
Standard report (includes full backlog).
void Info(CExceptionArgs_Base &args)
EDialogReturnValue NcbiInfoBox(const string &message, const string &title="Info")
specialized Message Box function for reporting general information messages
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
#define MSerial_AsnText
I/O stream manipulators –.
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Optimized implementation of CSerialObject::Assign, which is not so efficient.
void GetLabel(string *label, ELabelType type=eDefault, TLabelFlags flags=fLabel_Default) const
Append a label for this Seq-id to the supplied string.
CConstRef< CSeq_id > GetSeqId(void) const
static int BestRank(const CRef< CSeq_id > &id)
CSeq_id::E_Choice Which(void) const
@ eContent
Untagged human-readable accession or the like.
CRef< CSeq_loc > MakeSeq_loc(EMakeType make_type=eMake_CompactType) const
return constructed CSeq_loc with all changes
void SetFrom(TSeqPos from)
Set the range from position.
void SetTo(TSeqPos to)
Set the range to position.
bool IsPartialStart(ESeqLocExtremes ext) const
check start or stop of location for e_Lim fuzz
ENa_strand GetStrand(void) const
Get the location's strand.
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Override Assign() to incorporate cache invalidation.
void SetId(CSeq_id &id)
set the 'id' field in all parts of this location
TSeqPos GetStart(ESeqLocExtremes ext) const
Return start and stop positions of the seq-loc.
void SetSeq_id(const CSeq_id &id)
Set seq_id of the current location.
int Compare(const CSeq_loc &loc) const
bool IsSetStrand(EIsSetStrand flag=eIsSetStrand_Any) const
Check if strand is set for any/all part(s) of the seq-loc depending on the flag.
TRange GetRange(void) const
Get the range.
void GetLabel(string *label) const
Appends a label suitable for display (e.g., error messages) label must point to an existing string ob...
bool IsPartialStop(ESeqLocExtremes ext) const
TSeqPos GetStop(ESeqLocExtremes ext) const
const CSeq_id & GetId(const CSeq_loc &loc, CScope *scope)
If all CSeq_ids embedded in CSeq_loc refer to the same CBioseq, returns the first CSeq_id found,...
sequence::ECompare Compare(const CSeq_loc &loc1, const CSeq_loc &loc2, CScope *scope)
Returns the sequence::ECompare containment relationship between CSeq_locs.
@ fCompareOverlapping
Check if seq-locs are overlapping.
@ eAbutting
Abutting seq-locs.
@ eNoOverlap
CSeq_locs do not overlap or abut.
@ eGetId_Best
return the "best" gi (uses FindBestScore(), with CSeq_id::CalculateScore() as the score function
void RemoveFromHistory(const CTSE_Handle &tse, EActionIfLocked action=eKeepIfLocked)
Remove single TSE from the scope's history.
static CRef< CObjectManager > GetInstance(void)
Return the existing object manager or create one.
CSeq_entry_Handle AddTopLevelSeqEntry(CSeq_entry &top_entry, TPriority pri=kPriority_Default, EExist action=eExist_Default)
Add seq_entry, default priority is higher than for defaults or loaders Add object to the score with p...
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
void AddDefaults(TPriority pri=kPriority_Default)
Add default data loaders from object manager.
virtual CSeq_id_Handle GetLocationId(void) const
CConstRef< CBioseq > GetCompleteBioseq(void) const
Get the complete bioseq.
TClass GetClass(void) const
CRef< CSeqdesc > RemoveSeqdesc(const CSeqdesc &v) const
void SetDescr(TDescr &v) const
CBioseq_set_EditHandle GetParentBioseq_set(void) const
Get parent bioseq-set edit handle.
void Remove(void) const
Remove current annot.
virtual CConstRef< CSeq_feat > GetSeq_feat(void) const
TSeqPos GetBioseqLength(void) const
void Remove(void) const
Remove this Seq-entry from parent, or scope if it's top level Seq-entry.
CSeq_entry_Handle GetSeq_entry_Handle(void) const
Get parent Seq-entry handle.
CSeq_annot_EditHandle AttachAnnot(CSeq_annot &annot) const
Attach an annotation.
TSet ConvertSeqToSet(TClass set_class=CBioseq_set::eClass_not_set) const
Convert the entry from Bioseq to Bioseq-set.
CSeq_feat_EditHandle AddFeat(const CSeq_feat &new_obj) const
virtual const CSeq_loc & GetLocation(void) const
CBioseq_Handle GetBioseqHandle(const CSeq_id &id) const
Get Bioseq handle from the TSE of this Seq-entry.
CSeq_annot_EditHandle AttachAnnot(CSeq_annot &annot) const
Attach an annotation.
CSeq_entry_EditHandle GetEditHandle(void) const
Get 'edit' version of handle.
CSeq_entry_Handle GetTopLevelEntry(void) const
Get top level Seq-entry handle.
CBioseq_EditHandle GetEditHandle(void) const
Get 'edit' version of handle.
CSeq_entry_Handle GetParentEntry(void) const
Return a handle for the parent seq-entry of the bioseq.
bool IsSetClass(void) const
CConstRef< CSeq_entry > GetCompleteSeq_entry(void) const
Complete and get const reference to the seq-entry.
CScope & GetScope(void) const
Get scope this handle belongs to.
TInst_Repr GetInst_Repr(void) const
CScope & GetScope(void) const
Get scope this handle belongs to.
CConstRef< CSeq_feat > GetOriginalSeq_feat(void) const
CSeq_entry_EditHandle AttachEntry(CSeq_entry &entry, int index=-1) const
Attach an existing seq-entry.
void Replace(const CSeq_feat &new_feat) const
Replace the feature with new Seq-feat object.
bool AddSeqdesc(CSeqdesc &v) const
bool IsSynonym(const CSeq_id &id) const
Check if this id can be used to obtain this bioseq handle.
CSeqVector GetSeqVector(EVectorCoding coding, ENa_strand strand=eNa_strand_plus) const
Get sequence: Iupacna or Iupacaa if use_iupac_coding is true.
const TInst & GetInst(void) const
@ eCoding_Iupac
Set coding to printable coding (Iupacna or Iupacaa)
SAnnotSelector & SetLimitTSE(const CTSE_Handle &limit)
Limit annotations to those from the TSE only.
void GetSeqData(TSeqPos start, TSeqPos stop, string &buffer) const
Fill the buffer string with the sequence data for the interval [start, stop).
void SetCoding(TCoding coding)
CConstRef< C > ConstRef(const C *object)
Template function for conversion of const object pointer to CConstRef.
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.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
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 EqualCase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-sensitive equality of a substring with another string.
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 & ToLower(string &str)
Convert string to lower case – string& version.
C::value_type FindBestChoice(const C &container, F score_func)
Find the best choice (lowest score) for values in a container.
static const char label[]
TTo GetTo(void) const
Get the To member data.
TFrom GetFrom(void) const
Get the From 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.
bool IsLim(void) const
Check if variant Lim is selected.
TLim GetLim(void) const
Get the variant data.
bool IsSetClass(void) const
endeavor which designed this object Check if a value has been assigned to Class data member.
const TStr & GetStr(void) const
Get the variant data.
const TType & GetType(void) const
Get the Type member data.
TProcessed GetProcessed(void) const
Get the Processed member data.
bool IsSetProcessed(void) const
Check if a value has been assigned to Processed data member.
const TPub & GetPub(void) const
Get the variant data.
list< CRef< CPub > > TPub
bool IsPub(void) const
Check if variant Pub is selected.
TTRNA & SetTRNA(void)
Select the variant.
const TAnticodon & GetAnticodon(void) const
Get the Anticodon member data.
bool IsTRNA(void) const
Check if variant TRNA is selected.
bool IsSetAnticodon(void) const
location of anticodon Check if a value has been assigned to Anticodon data member.
void SetAnticodon(TAnticodon &value)
Assign a value to Anticodon data member.
void SetExt(TExt &value)
Assign a value to Ext data member.
bool IsSetExt(void) const
generic fields for ncRNA, tmRNA, miscRNA Check if a value has been assigned to Ext data member.
const TName & GetName(void) const
Get the variant data.
const TExt & GetExt(void) const
Get the Ext member data.
const TTRNA & GetTRNA(void) const
Get the variant data.
bool IsName(void) const
Check if variant Name is selected.
void SetSegs(TSegs &value)
Assign a value to Segs data member.
TIds & SetIds(void)
Assign a value to Ids data member.
void ResetPartial(void)
Reset Partial data member.
bool IsSetData(void) const
the specific data Check if a value has been assigned to Data data member.
E_Choice Which(void) const
Which variant is currently selected.
bool IsProt(void) const
Check if variant Prot is selected.
void SetLocation(TLocation &value)
Assign a value to Location data member.
bool IsCdregion(void) const
Check if variant Cdregion is selected.
const TRegion & GetRegion(void) const
Get the variant data.
const TCit & GetCit(void) const
Get the Cit member data.
void SetCit(TCit &value)
Assign a value to Cit data member.
void SetPartial(TPartial value)
Assign a value to Partial data member.
void SetProduct(TProduct &value)
Assign a value to Product data member.
const TLocation & GetLocation(void) const
Get the Location member data.
list< CRef< CCode_break > > TCode_break
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.
TCode_break & SetCode_break(void)
Assign a value to Code_break data member.
const TProduct & GetProduct(void) const
Get the Product member data.
bool IsSetCit(void) const
citations for this feature Check if a value has been assigned to Cit data member.
const TGene & GetGene(void) const
Get the variant data.
const TProt & GetProt(void) const
Get the variant data.
void ResetLocation(void)
Reset Location data member.
const TRna & GetRna(void) const
Get the variant data.
bool IsSetProduct(void) const
product of process Check if a value has been assigned to Product data member.
bool IsSetCode_break(void) const
individual exceptions Check if a value has been assigned to Code_break data member.
@ e_Region
named region (globin locus)
void SetTo(TTo value)
Assign a value to To data member.
ENa_strand
strand of nucleic acid
const Tdata & Get(void) const
Get the member data.
const TId & GetId(void) const
Get the Id member data.
const TPnt & GetPnt(void) const
Get the variant data.
TPoint GetPoint(void) const
Get the Point member data.
void SetId(TId &value)
Assign a value to Id data member.
TFrom GetFrom(void) const
Get the From member data.
bool IsSetFuzz(void) const
Check if a value has been assigned to Fuzz data member.
const TFuzz & GetFuzz(void) const
Get the Fuzz member data.
E_Choice Which(void) const
Which variant is currently selected.
E_Choice Which(void) const
Which variant is currently selected.
const TId & GetId(void) const
Get the Id member data.
void SetFrom(TFrom value)
Assign a value to From data member.
TStrand GetStrand(void) const
Get the Strand member data.
const Tdata & Get(void) const
Get the member data.
bool IsSetStrand(void) const
Check if a value has been assigned to Strand data member.
bool IsSetStrand(void) const
Check if a value has been assigned to Strand data member.
TStrand GetStrand(void) const
Get the Strand member data.
TTo GetTo(void) const
Get the To member data.
const TInt & GetInt(void) const
Get the variant data.
bool IsNull(void) const
Check if variant Null is selected.
void SetStrand(TStrand value)
Assign a value to Strand data member.
const TMix & GetMix(void) const
Get the variant data.
const TPacked_int & GetPacked_int(void) const
Get the variant data.
const TSeq & GetSeq(void) const
Get the variant data.
TSet & SetSet(void)
Select the variant.
bool IsSeq(void) const
Check if variant Seq is selected.
void ResetAnnot(void)
Reset Annot data member.
bool IsSet(void) const
Check if variant Set is selected.
list< CRef< CSeq_entry > > TSeq_set
TSeq & SetSeq(void)
Select the variant.
TSeq_set & SetSeq_set(void)
Assign a value to Seq_set data member.
@ eClass_nuc_prot
nuc acid and coded proteins
void SetData(TData &value)
Assign a value to Data data member.
list< CRef< CSeqdesc > > Tdata
TId & SetId(void)
Assign a value to Id data member.
void ResetId(void)
Reset Id data member.
void ResetAnnot(void)
Reset Annot data member.
list< CRef< CSeq_id > > TId
void SetInst(TInst &value)
Assign a value to Inst data member.
void SetRepr(TRepr value)
Assign a value to Repr data member.
void SetLength(TLength value)
Assign a value to Length data member.
void ResetInst(void)
Reset Inst data member.
void SetSeq_data(TSeq_data &value)
Assign a value to Seq_data data member.
void ResetExt(void)
Reset Ext data member.
@ eRepr_delta
sequence made by changes (delta) to others
@ eRepr_raw
continuous sequence
@ e_Iupacna
IUPAC 1 letter nuc acid code.
@ e_User
user defined object
@ e_Create_date
date entry first created/released
unsigned int
A callback function used to compare two keys in a database.
const CharType(& source)[N]
Useful/utility classes and methods.
void copy(Njn::Matrix< S > *matrix_, const Njn::Matrix< T > &matrix0_)
Utility macros and typedefs for exploring NCBI objects from pub.asn.
Utility macros and typedefs for exploring NCBI objects from seq.asn.
#define EDIT_EACH_FEATURE_ON_ANNOT
#define EDIT_EACH_SEQDESC_ON_SEQDESCR(Itr, Var)
#define EDIT_EACH_SEQANNOT_ON_BIOSEQ(Itr, Var)
#define ERASE_SEQDESC_ON_SEQDESCR(Itr, Var)
ERASE_SEQDESC_ON_SEQDESCR.
Utility macros and typedefs for exploring NCBI objects from seqset.asn.
#define FOR_EACH_SEQENTRY_ON_SEQSET(Itr, Var)
FOR_EACH_SEQENTRY_ON_SEQSET EDIT_EACH_SEQENTRY_ON_SEQSET.
@ eExistingText_append_semi
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...
static const char * kNewLocalID
#define FUSE_STRINGFIELDS(Var1, Var2, Field)
#define FUSE_LISTFIELDS(Var1, Var2, Type, Field)
#define FUSE_VECTORFIELDS(Var1, Var2, Type, Field)
#define FUSE_BOOLEANFIELDS(Var1, Var2, Field)