NCBI C++ ToolKit
Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
CSequenceUpdater Class Reference

Search Toolkit Book for CSequenceUpdater

Class responsible for executing the sequence update for one old-update sequence pair. More...

#include <gui/packages/pkg_sequence_edit/update_seq.hpp>

+ Collaboration diagram for CSequenceUpdater:

Public Member Functions

 CSequenceUpdater (const CUpdateSeq_Input &updseq_in, const SUpdateSeqParams &params)
 
 ~CSequenceUpdater ()
 
void SetUpdateSeqParams (const SUpdateSeqParams &params)
 
CRef< CCmdCompositeUpdate (bool create_general_only)
 Main function responsible to update the old sequence with the update sequence. More...
 
bool IsOldSequenceOK () const
 
bool IsUpdateSequenceRaw () const
 
bool IsAlignmentOK () const
 
bool CheckParameters () const
 
const stringGetCitSubMessage () const
 
void ShowCitSubMessage (void) const
 
bool IsReverseComplemented () const
 
string GetRevCompReport () const
 
void GetNotImportedFeatsReport (CNcbiOstream &out) const
 

Static Public Member Functions

static objects::CSeq_align::TDim FindRowInAlignment (const objects::CBioseq_Handle &bsh, const objects::CSeq_align &align)
 
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). More...
 
static CRef< objects::CSeq_inst > s_UpdateSeqInst (const objects::CBioseq_Handle &bsh, const string &upd_str)
 
static string s_GetValidExtension (const string &extension)
 
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. More...
 
static void s_Shift_CDSCodeBreaks (CRef< objects::CSeq_feat > feat, const TSeqPos &offset, const objects::CSeq_id *targetId=NULL)
 
static void s_Shift_tRNAAntiCodon (CRef< objects::CSeq_feat > feat, const TSeqPos &offset, const objects::CSeq_id *targetId=NULL)
 
static CRef< objects::CSeq_loc > s_OffsetLocation (const objects::CSeq_loc &sourceLoc, const TSeqPos &offset, const objects::CSeq_id *targetId=NULL)
 

Private Types

typedef list< CRef< objects::CSeq_feat > > TFeatList
 

Private Member Functions

void NoChange (bool create_general_only)
 
void Replace (bool create_general_only)
 
void Patch (bool create_general_only)
 
void ExtendOneEndOfSequence (bool create_general_only)
 
CRef< objects::CSeq_inst > x_ReplaceSequence ()
 
CRef< objects::CSeq_inst > x_PatchSequence ()
 
CRef< objects::CSeq_inst > x_ExtendOneEnd ()
 
CRef< objects::CSeq_inst > x_UpdateSeqInst (const string &upd_str)
 
void x_MakeNewEntry (const objects::CSeq_inst &newInst)
 Creates the new seq-entry. It is not added to the scope, yet. More...
 
void x_PrepareNewEntry (CRef< objects::CSeq_entry > entry, const objects::CSeq_inst &newInst)
 
objects::CSeq_entry_Handle x_GetOldBseq_EntryHandle (void)
 
CIRef< IEditCommandx_SwapOldWithNewSeq ()
 Creates command that swaps the old sequence with the new one. More...
 
bool x_ShouldRemoveFeature (const objects::CSeq_feat_Handle &fh)
 
bool x_ShouldImportFeature (const objects::CSeq_feat_Handle &fh)
 Determines whether the feature from update sequence should be imported to the new one. More...
 
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. More...
 
CRef< objects::CSeq_feat > x_MappedFeature_ChangeId (const objects::CSeq_feat_Handle &orig_fh)
 Changes only the location ID of the feature. More...
 
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. More...
 
void x_ReplaceIdInOldFeatures ()
 
void x_MapOldAndImportedFeatsThroughNewAlign ()
 
CConstRef< objects::CSeq_align > x_GetNewAlign_Replace (const objects::CBioseq_Handle &bsh)
 
vector< CConstRef< objects::CSeq_align > > x_FormNewAlignment (const objects::CBioseq_Handle &subject)
 Generates alignment between subject_bsh and the new sequence (query) More...
 
void x_HandleDuplicateFeatures ()
 Decides which duplicate features will end up on the new sequence. More...
 
CRef< objects::CSeq_feat > x_FuseFeatures (const objects::CSeq_feat &feat1, const objects::CSeq_feat &feat2)
 Merges duplicate features. More...
 
void x_FuseProtFeatsForCDS (const objects::CSeq_feat &fusedFeat, const objects::CSeq_feat &feat_old)
 Merges protein sequence features for duplicate coding regions. More...
 
void x_FixID_AttachFeatures (bool create_general_only)
 
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 sequence and another one that will be attached to the set. More...
 
void x_FixIDInNewEntry (CRef< objects::CSeq_entry > entry)
 
void x_RemoveNewIDInFeature (CRef< objects::CSeq_feat > feat)
 
void x_UpdateProteinID (CRef< objects::CSeq_entry > protein, CRef< objects::CSeq_id > newId)
 
void x_AdjustProteinFeature (CRef< objects::CSeq_entry > protein, CRef< objects::CSeq_id > newId=CRef< objects::CSeq_id >())
 
void x_SetOldIDInFeatures ()
 
CRef< objects::CSeq_annot > x_GetSeqAnnot_WithoutCDS (bool &has_cds)
 
void x_AdjustOldCDSProduct (CRef< objects::CSeq_feat > cds, objects::CSeq_entry_EditHandle &eh)
 
void x_ImportCDSProduct (CRef< objects::CSeq_feat > cds, objects::CSeq_entry_EditHandle &eh, objects::CBioseq_Handle &newBsh, 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)
 
void x_RetranslateImportedCDSProduct (CRef< objects::CSeq_feat > cds, objects::CSeq_entry_EditHandle &eh, objects::CBioseq_Handle &newBsh, bool create_general_only)
 
void x_RemoveDescriptorsFromImportedProducts (CRef< objects::CSeq_entry > protein)
 Removes RefGeneTracking user-object and create-date descriptors from imported cds products. More...
 
void x_AddCitSubToUpdatedSequence ()
 Attaches a cit-sub to the New sequence. More...
 
void x_PrintNewEntryIds ()
 
TSeqPos x_GetNewSeqLength ()
 
 CSequenceUpdater (const CSequenceUpdater &)
 
CSequenceUpdateroperator= (const CSequenceUpdater &)
 

Private Attributes

objects::CBioseq_Handle m_OldBsh
 
const objects::CBioseq_Handle & m_UpdBsh
 
CConstRef< objects::CSeq_align > m_Align
 
SUpdateSeqParams m_Params
 
CRef< objects::CSeq_entry > m_NewEntry
 The new seq-entry. More...
 
CConstRef< objects::CSeq_id > m_NewId
 Temporary seq-id of the new seq-entry. More...
 
TFeatList m_MappedOldFeats
 List of features, originally belonging to the Old Sequence and update sequence, respectively. More...
 
TFeatList m_ImportUpdFeats
 
string m_CitSubMessage
 
bool m_Reversed
 
vector< stringm_NotImportedFeats
 List of features that were not imported as they were outside the alignment range. More...
 

Detailed Description

Class responsible for executing the sequence update for one old-update sequence pair.

Definition at line 56 of file update_seq.hpp.

Member Typedef Documentation

◆ TFeatList

typedef list<CRef<objects::CSeq_feat> > CSequenceUpdater::TFeatList
private

Definition at line 208 of file update_seq.hpp.

Constructor & Destructor Documentation

◆ CSequenceUpdater() [1/2]

CSequenceUpdater::CSequenceUpdater ( const CUpdateSeq_Input updseq_in,
const SUpdateSeqParams params 
)

◆ ~CSequenceUpdater()

CSequenceUpdater::~CSequenceUpdater ( )

Definition at line 520 of file update_seq.cpp.

◆ CSequenceUpdater() [2/2]

CSequenceUpdater::CSequenceUpdater ( const CSequenceUpdater )
private

Member Function Documentation

◆ CheckParameters()

bool CSequenceUpdater::CheckParameters ( ) const

◆ ExtendOneEndOfSequence()

void CSequenceUpdater::ExtendOneEndOfSequence ( bool  create_general_only)
private

◆ FindRowInAlignment()

CSeq_align::TDim CSequenceUpdater::FindRowInAlignment ( const objects::CBioseq_Handle &  bsh,
const objects::CSeq_align &  align 
)
static

◆ GetCitSubMessage()

const string& CSequenceUpdater::GetCitSubMessage ( ) const
inline

◆ GetNotImportedFeatsReport()

void CSequenceUpdater::GetNotImportedFeatsReport ( CNcbiOstream out) const

◆ GetRevCompReport()

string CSequenceUpdater::GetRevCompReport ( ) const

◆ IsAlignmentOK()

bool CSequenceUpdater::IsAlignmentOK ( ) const

Definition at line 543 of file update_seq.cpp.

References m_Align.

Referenced by CSequenceUpdater().

◆ IsOldSequenceOK()

bool CSequenceUpdater::IsOldSequenceOK ( ) const

◆ IsReverseComplemented()

bool CSequenceUpdater::IsReverseComplemented ( ) const
inline

Definition at line 97 of file update_seq.hpp.

References m_Reversed.

Referenced by CUpdateMultiSeq_Dlg::x_UpdateSelected().

◆ IsUpdateSequenceRaw()

bool CSequenceUpdater::IsUpdateSequenceRaw ( ) const

Definition at line 538 of file update_seq.cpp.

References CSeq_inst_Base::eRepr_raw, and m_UpdBsh.

Referenced by BOOST_AUTO_TEST_CASE(), and CSequenceUpdater().

◆ NoChange()

void CSequenceUpdater::NoChange ( bool  create_general_only)
private

◆ operator=()

CSequenceUpdater& CSequenceUpdater::operator= ( const CSequenceUpdater )
private

◆ Patch()

void CSequenceUpdater::Patch ( bool  create_general_only)
private

◆ Replace()

void CSequenceUpdater::Replace ( bool  create_general_only)
private

◆ s_ExtendOneEndOfSequence()

CRef< CSeq_inst > CSequenceUpdater::s_ExtendOneEndOfSequence ( const objects::CBioseq_Handle &  bsh,
const string extension,
SUpdateSeqParams::ESequenceUpdateType  update_type 
)
static

◆ s_GetValidExtension()

string CSequenceUpdater::s_GetValidExtension ( const string extension)
static

Definition at line 934 of file update_seq.cpp.

References kEmptyStr, NPOS, and NStr::ToLower().

Referenced by BOOST_AUTO_TEST_CASE(), and s_ExtendOneEndOfSequence().

◆ s_OffsetFeature()

CRef< CSeq_feat > CSequenceUpdater::s_OffsetFeature ( const objects::CSeq_feat &  feat,
const TSeqPos  offset,
const objects::CSeq_id *  newId = NULL 
)
static

◆ s_OffsetLocation()

CRef< CSeq_loc > CSequenceUpdater::s_OffsetLocation ( const objects::CSeq_loc &  sourceLoc,
const TSeqPos offset,
const objects::CSeq_id *  targetId = NULL 
)
static

◆ s_Shift_CDSCodeBreaks()

void CSequenceUpdater::s_Shift_CDSCodeBreaks ( CRef< objects::CSeq_feat >  feat,
const TSeqPos offset,
const objects::CSeq_id *  targetId = NULL 
)
static

◆ s_Shift_tRNAAntiCodon()

void CSequenceUpdater::s_Shift_tRNAAntiCodon ( CRef< objects::CSeq_feat >  feat,
const TSeqPos offset,
const objects::CSeq_id *  targetId = NULL 
)
static

◆ s_UpdateSeqInst()

CRef< CSeq_inst > CSequenceUpdater::s_UpdateSeqInst ( const objects::CBioseq_Handle &  bsh,
const string upd_str 
)
static

◆ SetUpdateSeqParams()

void CSequenceUpdater::SetUpdateSeqParams ( const SUpdateSeqParams params)

Definition at line 524 of file update_seq.cpp.

References m_Params.

◆ ShowCitSubMessage()

void CSequenceUpdater::ShowCitSubMessage ( void  ) const

Definition at line 2101 of file update_seq.cpp.

References m_CitSubMessage, and NcbiInfoBox().

◆ Update()

CRef< CCmdComposite > CSequenceUpdater::Update ( bool  create_general_only)

◆ x_AddCitSubToUpdatedSequence()

void CSequenceUpdater::x_AddCitSubToUpdatedSequence ( )
private

◆ x_AdjustOldCDSProduct()

void CSequenceUpdater::x_AdjustOldCDSProduct ( CRef< objects::CSeq_feat >  cds,
objects::CSeq_entry_EditHandle &  eh 
)
private

◆ x_AdjustProteinFeature()

void CSequenceUpdater::x_AdjustProteinFeature ( CRef< objects::CSeq_entry >  protein,
CRef< objects::CSeq_id >  newId = CRef<objects::CSeq_id>() 
)
private

◆ x_AttachFeaturesToNewSeq()

void CSequenceUpdater::x_AttachFeaturesToNewSeq ( bool  create_general_only)
private

◆ x_ChangeIDInFeature()

void CSequenceUpdater::x_ChangeIDInFeature ( objects::CSeq_feat_Handle  fh,
const objects::CSeq_align &  align,
objects::CSeq_align::TDim  row 
)
private

◆ x_ExtendOneEnd()

CRef< CSeq_inst > CSequenceUpdater::x_ExtendOneEnd ( )
private

◆ x_FixID_AttachFeatures()

void CSequenceUpdater::x_FixID_AttachFeatures ( bool  create_general_only)
private

◆ x_FixIDInNewEntry()

void CSequenceUpdater::x_FixIDInNewEntry ( CRef< objects::CSeq_entry >  entry)
private

◆ x_FormNewAlignment()

vector< CConstRef< objects::CSeq_align > > CSequenceUpdater::x_FormNewAlignment ( const objects::CBioseq_Handle &  subject)
private

◆ x_FuseFeatures()

CRef< CSeq_feat > CSequenceUpdater::x_FuseFeatures ( const objects::CSeq_feat &  feat1,
const objects::CSeq_feat &  feat2 
)
private

◆ x_FuseProtFeatsForCDS()

void CSequenceUpdater::x_FuseProtFeatsForCDS ( const objects::CSeq_feat &  fusedFeat,
const objects::CSeq_feat &  feat_old 
)
private

◆ x_GetNewAlign_Replace()

CConstRef< CSeq_align > CSequenceUpdater::x_GetNewAlign_Replace ( const objects::CBioseq_Handle &  bsh)
private

◆ x_GetNewSeqLength()

TSeqPos CSequenceUpdater::x_GetNewSeqLength ( )
private

◆ x_GetOldBseq_EntryHandle()

CSeq_entry_Handle CSequenceUpdater::x_GetOldBseq_EntryHandle ( void  )
private

◆ x_GetSeqAnnot_WithoutCDS()

CRef< CSeq_annot > CSequenceUpdater::x_GetSeqAnnot_WithoutCDS ( bool has_cds)
private

◆ x_HandleDuplicateFeatures()

void CSequenceUpdater::x_HandleDuplicateFeatures ( )
private

◆ x_ImportCDSProduct()

void CSequenceUpdater::x_ImportCDSProduct ( CRef< objects::CSeq_feat >  cds,
objects::CSeq_entry_EditHandle &  eh,
objects::CBioseq_Handle &  newBsh,
bool  create_general_only 
)
private

◆ x_MakeNewEntry()

void CSequenceUpdater::x_MakeNewEntry ( const objects::CSeq_inst &  newInst)
private

Creates the new seq-entry. It is not added to the scope, yet.

Definition at line 1133 of file update_seq.cpp.

References CSeq_entry_Handle::GetCompleteSeq_entry(), m_NewEntry, CRef< C, Locker >::Reset(), x_GetOldBseq_EntryHandle(), and x_PrepareNewEntry().

Referenced by ExtendOneEndOfSequence(), NoChange(), Patch(), and Replace().

◆ x_MapOldAndImportedFeatsThroughNewAlign()

void CSequenceUpdater::x_MapOldAndImportedFeatsThroughNewAlign ( )
private

◆ x_MappedFeature_ChangeId()

CRef< CSeq_feat > CSequenceUpdater::x_MappedFeature_ChangeId ( const objects::CSeq_feat_Handle &  orig_fh)
private

◆ x_MappedFeature_ThroughAlign()

CRef< CSeq_feat > CSequenceUpdater::x_MappedFeature_ThroughAlign ( const objects::CSeq_feat_Handle &  orig_fh,
const objects::CSeq_align &  align 
)
private

◆ x_PatchSequence()

CRef< CSeq_inst > CSequenceUpdater::x_PatchSequence ( )
private

◆ x_PrepareNewEntry()

void CSequenceUpdater::x_PrepareNewEntry ( CRef< objects::CSeq_entry >  entry,
const objects::CSeq_inst &  newInst 
)
private

◆ x_PrintNewEntryIds()

void CSequenceUpdater::x_PrintNewEntryIds ( )
private

◆ x_RemoveDescriptorsFromImportedProducts()

void CSequenceUpdater::x_RemoveDescriptorsFromImportedProducts ( CRef< objects::CSeq_entry >  protein)
private

◆ x_RemoveNewIDInFeature()

void CSequenceUpdater::x_RemoveNewIDInFeature ( CRef< objects::CSeq_feat >  feat)
private

◆ x_ReplaceIdInOldFeatures()

void CSequenceUpdater::x_ReplaceIdInOldFeatures ( )
private

◆ x_ReplaceSequence()

CRef< CSeq_inst > CSequenceUpdater::x_ReplaceSequence ( )
private

◆ x_RetranslateImportedCDSProduct()

void CSequenceUpdater::x_RetranslateImportedCDSProduct ( CRef< objects::CSeq_feat >  cds,
objects::CSeq_entry_EditHandle &  eh,
objects::CBioseq_Handle &  newBsh,
bool  create_general_only 
)
private

◆ x_RetranslateOldCDSProduct()

void CSequenceUpdater::x_RetranslateOldCDSProduct ( CRef< objects::CSeq_feat >  cds,
objects::CSeq_entry_EditHandle &  eh,
objects::CBioseq_Handle &  newBsh,
bool  create_general_only 
)
private

◆ x_SetOldIDInFeatures()

void CSequenceUpdater::x_SetOldIDInFeatures ( )
private

◆ x_ShouldImportFeature()

bool CSequenceUpdater::x_ShouldImportFeature ( const objects::CSeq_feat_Handle &  fh)
private

◆ x_ShouldRemoveFeature()

bool CSequenceUpdater::x_ShouldRemoveFeature ( const objects::CSeq_feat_Handle &  fh)
private

◆ x_SwapOldWithNewSeq()

CIRef< IEditCommand > CSequenceUpdater::x_SwapOldWithNewSeq ( )
private

Creates command that swaps the old sequence with the new one.

Definition at line 2072 of file update_seq.cpp.

References cmd, m_NewEntry, and x_GetOldBseq_EntryHandle().

Referenced by Update().

◆ x_UpdateProteinID()

void CSequenceUpdater::x_UpdateProteinID ( CRef< objects::CSeq_entry >  protein,
CRef< objects::CSeq_id >  newId 
)
private

◆ x_UpdateSeqInst()

CRef< CSeq_inst > CSequenceUpdater::x_UpdateSeqInst ( const string upd_str)
private

Definition at line 983 of file update_seq.cpp.

References m_OldBsh, and s_UpdateSeqInst().

Referenced by x_ExtendOneEnd(), and x_PatchSequence().

Member Data Documentation

◆ m_Align

CConstRef<objects::CSeq_align> CSequenceUpdater::m_Align
private

◆ m_CitSubMessage

string CSequenceUpdater::m_CitSubMessage
private

◆ m_ImportUpdFeats

TFeatList CSequenceUpdater::m_ImportUpdFeats
private

◆ m_MappedOldFeats

TFeatList CSequenceUpdater::m_MappedOldFeats
private

List of features, originally belonging to the Old Sequence and update sequence, respectively.

Their locations have been adjusted (including new SeqId), ready to be attached to the New Sequence Lists are ready to be searched for duplicates

Definition at line 212 of file update_seq.hpp.

Referenced by ExtendOneEndOfSequence(), Replace(), x_AttachFeaturesToNewSeq(), x_GetSeqAnnot_WithoutCDS(), x_HandleDuplicateFeatures(), x_MapOldAndImportedFeatsThroughNewAlign(), x_ReplaceIdInOldFeatures(), and x_SetOldIDInFeatures().

◆ m_NewEntry

CRef<objects::CSeq_entry> CSequenceUpdater::m_NewEntry
private

◆ m_NewId

CConstRef<objects::CSeq_id> CSequenceUpdater::m_NewId
private

◆ m_NotImportedFeats

vector<string> CSequenceUpdater::m_NotImportedFeats
private

List of features that were not imported as they were outside the alignment range.

Definition at line 219 of file update_seq.hpp.

Referenced by GetNotImportedFeatsReport(), and x_ShouldImportFeature().

◆ m_OldBsh

objects::CBioseq_Handle CSequenceUpdater::m_OldBsh
private

◆ m_Params

SUpdateSeqParams CSequenceUpdater::m_Params
private

◆ m_Reversed

bool CSequenceUpdater::m_Reversed
private

Definition at line 217 of file update_seq.hpp.

Referenced by GetRevCompReport(), IsReverseComplemented(), and Update().

◆ m_UpdBsh

const objects::CBioseq_Handle& CSequenceUpdater::m_UpdBsh
private

The documentation for this class was generated from the following files:
Modified on Fri Sep 20 14:58:29 2024 by modify_doxy.py rev. 669887