NCBI C++ ToolKit
Classes | Typedefs | Functions
seq_entry_edit.cpp File Reference
#include <ncbi_pch.hpp>
#include <corelib/ncbistd.hpp>
#include <corelib/ncbi_autoinit.hpp>
#include <objects/misc/sequence_macros.hpp>
#include <objects/pub/Pub.hpp>
#include <objects/pub/Pub_equiv.hpp>
#include <objects/seq/Bioseq.hpp>
#include <objects/seq/Pubdesc.hpp>
#include <objects/seq/Seq_descr.hpp>
#include <objects/seq/Seq_ext.hpp>
#include <objects/seq/Seg_ext.hpp>
#include <objects/seq/seqport_util.hpp>
#include <objects/seqalign/Dense_diag.hpp>
#include <objects/seqalign/Dense_seg.hpp>
#include <objmgr/align_ci.hpp>
#include <objmgr/bioseq_handle.hpp>
#include <objmgr/bioseq_set_handle.hpp>
#include <objmgr/feat_ci.hpp>
#include <objmgr/scope.hpp>
#include <objmgr/seq_entry_ci.hpp>
#include <objmgr/seq_annot_ci.hpp>
#include <objmgr/seq_descr_ci.hpp>
#include <objmgr/seqdesc_ci.hpp>
#include <objmgr/util/seq_loc_util.hpp>
#include <objmgr/util/feature_edit.hpp>
#include <objmgr/graph_ci.hpp>
#include <objmgr/seq_vector.hpp>
#include <objmgr/util/sequence.hpp>
#include <util/sequtil/sequtil_convert.hpp>
#include <objtools/edit/edit_exception.hpp>
#include <objtools/edit/seq_entry_edit.hpp>
#include <objtools/edit/loc_edit.hpp>
#include <objmgr/util/autodef_options.hpp>
#include <set>
#include <sstream>
#include <map>
+ Include dependency graph for seq_entry_edit.cpp:

Go to the source code of this file.

Go to the SVN repository for this file.

Classes

struct  SSerialObjectLessThan< T >
 
struct  CSerialObjectSet< T >
 
class  CRangeCmp
 Helper functor to compare cuts during sorting. More...
 

Typedefs

typedef map< CSeq_entry_Handle, CSeq_entry_HandleTMapDescendentToInputEntry
 
typedef CMapWithOriginalOrderingIteration< CRef< CSeq_annot >, CSeq_entry_HandleTMapSeqAnnotToDest
 
typedef vector< CSeq_annot_HandleTVecOfSeqAnnotsToErase
 
typedef vector< CConstRef< CSeq_align > > TAlignVec
 
typedef CMapWithOriginalOrderingIteration< CSeq_entry_Handle, TAlignVecTMapEntryToAlignVec
 

Functions

CConstRef< CDelta_seqGetDeltaSeqForPosition (const unsigned pos, const CBioseq_Handle seq_hl, CScope *scope, unsigned &left_endpoint)
 
bool IsDeltaSeqGap (CConstRef< CDelta_seq > delta)
 
bool Does5primerAbutGap (const CSeq_feat &feat, CBioseq_Handle seq_hl)
 
bool Does3primerAbutGap (const CSeq_feat &feat, CBioseq_Handle seq_hl)
 
static void s_AddBioseqToPartsSet (CBioseq_set_EditHandle &parts, CBioseq_EditHandle &seq)
 
static void s_AddPartToSegmentedBioseq (const CBioseq_EditHandle &seg, const CBioseq_EditHandle &part)
 
static void s_AddBioseqToSegset (CBioseq_set_EditHandle &segset, CBioseq_EditHandle &part)
 
void AddSeqEntryToSeqEntry (const CSeq_entry_Handle &target, const CSeq_entry_Handle &insert)
 Attach one Seq-entry to another. More...
 
static void s_AddProtToNuc (const CBioseq_EditHandle &nuc, const CBioseq_EditHandle &prot)
 
static CSeq_ids_MakeUniqueLocalId (void)
 
static void s_AddBioseqToBioseq (const CBioseq_EditHandle &to, const CBioseq_EditHandle &add)
 
void AddBioseqToBioseq (const CBioseq_Handle &to, const CBioseq_Handle &add)
 Attach one Bioseq to another. More...
 
static void s_AddBioseqToNucProtSet (CBioseq_set_EditHandle &nuc_prot, CBioseq_EditHandle &seq)
 
void AddBioseqToBioseqSet (const CBioseq_set_Handle &set, const CBioseq_Handle &seq)
 Add a Bioseq to a Bioseq-set. More...
 
bool IsSeqDescInList (const CSeqdesc &desc, const CSeq_descr &set)
 
void AddSeqdescToSeqDescr (const CSeqdesc &desc, CSeq_descr &seq_descr)
 
void AddSeqdescToBioseq (const CSeqdesc &desc, CBioseq &seq)
 
void AddSeqdescToBioseqSet (const CSeqdesc &desc, CBioseq_set &set)
 
bool AddSeqdescToSeqEntryRecursively (CSeq_entry &entry, CSeqdesc &desc)
 
CRef< CSeq_entrySeqEntryFromSeqSubmit (const CSeq_submit &submit)
 Create a Seq-entry from a Seq-submit. More...
 
static bool s_IsSingletonSet (const CBioseq_set_Handle &bioseq_set)
 
static void s_PromoteSingletonSetsInSet (const CBioseq_set_Handle &bioseq_set_h)
 
static void s_MakeGroupsForUniqueValues (const CSeq_entry_Handle &target, const CScope::TBioseqHandles &bioseq_handles)
 
void SegregateSetsByBioseqList (const CSeq_entry_Handle &target, const CScope::TBioseqHandles &bioseq_handles)
 Split a Seq-entry, where the second part holds the given bioseqs. More...
 
static bool s_DivvyUpAlignments_ProcessAnnot_Dendiag (const CSeq_align_Handle &align, const TMapDescendentToInputEntry &mapDescendentToInputEntry, TMapEntryToAlignVec &mapEntryToAlignVec)
 
static bool s_DivvyUpAlignments_ProcessAnnot_Denseg (const CSeq_align_Handle &align, const TMapDescendentToInputEntry &mapDescendentToInputEntry, TMapEntryToAlignVec &mapEntryToAlignVec)
 
static void s_DivvyUpAlignments_ProcessAnnot (const CSeq_annot_Handle &annot_h, const TMapDescendentToInputEntry &mapDescendentToInputEntry, TMapSeqAnnotToDest &mapSeqAnnotToDest, TVecOfSeqAnnotsToErase &vecOfSeqAnnotToErase)
 
void DivvyUpAlignments (const TVecOfSeqEntryHandles &vecOfSeqEntryHandles)
 Call this if the alignments directly under these seq-entries are all jumbled up between each other. More...
 
void BioseqSetDescriptorPropagateUp (CBioseq_set_Handle set)
 Moves descriptors up from children of the given bioseq-set if each child has an identical copy of the descriptor. More...
 
void BioseqSetDescriptorPropagateDown (const CBioseq_set_Handle &bioseq_set_h, const vector< CSeqdesc::E_Choice > &choices_to_delete)
 Moves descriptors down to children of the given bioseq-set. More...
 
CSeq_id::E_Choice TypeFromLabel (const string &label)
 
string LabelFromType (CSeq_id::E_Choice choice)
 
string MakeOriginalLabelForId (const CSeq_id &id)
 
CRef< CUser_fieldMakeOriginalIdField (const CSeq_id &id)
 
void AddLocalIdUserObjects (CSeq_entry &entry)
 Creates a User-object descriptor on every sequence that has a local ID Contains the original local ID. More...
 
bool IsMatchingIdMissing (const CUser_field &field, const CBioseq::TId &ids)
 
bool HasRepairedIDs (const CUser_object &user, const CBioseq::TId &ids)
 
bool HasRepairedIDs (const CSeq_entry &entry)
 Detects whether colliding IDs were fixed by comparing sequence IDs to the contents of the OriginalID User-object descriptor. More...
 
void RemoveUserObjectType (CSeq_entry &entry, CUser_object::EObjectType type)
 Removes User-object descriptors of a certain type from the seq-entry. More...
 
void HandleCollidingIds (CSeq_entry &entry)
 
void s_AddLiteral (CSeq_inst &inst, const string &element)
 
void s_AddGap (CSeq_inst &inst, size_t n_len, bool is_unknown, bool is_assembly_gap=false, int gap_type=CSeq_gap::eType_unknown, int linkage=-1, int linkage_evidence=-1)
 
void ConvertRawToDeltaByNs (CSeq_inst &inst, size_t min_unknown, int max_unknown, size_t min_known, int max_known, bool is_assembly_gap, int gap_type, int linkage, int linkage_evidence)
 ConvertRawToDeltaByNs A function to convert a raw sequence to a delta sequence, using runs of Ns to determine the gap location. More...
 
TLocAdjustmentVector NormalizeUnknownLengthGaps (CSeq_inst &inst, TSeqPos unknown_length)
 NormalizeUnknownLengthGaps A function to adjust the length of unknown-length gaps to a specific length (100 by default). More...
 
void ConvertRawToDeltaByNs (CBioseq_Handle bsh, size_t min_unknown, int max_unknown, size_t min_known, int max_known, bool is_assembly_gap, int gap_type, int linkage, int linkage_evidence)
 
void SetLinkageType (CSeq_ext &ext, CSeq_gap::TType linkage_type)
 SetLinkageType A function to set the linkage_type for gaps in a delta sequence. More...
 
void SetLinkageTypeScaffold (CSeq_ext &ext, CLinkage_evidence::TType evidence_type)
 SetLinkageTypeScaffold A special case of SetLinkageType. More...
 
void SetLinkageTypeLinkedRepeat (CSeq_ext &ext, CLinkage_evidence::TType evidence_type)
 
void AddLinkageEvidence (CSeq_ext &ext, CLinkage_evidence::TType evidence_type)
 AddLinkageEvidence A function to add linkage evidence for gaps in a delta sequence. More...
 
void ResetLinkageEvidence (CSeq_ext &ext)
 ResetLinkageEvidence A function to clear linkage evidence for gaps in a delta sequence. More...
 
void s_BasicValidation (CBioseq_Handle bsh, const TCuts &cuts)
 
static TRange s_GetRetainedRange (const TCuts &sorted_merged_cuts, TSeqPos seqLength)
 
void TrimSequenceAndAnnotation (CBioseq_Handle bsh, const TCuts &cuts, EInternalTrimType internal_cut_conversion)
 Implementation detail: first trim all associated annotation, then trim sequence data. More...
 
static void s_MergeCuts (TCuts &sorted_cuts)
 Assumes sorted_cuts are sorted in Ascending order! More...
 
static void s_AdjustInternalCutLocations (TCuts &cuts, TSeqPos seq_length, EInternalTrimType internal_cut_conversion)
 Adjust any internal cuts to terminal cuts. More...
 
void GetSortedCuts (CBioseq_Handle bsh, const TCuts &cuts, TCuts &sorted_cuts, EInternalTrimType internal_cut_conversion)
 1) Adjust any internal cuts to terminal cuts according to option. More...
 
void UpdateSeqLength (CAutoInitRef< CDelta_ext > &pDeltaExt, CBioseq_Handle &complete_bsh, CSeqMap_CI &seqmap_ci, CSeq_inst_Base::TLength &new_length)
 Update sequence length. More...
 
void TrimSeqData (CBioseq_Handle bsh, CRef< CSeq_inst > inst, const TCuts &sorted_cuts)
 Trim sequence data. More...
 
static void s_GetTrimCoordinates (CBioseq_Handle bsh, const TCuts &sorted_cuts, TSeqPos &trim_start, TSeqPos &trim_stop)
 
static void s_SeqIntervalDelete (CRef< CSeq_interval > interval, TSeqPos cut_from, TSeqPos cut_to, bool &bCompleteCut, bool &bTrimmed)
 
static void s_SeqLocDelete (CRef< CSeq_loc > loc, TSeqPos from, TSeqPos to, bool &bCompleteCut, bool &bTrimmed)
 
static void s_UpdateSeqGraphLoc (CRef< CSeq_graph > graph, const TCuts &sorted_cuts)
 
void TrimSeqGraph (CBioseq_Handle bsh, CRef< CSeq_graph > graph, const TCuts &sorted_cuts)
 Trim Seq-graph annotation. More...
 
bool s_FindSegment (const CDense_seg &denseg, CDense_seg::TDim row, TSeqPos pos, CDense_seg::TNumseg &seg, TSeqPos &seg_start)
 
void s_CutDensegSegment (CRef< CSeq_align > align, CDense_seg::TDim row, TSeqPos pos)
 
void TrimSeqAlign (CBioseq_Handle bsh, CRef< CSeq_align > align, const TCuts &sorted_cuts)
 Trim Seq-align annotation. More...
 
void SetPartial (CSeq_loc &loc, CRef< CSeq_feat > feat, CSeq_loc::TStrand strand, bool partial_start, bool partial_stop)
 
void TrimSeqFeat (CRef< CSeq_feat > feat, const TCuts &sorted_cuts, bool &bFeatureDeleted, bool &bFeatureTrimmed, bool &partial_start, bool &partial_stop)
 Trim Seq-feat annotation. More...
 
void DeleteProteinAndRenormalizeNucProtSet (const CSeq_feat_Handle &feat_h)
 Secondary function needed after trimming Seq-feat. More...
 
void AdjustCdregionFrame (TSeqPos original_nuc_len, CRef< CSeq_feat > cds, const TCuts &sorted_cuts)
 Secondary function needed after trimming Seq-feat. More...
 
CRef< CBioseqSetNewProteinSequence (CScope &new_scope, CRef< CSeq_feat > cds, CRef< CSeq_inst > new_inst)
 Secondary function needed after trimming Seq-feat. More...
 
void RetranslateCdregion (CBioseq_Handle nuc_bsh, bool isPartialStart, bool isPartialStop, CRef< CSeq_inst > trimmed_nuc_inst, CRef< CSeq_feat > cds, const TCuts &sorted_cuts)
 Secondary function needed after trimming Seq-feat. More...
 
CRef< CSeqdescFindUnverified (const CBioseq &seq)
 
bool IsUnverifiedOrganism (const CBioseq &seq)
 
bool IsUnverifiedFeature (const CBioseq &seq)
 
bool IsUnverifiedMisassembled (const CBioseq &seq)
 
bool IsUnverifiedContaminant (const CBioseq &seq)
 
void SortSeqDescr (CSeq_descr &descr)
 
void SortSeqDescr (CSeq_entry &entry)
 
const stringGetTargetedLocusName (const CGene_ref &gene)
 
const stringGetTargetedLocusName (const CProt_ref &prot)
 
string GetTargetedLocusName (const CRNA_ref &rna)
 
string GetTargetedLocusName (const CSeq_feat &feat)
 
string GetTargetedLocusName (const CSeq_feat &cds, CScope &scope)
 
string GenerateTargetedLocusName (CBioseq_Handle seq)
 
void SetTargetedLocusName (CBioseq_Handle seq, const string &tls)
 
string GetTargetedLocusNameConsensus (const string &tls1, const string &tls2)
 

Typedef Documentation

◆ TAlignVec

typedef vector< CConstRef<CSeq_align> > TAlignVec

Definition at line 996 of file seq_entry_edit.cpp.

◆ TMapDescendentToInputEntry

Definition at line 992 of file seq_entry_edit.cpp.

◆ TMapEntryToAlignVec

typedef CMapWithOriginalOrderingIteration<CSeq_entry_Handle, TAlignVec> TMapEntryToAlignVec

Definition at line 997 of file seq_entry_edit.cpp.

◆ TMapSeqAnnotToDest

typedef CMapWithOriginalOrderingIteration< CRef<CSeq_annot>, CSeq_entry_Handle> TMapSeqAnnotToDest

Definition at line 993 of file seq_entry_edit.cpp.

◆ TVecOfSeqAnnotsToErase

Definition at line 994 of file seq_entry_edit.cpp.

Function Documentation

◆ AddBioseqToBioseq()

void AddBioseqToBioseq ( const CBioseq_Handle to,
const CBioseq_Handle add 
)

Attach one Bioseq to another.

This function will add one Bioseq to another if: 1. 'to' is a nucleotide and 'add' is a protein. The result is a nuc-prot set contating both elements. 2. both Bioseqs have the same molecular type. The result is a segmented bioseq of which the two bioseqs serve as parts. 3. 'to' is a segmented bioseq and 'add' has the same molecular type as 'to'. 'add' will be added as a new part of 'to'.

Parameters
toBioseq to change
addBioseq to add
See also
AddSeqEntryToSeqEntry()

Definition at line 414 of file seq_entry_edit.cpp.

References CBioseq_Handle::GetEditHandle(), CBioseq_Handle::GetInst_Mol(), CSeq_inst::IsAa(), CSeq_inst::IsNa(), s_AddBioseqToBioseq(), and s_AddProtToNuc().

Referenced by AddSeqEntryToSeqEntry(), and s_AddBioseqToNucProtSet().

◆ AddBioseqToBioseqSet()

void AddBioseqToBioseqSet ( const CBioseq_set_Handle bsst,
const CBioseq_Handle seq 
)

◆ AddLinkageEvidence()

void AddLinkageEvidence ( CSeq_ext ext,
CLinkage_evidence::TType  evidence_type 
)

AddLinkageEvidence A function to add linkage evidence for gaps in a delta sequence.

Note that this function will automatically set the linkage to eLinkage_linked.

Parameters
extThe Seq_ext to adjust
evidence_typeThe evidence type to use.
Returns
none

Definition at line 2040 of file seq_entry_edit.cpp.

References CSeq_gap::AddLinkageEvidence(), NON_CONST_ITERATE, CDelta_ext_Base::Set(), and CSeq_ext_Base::SetDelta().

◆ AddLocalIdUserObjects()

void AddLocalIdUserObjects ( CSeq_entry entry)

◆ AddSeqdescToBioseq()

void AddSeqdescToBioseq ( const CSeqdesc desc,
CBioseq seq 
)

◆ AddSeqdescToBioseqSet()

void AddSeqdescToBioseqSet ( const CSeqdesc desc,
CBioseq_set set 
)

Definition at line 557 of file seq_entry_edit.cpp.

References AddSeqdescToSeqDescr(), and IsSeqDescInList().

Referenced by AddSeqdescToSeqEntryRecursively().

◆ AddSeqdescToSeqDescr()

void AddSeqdescToSeqDescr ( const CSeqdesc desc,
CSeq_descr seq_descr 
)

◆ AddSeqdescToSeqEntryRecursively()

bool AddSeqdescToSeqEntryRecursively ( CSeq_entry entry,
CSeqdesc desc 
)

◆ AddSeqEntryToSeqEntry()

void AddSeqEntryToSeqEntry ( const CSeq_entry_Handle to,
const CSeq_entry_Handle add 
)

Attach one Seq-entry to another.

Parameters
toSeq-entry to change
addSeq-entry to add
See also
Other forms of adding the content of one Seq-entry to another.

Definition at line 344 of file seq_entry_edit.cpp.

References AddBioseqToBioseq(), AddBioseqToBioseqSet(), CSeq_entry_Handle::GetSeq(), CSeq_entry_Handle::GetSet(), CSeq_entry_Handle::IsSeq(), and CSeq_entry_Handle::IsSet().

◆ AdjustCdregionFrame()

void AdjustCdregionFrame ( TSeqPos  original_nuc_len,
CRef< CSeq_feat cds,
const TCuts sorted_cuts 
)

◆ BioseqSetDescriptorPropagateDown()

void BioseqSetDescriptorPropagateDown ( const CBioseq_set_Handle bioseq_set_h,
const vector< CSeqdesc::E_Choice > &  choices_to_delete = vector< CSeqdesc::E_Choice >() 
)

Moves descriptors down to children of the given bioseq-set.

Each child gets a copy of all the descriptors. It does NOT check for duplicate Seqdescs.

Parameters
bioseq_set_hThis is the bioseq_set whose descriptors we're moving.
choices_to_deleteIf non-empty, it indicates the types of CSeqdescs to delete instead of propagating.

Definition at line 1447 of file seq_entry_edit.cpp.

References CSeq_entry_EditHandle::AddDescr(), CSeqdesc_Base::e_not_set, CSeq_entry_CI::eNonRecursive, CBioseq_set_Handle::GetEditHandle(), CSeq_entry_Handle::GetEditHandle(), CBioseq_set_Handle::GetParentEntry(), CBioseq_set_EditHandle::ResetDescr(), SerialClone(), CSeq_descr_Base::Set(), and CSeqdesc_Base::Which().

Referenced by BOOST_AUTO_TEST_CASE(), and s_PromoteSingletonSetsInSet().

◆ BioseqSetDescriptorPropagateUp()

void BioseqSetDescriptorPropagateUp ( CBioseq_set_Handle  set)

Moves descriptors up from children of the given bioseq-set if each child has an identical copy of the descriptor.

It does NOT check for duplicate Seqdescs. Will not move molinfo, title, or source descriptors.

Parameters
bioseq_set_hThis is the bioseq_set whose descriptors we're moving.

Definition at line 1368 of file seq_entry_edit.cpp.

References CBioseq_set_EditHandle::AddSeqdesc(), CSerialObject::Assign(), first(), CSeq_descr_Base::Get(), CBioseq_set_Base::GetSeq_set(), CSeq_descr_Base::IsSet(), ITERATE, CBioseq_EditHandle::RemoveSeqdesc(), CBioseq_set_EditHandle::RemoveSeqdesc(), CSeq_descr_Base::Reset(), CSeq_descr_Base::Set(), CBioseq_EditHandle::SetDescr(), and CBioseq_set_EditHandle::SetDescr().

Referenced by BOOST_AUTO_TEST_CASE().

◆ ConvertRawToDeltaByNs() [1/2]

void ConvertRawToDeltaByNs ( CBioseq_Handle  bsh,
size_t  min_unknown,
int  max_unknown,
size_t  min_known,
int  max_known,
bool  is_assembly_gap,
int  gap_type,
int  linkage,
int  linkage_evidence 
)

◆ ConvertRawToDeltaByNs() [2/2]

void ConvertRawToDeltaByNs ( CSeq_inst inst,
size_t  min_unknown,
int  max_unknown,
size_t  min_known,
int  max_known,
bool  is_assembly_gap,
int  gap_type,
int  linkage,
int  linkage_evidence 
)

ConvertRawToDeltaByNs A function to convert a raw sequence to a delta sequence, using runs of Ns to determine the gap location.

The size of the run of Ns determines whether a gap should be created and whether the gap should be of type known or unknown. Note that if the ranges overlap, unknown gaps will be preferred (allowing the user to create known length gaps for 20-forever, but unknown length gaps for 100, for example). Use a negative number for a maximum to indicate that there is no upper limit.

Parameters
instThe Seq-inst to adjust
min_unknownThe minimum number of Ns to be converted to a gap of unknown length
max_unknownThe maximum number of Ns to be converted to a gap of unknown length
min_knownThe minimum number of Ns to be converted to a gap of known length
max_knownThe maximum number of Ns to be converted to a gap of known length
Returns
none

Definition at line 1804 of file seq_entry_edit.cpp.

References CSeqConvert::Convert(), CSeq_data_Base::e_Iupacna, CSeqUtil::e_Iupacna, CSeq_data_Base::e_Ncbi2na, CSeqUtil::e_Ncbi2na, CSeq_data_Base::e_Ncbi4na, CSeqUtil::e_Ncbi4na, CSeq_data_Base::e_Ncbi8na, CSeqUtil::e_Ncbi8na, CSeq_inst_Base::eRepr_delta, CSeq_inst_Base::eRepr_raw, CAliasBase< TPrim >::Get(), CSeq_data_Base::GetIupacna(), CSeq_inst_Base::GetLength(), CSeq_data_Base::GetNcbi2na(), CSeq_data_Base::GetNcbi4na(), CSeq_data_Base::GetNcbi8na(), CSeq_inst_Base::GetRepr(), CSeq_inst_Base::GetSeq_data(), CSeq_inst_Base::IsSetRepr(), CSeq_inst_Base::IsSetSeq_data(), ITERATE, CSeq_inst_Base::ResetSeq_data(), s_AddGap(), s_AddLiteral(), CSeq_inst_Base::SetRepr(), and CSeq_data_Base::Which().

Referenced by BOOST_AUTO_TEST_CASE(), ConvertRawToDeltaByNs(), ConvertRawToDeltaByNsCommand_impl(), and ConvertRawToDeltaByNsHugeFileCmd_impl().

◆ DeleteProteinAndRenormalizeNucProtSet()

void DeleteProteinAndRenormalizeNucProtSet ( const CSeq_feat_Handle feat_h)

◆ DivvyUpAlignments()

void DivvyUpAlignments ( const TVecOfSeqEntryHandles vecOfSeqEntryHandles)

Call this if the alignments directly under these seq-entries are all jumbled up between each other.

It will move each Seq-align into the proper location. In particular, it looks at all the seq-ids in each seq-align. If none of them belong to any member of vecOfSeqEntryHandles, then that Seq-align is copied to all members of vecOfSeqEntryHandles. If it belongs to only one member of vecOfSeqEntryHandles, then it goes there. If the align belongs to more than one, it's destroyed.

Parameters
vecOfSeqEntryHandlesThe Seq-entries we're considering for alignments.

Definition at line 1304 of file seq_entry_edit.cpp.

References CSerialObject::Assign(), CSeq_entry_EditHandle::AttachAnnot(), CSeq_entry_CI::eRecursive, CSeq_annot_CI::eSearch_entry, CSeq_entry_Handle::GetEditHandle(), ITERATE, and s_DivvyUpAlignments_ProcessAnnot().

Referenced by SegregateSetsByBioseqList().

◆ Does3primerAbutGap()

bool Does3primerAbutGap ( const CSeq_feat feat,
CBioseq_Handle  seq_hl 
)

◆ Does5primerAbutGap()

bool Does5primerAbutGap ( const CSeq_feat feat,
CBioseq_Handle  seq_hl 
)

◆ FindUnverified()

CRef<CSeqdesc> FindUnverified ( const CBioseq seq)

◆ GenerateTargetedLocusName()

string GenerateTargetedLocusName ( CBioseq_Handle  seq)

◆ GetDeltaSeqForPosition()

CConstRef<CDelta_seq> GetDeltaSeqForPosition ( const unsigned  pos,
const CBioseq_Handle  seq_hl,
CScope scope,
unsigned &  left_endpoint 
)

◆ GetSortedCuts()

void GetSortedCuts ( CBioseq_Handle  bsh,
const TCuts cuts,
TCuts sorted_cuts,
EInternalTrimType  internal_cut_conversion 
)

1) Adjust any internal cuts to terminal cuts according to option.

1) Merge abutting and overlapping cuts.

2) Merge abutting and overlapping cuts. 3) Sort the cuts from greatest to least so that sequence data and annotation will be deleted from greatest loc to smallest loc. That way we don't have to adjust coordinate values after each cut.

Definition at line 2401 of file seq_entry_edit.cpp.

References CRangeCmp::eAscending, CRangeCmp::eDescending, eDoNotTrimInternal, CBioseq_Handle::GetBioseqLength(), CRange_Base::GetFrom(), CRange_Base::GetTo(), s_AdjustInternalCutLocations(), s_MergeCuts(), and ct::sort().

Referenced by BOOST_AUTO_TEST_CASE(), and TrimSequenceAndAnnotation().

◆ GetTargetedLocusName() [1/5]

const string& GetTargetedLocusName ( const CGene_ref gene)

◆ GetTargetedLocusName() [2/5]

const string& GetTargetedLocusName ( const CProt_ref prot)

Definition at line 3539 of file seq_entry_edit.cpp.

References kEmptyStr, and prot.

◆ GetTargetedLocusName() [3/5]

string GetTargetedLocusName ( const CRNA_ref rna)

Definition at line 3552 of file seq_entry_edit.cpp.

References rna.

◆ GetTargetedLocusName() [4/5]

string GetTargetedLocusName ( const CSeq_feat cds,
CScope scope 
)

◆ GetTargetedLocusName() [5/5]

string GetTargetedLocusName ( const CSeq_feat feat)

◆ GetTargetedLocusNameConsensus()

string GetTargetedLocusNameConsensus ( const string tls1,
const string tls2 
)

◆ HandleCollidingIds()

void HandleCollidingIds ( CSeq_entry entry)

◆ HasRepairedIDs() [1/2]

bool HasRepairedIDs ( const CSeq_entry entry)

◆ HasRepairedIDs() [2/2]

bool HasRepairedIDs ( const CUser_object user,
const CBioseq::TId ids 
)

◆ IsDeltaSeqGap()

bool IsDeltaSeqGap ( CConstRef< CDelta_seq delta)

Definition at line 225 of file seq_entry_edit.cpp.

References delta().

◆ IsMatchingIdMissing()

bool IsMatchingIdMissing ( const CUser_field field,
const CBioseq::TId ids 
)

◆ IsSeqDescInList()

bool IsSeqDescInList ( const CSeqdesc desc,
const CSeq_descr set 
)

◆ IsUnverifiedContaminant()

bool IsUnverifiedContaminant ( const CBioseq seq)

◆ IsUnverifiedFeature()

bool IsUnverifiedFeature ( const CBioseq seq)

◆ IsUnverifiedMisassembled()

bool IsUnverifiedMisassembled ( const CBioseq seq)

◆ IsUnverifiedOrganism()

bool IsUnverifiedOrganism ( const CBioseq seq)

◆ LabelFromType()

string LabelFromType ( CSeq_id::E_Choice  choice)

◆ MakeOriginalIdField()

CRef<CUser_field> MakeOriginalIdField ( const CSeq_id id)

◆ MakeOriginalLabelForId()

string MakeOriginalLabelForId ( const CSeq_id id)

◆ NormalizeUnknownLengthGaps()

TLocAdjustmentVector NormalizeUnknownLengthGaps ( CSeq_inst inst,
TSeqPos  unknown_length 
)

NormalizeUnknownLengthGaps A function to adjust the length of unknown-length gaps to a specific length (100 by default).

Parameters
instThe Seq-inst to adjust
Returns
A vector of the adjustments to the sequence, which can be used to fix the locations of features on the sequence.

Definition at line 1907 of file seq_entry_edit.cpp.

References CSeq_inst_Base::eRepr_delta, CSeq_inst_Base::GetLength(), CSeq_inst_Base::GetRepr(), CSeq_inst_Base::IsSetExt(), CSeq_inst_Base::IsSetRepr(), NON_CONST_ITERATE, CSeq_inst_Base::SetExt(), and CSeq_inst_Base::SetLength().

Referenced by CRawSeqToDeltaSeqByLoc::apply_impl(), BOOST_AUTO_TEST_CASE(), ConvertRawToDeltaByNs(), ConvertRawToDeltaByNsCommand_impl(), and ConvertRawToDeltaByNsHugeFileCmd_impl().

◆ RemoveUserObjectType()

void RemoveUserObjectType ( CSeq_entry entry,
CUser_object::EObjectType  type 
)

◆ ResetLinkageEvidence()

void ResetLinkageEvidence ( CSeq_ext ext)

ResetLinkageEvidence A function to clear linkage evidence for gaps in a delta sequence.

Parameters
extThe Seq_ext to adjust
Returns
none

Definition at line 2057 of file seq_entry_edit.cpp.

References CSeq_gap_Base::eLinkage_unlinked, CSeq_gap_Base::eType_repeat, CSeq_gap_Base::GetType(), CSeq_gap_Base::IsSetType(), NON_CONST_ITERATE, CSeq_gap_Base::ResetLinkage(), CSeq_gap_Base::ResetLinkage_evidence(), CDelta_ext_Base::Set(), CSeq_ext_Base::SetDelta(), and CSeq_gap_Base::SetLinkage().

◆ RetranslateCdregion()

void RetranslateCdregion ( CBioseq_Handle  nuc_bsh,
bool  isPartialStart,
bool  isPartialStop,
CRef< CSeq_inst trimmed_nuc_inst,
CRef< CSeq_feat cds,
const TCuts sorted_cuts 
)

◆ s_AddBioseqToBioseq()

static void s_AddBioseqToBioseq ( const CBioseq_EditHandle to,
const CBioseq_EditHandle add 
)
static

◆ s_AddBioseqToNucProtSet()

static void s_AddBioseqToNucProtSet ( CBioseq_set_EditHandle nuc_prot,
CBioseq_EditHandle seq 
)
static

◆ s_AddBioseqToPartsSet()

static void s_AddBioseqToPartsSet ( CBioseq_set_EditHandle parts,
CBioseq_EditHandle seq 
)
static

◆ s_AddBioseqToSegset()

static void s_AddBioseqToSegset ( CBioseq_set_EditHandle segset,
CBioseq_EditHandle part 
)
static

◆ s_AddGap()

void s_AddGap ( CSeq_inst inst,
size_t  n_len,
bool  is_unknown,
bool  is_assembly_gap = false,
int  gap_type = CSeq_gap::eType_unknown,
int  linkage = -1,
int  linkage_evidence = -1 
)

Definition at line 1758 of file seq_entry_edit.cpp.

References CInt_fuzz_Base::eLim_unk, and CSeq_inst_Base::SetExt().

Referenced by ConvertRawToDeltaByNs().

◆ s_AddLiteral()

void s_AddLiteral ( CSeq_inst inst,
const string element 
)

Definition at line 1748 of file seq_entry_edit.cpp.

References CSeq_inst_Base::SetExt().

Referenced by ConvertRawToDeltaByNs().

◆ s_AddPartToSegmentedBioseq()

static void s_AddPartToSegmentedBioseq ( const CBioseq_EditHandle seg,
const CBioseq_EditHandle part 
)
static

◆ s_AddProtToNuc()

static void s_AddProtToNuc ( const CBioseq_EditHandle nuc,
const CBioseq_EditHandle prot 
)
static

◆ s_AdjustInternalCutLocations()

static void s_AdjustInternalCutLocations ( TCuts cuts,
TSeqPos  seq_length,
EInternalTrimType  internal_cut_conversion 
)
static

Adjust any internal cuts to terminal cuts.

Definition at line 2361 of file seq_entry_edit.cpp.

References eTrimTo5PrimeEnd, eTrimToClosestEnd, CRange_Base::GetFrom(), CRange_Base::GetTo(), CRange_Base::SetFrom(), and CRange_Base::SetTo().

Referenced by GetSortedCuts().

◆ s_BasicValidation()

void s_BasicValidation ( CBioseq_Handle  bsh,
const TCuts cuts 
)

◆ s_CutDensegSegment()

void s_CutDensegSegment ( CRef< CSeq_align align,
CDense_seg::TDim  row,
TSeqPos  pos 
)

◆ s_DivvyUpAlignments_ProcessAnnot()

static void s_DivvyUpAlignments_ProcessAnnot ( const CSeq_annot_Handle annot_h,
const TMapDescendentToInputEntry mapDescendentToInputEntry,
TMapSeqAnnotToDest mapSeqAnnotToDest,
TVecOfSeqAnnotsToErase vecOfSeqAnnotToErase 
)
static

◆ s_DivvyUpAlignments_ProcessAnnot_Dendiag()

static bool s_DivvyUpAlignments_ProcessAnnot_Dendiag ( const CSeq_align_Handle align,
const TMapDescendentToInputEntry mapDescendentToInputEntry,
TMapEntryToAlignVec mapEntryToAlignVec 
)
static

◆ s_DivvyUpAlignments_ProcessAnnot_Denseg()

static bool s_DivvyUpAlignments_ProcessAnnot_Denseg ( const CSeq_align_Handle align,
const TMapDescendentToInputEntry mapDescendentToInputEntry,
TMapEntryToAlignVec mapEntryToAlignVec 
)
static

◆ s_FindSegment()

bool s_FindSegment ( const CDense_seg denseg,
CDense_seg::TDim  row,
TSeqPos  pos,
CDense_seg::TNumseg seg,
TSeqPos seg_start 
)

◆ s_GetRetainedRange()

static TRange s_GetRetainedRange ( const TCuts sorted_merged_cuts,
TSeqPos  seqLength 
)
static

Definition at line 2118 of file seq_entry_edit.cpp.

References _ASSERT, and compile_time_bits::range().

Referenced by TrimSequenceAndAnnotation().

◆ s_GetTrimCoordinates()

static void s_GetTrimCoordinates ( CBioseq_Handle  bsh,
const TCuts sorted_cuts,
TSeqPos trim_start,
TSeqPos trim_stop 
)
static

◆ s_IsSingletonSet()

static bool s_IsSingletonSet ( const CBioseq_set_Handle bioseq_set)
static

◆ s_MakeGroupsForUniqueValues()

static void s_MakeGroupsForUniqueValues ( const CSeq_entry_Handle target,
const CScope::TBioseqHandles bioseq_handles 
)
static

◆ s_MakeUniqueLocalId()

static CSeq_id* s_MakeUniqueLocalId ( void  )
static

Definition at line 375 of file seq_entry_edit.cpp.

References count, and NStr::NumericToString().

Referenced by s_AddBioseqToBioseq().

◆ s_MergeCuts()

static void s_MergeCuts ( TCuts sorted_cuts)
static

Assumes sorted_cuts are sorted in Ascending order!

Definition at line 2324 of file seq_entry_edit.cpp.

References CRange_Base::GetFrom(), CRange_Base::GetTo(), and CRange_Base::SetTo().

Referenced by GetSortedCuts().

◆ s_PromoteSingletonSetsInSet()

static void s_PromoteSingletonSetsInSet ( const CBioseq_set_Handle bioseq_set_h)
static

◆ s_SeqIntervalDelete()

static void s_SeqIntervalDelete ( CRef< CSeq_interval interval,
TSeqPos  cut_from,
TSeqPos  cut_to,
bool bCompleteCut,
bool bTrimmed 
)
static

◆ s_SeqLocDelete()

static void s_SeqLocDelete ( CRef< CSeq_loc loc,
TSeqPos  from,
TSeqPos  to,
bool bCompleteCut,
bool bTrimmed 
)
static

◆ s_UpdateSeqGraphLoc()

static void s_UpdateSeqGraphLoc ( CRef< CSeq_graph graph,
const TCuts sorted_cuts 
)
static

◆ SegregateSetsByBioseqList()

void SegregateSetsByBioseqList ( const CSeq_entry_Handle target,
const CScope::TBioseqHandles bioseq_handles 
)

Split a Seq-entry, where the second part holds the given bioseqs.

There are various complex rules here that may not be obvious at first glance.

Parameters
targetThe Seq-entry to split
bioseq_handlesThe array of bioseqs that should end up in the second part of the target, with the rest in the first part.

Definition at line 963 of file seq_entry_edit.cpp.

References DivvyUpAlignments(), CSeq_entry_CI::eNonRecursive, CSeq_entry_Handle::GetSet(), CSeq_entry_Handle::IsSet(), and s_MakeGroupsForUniqueValues().

◆ SeqEntryFromSeqSubmit()

CRef<CSeq_entry> SeqEntryFromSeqSubmit ( const CSeq_submit submit)

◆ SetLinkageType()

void SetLinkageType ( CSeq_ext ext,
CSeq_gap::TType  linkage_type 
)

SetLinkageType A function to set the linkage_type for gaps in a delta sequence.

Parameters
extThe Seq_ext to adjust
linkage_typeThe linkage_type to use.
Returns
none

Definition at line 1990 of file seq_entry_edit.cpp.

References CSeq_gap::ChangeType(), NON_CONST_ITERATE, CDelta_ext_Base::Set(), and CSeq_ext_Base::SetDelta().

Referenced by BOOST_AUTO_TEST_CASE().

◆ SetLinkageTypeLinkedRepeat()

void SetLinkageTypeLinkedRepeat ( CSeq_ext ext,
CLinkage_evidence::TType  evidence_type 
)

◆ SetLinkageTypeScaffold()

void SetLinkageTypeScaffold ( CSeq_ext ext,
CLinkage_evidence::TType  evidence_type 
)

SetLinkageTypeScaffold A special case of SetLinkageType.

When type is Scaffold, linkage must be linked and linkage evidence must be provided.

Parameters
extThe Seq_ext to adjust
evidence_typeThe linkage_type to use.
Returns
none

Definition at line 2009 of file seq_entry_edit.cpp.

References NON_CONST_ITERATE, CDelta_ext_Base::Set(), CSeq_ext_Base::SetDelta(), and CSeq_gap::SetLinkageTypeScaffold().

◆ SetNewProteinSequence()

CRef<CBioseq> SetNewProteinSequence ( CScope new_scope,
CRef< CSeq_feat cds,
CRef< CSeq_inst new_inst 
)

◆ SetPartial()

void SetPartial ( CSeq_loc loc,
CRef< CSeq_feat feat,
CSeq_loc::TStrand  strand,
bool  partial_start,
bool  partial_stop 
)

◆ SetTargetedLocusName()

void SetTargetedLocusName ( CBioseq_Handle  seq,
const string tls 
)

◆ SortSeqDescr() [1/2]

void SortSeqDescr ( CSeq_descr descr)

Definition at line 3509 of file seq_entry_edit.cpp.

References CSeq_descr_Base::Set().

Referenced by SortSeqDescr().

◆ SortSeqDescr() [2/2]

void SortSeqDescr ( CSeq_entry entry)

◆ TrimSeqAlign()

void TrimSeqAlign ( CBioseq_Handle  bsh,
CRef< CSeq_align align,
const TCuts sorted_cuts 
)

◆ TrimSeqData()

void TrimSeqData ( CBioseq_Handle  bsh,
CRef< CSeq_inst inst,
const TCuts sorted_cuts 
)

◆ TrimSeqFeat()

void TrimSeqFeat ( CRef< CSeq_feat feat,
const TCuts sorted_cuts,
bool bFeatureDeleted,
bool bFeatureTrimmed,
bool partial_start,
bool partial_stop 
)

◆ TrimSeqGraph()

void TrimSeqGraph ( CBioseq_Handle  bsh,
CRef< CSeq_graph graph,
const TCuts sorted_cuts 
)

◆ TrimSequenceAndAnnotation()

void TrimSequenceAndAnnotation ( CBioseq_Handle  bsh,
const TCuts cuts,
EInternalTrimType  internal_cut_conversion 
)

Implementation detail: first trim all associated annotation, then trim sequence data.

Trim sequence data and all associated annotation.

Definition at line 2147 of file seq_entry_edit.cpp.

References CSerialObject::Assign(), CDense_seg_Base::CanGetDim(), CDense_seg_Base::CanGetIds(), CSeq_inst_Base::CanGetLength(), CDense_seg_Base::CanGetLens(), CDense_seg_Base::CanGetNumseg(), CSeq_align_Base::CanGetSegs(), CDense_seg_Base::CanGetStarts(), NStr::CompareNocase(), DeleteProteinAndRenormalizeNucProtSet(), CSeq_annot_Base::C_Data::e_Align, CSeqFeatData_Base::e_Cdregion, CSeq_align_Base::C_Segs::e_Denseg, CSeq_annot_Base::C_Data::e_Ftable, CSeq_annot_Base::C_Data::e_Graph, CCdregion_Base::eFrame_not_set, CSeq_feat_Base::GetData(), CSeq_align_Base::C_Segs::GetDenseg(), CBioseq_Handle::GetEditHandle(), CBioseq_Handle::GetInst(), CSeq_inst_Base::GetLength(), CMappedFeat::GetOriginalFeature(), CMappedGraph::GetOriginalGraph(), CAlign_CI::GetOriginalSeq_align(), CSeq_align_Base::GetSegs(), CAlign_CI::GetSeq_align_Handle(), CMappedGraph::GetSeq_graph_Handle(), GetSortedCuts(), CMappedGraph::GetTitle(), CSeq_feat_Base::IsSetData(), CSeq_feat_Base::IsSetProduct(), CMappedGraph::IsSetTitle(), CSeq_align_Handle::Replace(), CSeq_feat_EditHandle::Replace(), CSeq_graph_Handle::Replace(), RetranslateCdregion(), s_BasicValidation(), s_GetRetainedRange(), CSeq_feat_Base::SetData(), CBioseq_EditHandle::SetInst(), TrimSeqAlign(), TrimSeqData(), TrimSeqFeat(), TrimSeqGraph(), CSeq_align_Base::C_Segs::Which(), and CSeqFeatData_Base::Which().

Referenced by BOOST_AUTO_TEST_CASE().

◆ TypeFromLabel()

CSeq_id::E_Choice TypeFromLabel ( const string label)

◆ UpdateSeqLength()

void UpdateSeqLength ( CAutoInitRef< CDelta_ext > &  pDeltaExt,
CBioseq_Handle complete_bsh,
CSeqMap_CI seqmap_ci,
CSeq_inst_Base::TLength new_length 
)
Modified on Fri Sep 20 14:57:00 2024 by modify_doxy.py rev. 669887