NCBI C++ ToolKit
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
variation_ref::CVariationUtil Class Reference

Search Toolkit Book for variation_ref::CVariationUtil

#include <misc/hgvs/variation_util.hpp>

+ Inheritance diagram for variation_ref::CVariationUtil:
+ Collaboration diagram for variation_ref::CVariationUtil:


struct  SFlankLocs
 Calculate upstream (first) and downstream(second) flanks for loc. More...

Public Types

enum  ETestStatus { eFail , ePass , eNotApplicable }
enum  ESOTerm {
  eSO_2KB_upstream_variant =1636 , eSO_500B_downstream_variant =1634 , eSO_splice_donor_variant =1575 , eSO_splice_acceptor_variant =1574 ,
  eSO_intron_variant =1627 , eSO_5_prime_UTR_variant =1623 , eSO_3_prime_UTR_variant =1624 , eSO_coding_sequence_variant =1580 ,
  eSO_nc_transcript_variant =1619 , eSO_synonymous_codon =1588 , eSO_non_synonymous_codon =1583 , eSO_stop_gained =1587 ,
  eSO_stop_lost =1578 , eSO_frameshift_variant =1589
 Supported SO-terms. More...
typedef vector< ESOTermTSOTerms
- Public Types inherited from CObject
enum  EAllocFillMode { eAllocFillNone = 1 , eAllocFillZero , eAllocFillPattern }
 Control filling of newly allocated memory. More...
typedef CObjectCounterLocker TLockerType
 Default locker type for CRef. More...
typedef atomic< Uint8TCounter
 Counter type is CAtomiCounter. More...
typedef Uint8 TCount
 Alias for value type of counter. More...

Public Member Functions

 CVariationUtil (CScope &scope)
ETestStatus CheckExonBoundary (const CSeq_feat &variation_feat, const CSeq_align &aln)
bool SetReferenceSequence (CVariation_ref &vr, const CSeq_loc &location)
CRef< CSeq_featRemap (const CSeq_feat &variation_feat, const CSeq_align &aln)
CRef< CSeq_featProtToPrecursor (const CSeq_feat &prot_variation_feat)
 Convert protein-variation (single-AA missense/nonsense) to nuc-variation on the parent. More...
CRef< CSeq_featPrecursorToProt (const CSeq_feat &prot_variation_feat)
 Convert to nuc-variation on the parent to protein-variation (single-AA missense/nonsense) Only a subset of sequence edits is supported (mismatch, ins, del, indel) The location must fall within annotated CDS. More...
void FlipStrand (CSeq_feat &variation_feat)
 todo: implement when decide on representation in the schema More...
SFlankLocs CreateFlankLocs (const CSeq_loc &loc, TSeqPos len)
void ChangeToDelins (CVariation_ref &v)
void AdjustDelinsToInterval (CVariation_ref &delins_variation, const CSeq_loc &int_loc)
void SetVariantProperties (CVariantProperties &prop, const CSeq_loc &orig_loc)
 Set location-specific variant-properties. More...
void SetVariantProperties (CVariation_ref &vr)
 Recursively iterate sub-variations: calculate location and variant properties for inst-type variations unless their observation-type is asserted or reference. More...
void AsSOTerms (const CVariantProperties &p, TSOTerms &terms)
- Public Member Functions inherited from CObject
 CObject (void)
 Constructor. More...
 CObject (const CObject &src)
 Copy constructor. More...
virtual ~CObject (void)
 Destructor. More...
CObjectoperator= (const CObject &src) THROWS_NONE
 Assignment operator. More...
bool CanBeDeleted (void) const THROWS_NONE
 Check if object can be deleted. More...
bool IsAllocatedInPool (void) const THROWS_NONE
 Check if object is allocated in memory pool (not system heap) More...
bool Referenced (void) const THROWS_NONE
 Check if object is referenced. More...
bool ReferencedOnlyOnce (void) const THROWS_NONE
 Check if object is referenced only once. More...
void AddReference (void) const
 Add reference to object. More...
void RemoveReference (void) const
 Remove reference to object. More...
void ReleaseReference (void) const
 Remove reference without deleting object. More...
virtual void DoNotDeleteThisObject (void)
 Mark this object as not allocated in heap – do not delete this object. More...
virtual void DoDeleteThisObject (void)
 Mark this object as allocated in heap – object can be deleted. More...
void * operator new (size_t size)
 Define new operator for memory allocation. More...
void * operator new[] (size_t size)
 Define new[] operator for 'array' memory allocation. More...
void operator delete (void *ptr)
 Define delete operator for memory deallocation. More...
void operator delete[] (void *ptr)
 Define delete[] operator for memory deallocation. More...
void * operator new (size_t size, void *place)
 Define new operator. More...
void operator delete (void *ptr, void *place)
 Define delete operator. More...
void * operator new (size_t size, CObjectMemoryPool *place)
 Define new operator using memory pool. More...
void operator delete (void *ptr, CObjectMemoryPool *place)
 Define delete operator. More...
virtual void DebugDump (CDebugDumpContext ddc, unsigned int depth) const
 Define method for dumping debug information. More...
- Public Member Functions inherited from CDebugDumpable
 CDebugDumpable (void)
virtual ~CDebugDumpable (void)
void DebugDumpText (ostream &out, const string &bundle, unsigned int depth) const
void DebugDumpFormat (CDebugDumpFormatter &ddf, const string &bundle, unsigned int depth) const
void DumpToConsole (void) const

Static Public Member Functions

static void s_FactorOutLocsInPlace (CVariation_ref &v)
static void s_PropagateLocsInPlace (CVariation_ref &v)
 Propagate parent variation location to the members of set, unles they have their own location set. More...
static string AsString (ESOTerm term)
- Static Public Member Functions inherited from CObject
static NCBI_XNCBI_EXPORT void ThrowNullPointerException (void)
 Define method to throw null pointer exception. More...
static NCBI_XNCBI_EXPORT void ThrowNullPointerException (const type_info &type)
static EAllocFillMode GetAllocFillMode (void)
static void SetAllocFillMode (EAllocFillMode mode)
static void SetAllocFillMode (const string &value)
 Set mode from configuration parameter value. More...
- Static Public Member Functions inherited from CDebugDumpable
static void EnableDebugDump (bool on)

Private Member Functions

void x_SetVariantProperties (CVariantProperties &p, const CVariation_inst &vi, const CSeq_loc &loc)
void x_SetVariantPropertiesForIntronic (CVariantProperties &p, int offset, const CSeq_loc &loc, CBioseq_Handle &bsh)
void x_ProtToPrecursor (CVariation_ref &v)
CRef< CSeq_literalx_GetLiteralAtLoc (const CSeq_loc &loc)
void s_CalcPrecursorVariationCodon (const string &codon_from, const string &prot_to, vector< string > &codons_to)

Static Private Member Functions

static void s_Remap (CVariation_ref &vr, CSeq_loc_Mapper &mapper, const CSeq_loc &parent_variation_loc)
static CRef< CSeq_literals_CatLiterals (const CSeq_literal &a, const CSeq_literal &b)
static void s_UntranslateProt (const string &prot_str, vector< string > &codons)
static size_t s_CountMatches (const string &a, const string &b)
static string s_CollapseAmbiguities (const vector< string > &seqs)
static void s_ResolveIntronicOffsets (CVariation_ref &v, const CSeq_loc &parent_variation_loc)
static void s_AddIntronicOffsets (CVariation_ref &v, const CSpliced_seg &ss, const CSeq_loc &parent_variation_loc)

Private Attributes

CRef< CScopem_scope

Static Private Attributes

static const int m_variant_properties_schema_version = 1

Additional Inherited Members

- Static Public Attributes inherited from CObject
static const TCount eCounterBitsCanBeDeleted = 1 << 0
 Define possible object states. More...
static const TCount eCounterBitsInPlainHeap = 1 << 1
 Heap signature was found. More...
static const TCount eCounterBitsPlaceMask
 Mask for 'in heap' state flags. More...
static const int eCounterStep = 1 << 2
 Skip over the "in heap" bits. More...
static const TCount eCounterValid = TCount(1) << (sizeof(TCount) * 8 - 2)
 Minimal value for valid objects (reference counter is zero) Must be a single bit value. More...
static const TCount eCounterStateMask
 Valid object, and object in heap. More...
- Protected Member Functions inherited from CObject
virtual void DeleteThis (void)
 Virtual method "deleting" this object. More...

Detailed Description

Definition at line 62 of file variation_util.hpp.

Member Typedef Documentation

◆ TSOTerms

Definition at line 180 of file variation_util.hpp.

Member Enumeration Documentation

◆ ESOTerm

Supported SO-terms.


Definition at line 160 of file variation_util.hpp.

◆ ETestStatus


Definition at line 69 of file variation_util.hpp.

Constructor & Destructor Documentation

◆ CVariationUtil()

variation_ref::CVariationUtil::CVariationUtil ( CScope scope)

Definition at line 65 of file variation_util.hpp.

Member Function Documentation

◆ AdjustDelinsToInterval()

void variation_ref::CVariationUtil::AdjustDelinsToInterval ( CVariation_ref v,
const CSeq_loc loc 

Extend or truncate delins to specified location. truncate or attach suffixes/prefixes to seq-literals as necessary).

Precondition: variation must be a normalized delins (via x_ChangeToDelins)

Extend or truncate delins to specified location. truncate or attach suffixes/prefixes to seq-literals as necessary).

Precondition: -variation must be a normalized delins (via x_ChangeToDelins) -loc must be a superset of variation's location.

Definition at line 923 of file variation_util.cpp.

References delta(), eExtreme_Positional, eNa_strand_minus, CVariation_inst_Base::eType_delins, CSeq_loc::fMerge_SingleRange, CSeq_loc::fSortAndMerge_All, CVariation_ref_Base::GetData(), CVariation_inst_Base::GetDelta(), GetLength(), CVariation_ref::GetLocation(), GetStart(), GetStop(), GetStrand(), CVariation_ref_Base::C_Data::IsInstance(), CSeq_loc_Base::IsInt(), CVariation_ref_Base::C_Data::IsSet(), NCBI_THROW, NON_CONST_ITERATE, NULL, s_CatLiterals(), Seq_loc_Merge(), Seq_loc_Subtract(), CVariation_ref_Base::SetData(), CVariation_inst_Base::SetDelta(), CSeq_loc::SetInt(), CVariation_ref::SetLocation(), CVariation_inst_Base::SetType(), CSeq_loc::Subtract(), swap(), CSeq_loc_Base::Which(), and x_GetLiteralAtLoc().

Referenced by PrecursorToProt().

◆ AsSOTerms()

void variation_ref::CVariationUtil::AsSOTerms ( const CVariantProperties p,
TSOTerms terms 

◆ AsString()

string variation_ref::CVariationUtil::AsString ( ESOTerm  term)

◆ ChangeToDelins()

void variation_ref::CVariationUtil::ChangeToDelins ( CVariation_ref v)

◆ CheckExonBoundary()

CVariationUtil::ETestStatus variation_ref::CVariationUtil::CheckExonBoundary ( const CSeq_feat variation_feat,
const CSeq_align aln 

If variation-feat is not intronic, or alignment is not spliced-seg -> eNotApplicable Else if variation is intronic but location is not at exon boundary -> eFail Else -> ePass

if variation-feat is not intronic, or alignment is not spliced-seg -> eNotApplicable else if variation is intronic but location is not at exon boundary -> eFail else -> ePass

Definition at line 157 of file variation_util.cpp.

References CSerialObject::Assign(), Begin(), CDelta_item_Base::eAction_offset, eExtreme_Biological, eFail, set< Key, Compare >::end(), eNotApplicable, ePass, CSerialObject::Equals(), set< Key, Compare >::find(), CDelta_item_Base::GetAction(), CProt_pos_Base::GetAmin(), CSeq_feat_Base::GetData(), CVariation_ref_Base::GetData(), CVariation_inst_Base::GetDelta(), CSpliced_seg_Base::GetExons(), CSeq_loc::GetId(), CVariation_ref_Base::C_Data::GetInstance(), CSeq_feat_Base::GetLocation(), CVariation_ref::GetLocation(), CProduct_pos_Base::GetNucpos(), CSpliced_exon_Base::GetProduct_end(), CSpliced_exon_Base::GetProduct_start(), CProduct_pos_Base::GetProtpos(), CSeq_align_Base::GetSegs(), CSeq_align::GetSeq_id(), CSeq_align_Base::C_Segs::GetSpliced(), CSeq_loc::GetStart(), CSeq_loc::GetStop(), CSeqFeatData_Base::GetVariation(), set< Key, Compare >::insert(), CVariation_ref_Base::C_Data::IsInstance(), CProduct_pos_Base::IsNucpos(), CDelta_item_Base::IsSetAction(), CVariation_ref::IsSetLocation(), CSeq_align_Base::C_Segs::IsSpliced(), CSeqFeatData_Base::IsVariation(), ITERATE, s_PropagateLocsInPlace(), and CVariation_ref::SetLocation().

◆ CreateFlankLocs()

CVariationUtil::SFlankLocs variation_ref::CVariationUtil::CreateFlankLocs ( const CSeq_loc loc,
TSeqPos  len 

◆ FlipStrand()

void variation_ref::CVariationUtil::FlipStrand ( CSeq_feat variation_feat)

todo: implement when decide on representation in the schema

◆ PrecursorToProt()

CRef< CSeq_feat > variation_ref::CVariationUtil::PrecursorToProt ( const CSeq_feat prot_variation_feat)

Convert to nuc-variation on the parent to protein-variation (single-AA missense/nonsense) Only a subset of sequence edits is supported (mismatch, ins, del, indel) The location must fall within annotated CDS.

Definition at line 975 of file variation_util.cpp.

References CUser_object::AddField(), AdjustDelinsToInterval(), ChangeToDelins(), CreateFlankLocs(), delta(), variation_ref::CVariationUtil::SFlankLocs::downstream, CSeqFeatData_Base::e_Cdregion, CBioseq_Handle::eCoding_Iupac, CVariantProperties_Base::eEffect_frameshift, CVariantProperties_Base::eEffect_missense, CVariantProperties_Base::eEffect_stop_gain, CVariantProperties_Base::eEffect_stop_loss, CVariantProperties_Base::eEffect_synonymous, CSeq_loc_Mapper_Base::eLocationToProduct, CSeq_loc_Mapper_Base::eProductToLocation, CVariation_inst_Base::eType_del, CVariation_inst_Base::eType_prot_missense, CVariation_inst_Base::eType_prot_nonsense, CVariation_inst_Base::eType_prot_other, CVariation_inst_Base::eType_prot_silent, NStr::Find(), CSeqTranslator::fIs5PrimePartial, CSeq_loc::fSortAndMerge_All, CSeq_feat_Base::GetData(), CVariation_ref_Base::GetData(), CVariation_inst_Base::GetDelta(), CVariation_ref_Base::C_Data::GetInstance(), GetLength(), CSeq_feat_Base::GetLocation(), CSeqFeatData_Base::GetVariation(), i, CVariation_ref_Base::C_Data::IsInstance(), CSeqFeatData_Base::IsVariation(), literal(), m_scope, m_variant_properties_schema_version, CSeq_loc_Mapper_Base::Map(), MSerial_AsnText, NCBI_THROW, NcbiCerr, NPOS, NULL, NStr::ReplaceInPlace(), CRef< C, Locker >::Reset(), Seq_loc_Add(), CSeq_feat_Base::SetData(), CSeq_loc::SetId(), CSeq_feat_Base::SetLocation(), CUser_object_Base::SetType(), and CSeqTranslator::Translate().

Referenced by x_SetVariantProperties().

◆ ProtToPrecursor()

CRef< CSeq_feat > variation_ref::CVariationUtil::ProtToPrecursor ( const CSeq_feat prot_variation_feat)

◆ Remap()

CRef< CSeq_feat > variation_ref::CVariationUtil::Remap ( const CSeq_feat variation_feat,
const CSeq_align aln 

◆ s_AddIntronicOffsets()

void variation_ref::CVariationUtil::s_AddIntronicOffsets ( CVariation_ref v,
const CSpliced_seg ss,
const CSeq_loc parent_variation_loc 

◆ s_CalcPrecursorVariationCodon()

void variation_ref::CVariationUtil::s_CalcPrecursorVariationCodon ( const string codon_from,
const string prot_to,
vector< string > &  codons_to 

Definition at line 610 of file variation_util.cpp.

References ITERATE, s_CountMatches(), and s_UntranslateProt().

Referenced by x_ProtToPrecursor().

◆ s_CatLiterals()

CRef< CSeq_literal > variation_ref::CVariationUtil::s_CatLiterals ( const CSeq_literal a,
const CSeq_literal b 

◆ s_CollapseAmbiguities()

string variation_ref::CVariationUtil::s_CollapseAmbiguities ( const vector< string > &  seqs)

Definition at line 640 of file variation_util.cpp.

References eUnknown, i, ITERATE, and NCBI_THROW.

Referenced by x_ProtToPrecursor().

◆ s_CountMatches()

size_t variation_ref::CVariationUtil::s_CountMatches ( const string a,
const string b 

Definition at line 599 of file variation_util.cpp.

References a, b, i, and min().

Referenced by s_CalcPrecursorVariationCodon().

◆ s_FactorOutLocsInPlace()

void variation_ref::CVariationUtil::s_FactorOutLocsInPlace ( CVariation_ref v)

◆ s_PropagateLocsInPlace()

void variation_ref::CVariationUtil::s_PropagateLocsInPlace ( CVariation_ref v)

Propagate parent variation location to the members of set, unles they have their own location set.

(opposite of factor-out)

Definition at line 252 of file variation_util.cpp.

References CVariation_ref_Base::GetData(), CVariation_ref::GetLocation(), CVariation_ref_Base::C_Data::IsSet(), CVariation_ref::IsSetLocation(), NON_CONST_ITERATE, CVariation_ref_Base::SetData(), and CVariation_ref::SetLocation().

Referenced by ChangeToDelins(), CheckExonBoundary(), ProtToPrecursor(), Remap(), and SetVariantProperties().

◆ s_Remap()

void variation_ref::CVariationUtil::s_Remap ( CVariation_ref vr,
CSeq_loc_Mapper mapper,
const CSeq_loc parent_variation_loc 

◆ s_ResolveIntronicOffsets()

void variation_ref::CVariationUtil::s_ResolveIntronicOffsets ( CVariation_ref v,
const CSeq_loc parent_variation_loc 

◆ s_UntranslateProt()

void variation_ref::CVariationUtil::s_UntranslateProt ( const string prot_str,
vector< string > &  codons 

◆ SetReferenceSequence()

bool variation_ref::CVariationUtil::SetReferenceSequence ( CVariation_ref vr,
const CSeq_loc location 

◆ SetVariantProperties() [1/2]

void variation_ref::CVariationUtil::SetVariantProperties ( CVariantProperties prop,
const CSeq_loc orig_loc 

Set location-specific variant-properties.

Calculate location-specific categories.

Definition at line 1322 of file variation_util.cpp.

References CSeq_loc::Assign(), Compare(), CreateFlankLocs(), variation_ref::CVariationUtil::SFlankLocs::downstream, CSeqFeatData_Base::e_Cdregion, CSeqFeatData_Base::e_Gene, CSeqFeatData_Base::e_Rna, eExtreme_Biological, eExtreme_Positional, CVariantProperties_Base::eGene_location_acceptor, CVariantProperties_Base::eGene_location_conserved_noncoding, CVariantProperties_Base::eGene_location_donor, CVariantProperties_Base::eGene_location_in_gene, CVariantProperties_Base::eGene_location_in_start_codon, CVariantProperties_Base::eGene_location_in_stop_codon, CVariantProperties_Base::eGene_location_intergenic, CVariantProperties_Base::eGene_location_intron, CVariantProperties_Base::eGene_location_near_gene_3, CVariantProperties_Base::eGene_location_near_gene_5, CVariantProperties_Base::eGene_location_utr_3, CVariantProperties_Base::eGene_location_utr_5, CSeq_inst_Base::eMol_rna, eNa_strand_both, eNa_strand_minus, eNa_strand_plus, eNoOverlap, CSeqFeatData::eSubtype_mRNA, CSeq_loc::fMerge_SingleRange, GetBestCdsForMrna(), CScope::GetBioseqHandle(), CBioseq_Handle::GetBioseqMolType(), CVariantProperties_Base::GetGene_location(), CSeq_feat_Base::GetLocation(), CSeq_loc::GetStart(), CSeq_loc::GetStop(), GetStrand(), SAnnotSelector::IncludeFeatType(), CVariantProperties_Base::IsSetGene_location(), CVariantProperties_Base::IsSetVersion(), m_scope, m_variant_properties_schema_version, NULL, CConstRef< C, Locker >::Reset(), CVariantProperties_Base::ResetGene_location(), Seq_loc_Add(), CVariantProperties_Base::SetGene_location(), SAnnotSelector::SetIgnoreStrand(), SAnnotSelector::SetOverlapTotalRange(), CSeq_loc::SetStrand(), CVariantProperties_Base::SetVersion(), and variation_ref::CVariationUtil::SFlankLocs::upstream.

Referenced by SetVariantProperties().

◆ SetVariantProperties() [2/2]

void variation_ref::CVariationUtil::SetVariantProperties ( CVariation_ref vr)

Recursively iterate sub-variations: calculate location and variant properties for inst-type variations unless their observation-type is asserted or reference.

Calculate location properties on factored locations.

Precondition: root location must be set.

Definition at line 1602 of file variation_util.cpp.

References Begin(), CVariation_inst_Base::eObservation_variant, CVariation_ref_Base::GetData(), CVariation_ref::GetLocation(), CVariation_inst_Base::GetObservation(), CVariation_ref_Base::C_Data::IsInstance(), CVariation_ref::IsSetLocation(), CVariation_inst_Base::IsSetObservation(), s_FactorOutLocsInPlace(), s_PropagateLocsInPlace(), CVariation_ref_Base::SetData(), CVariation_ref_Base::SetVariant_prop(), SetVariantProperties(), and x_SetVariantProperties().

◆ x_GetLiteralAtLoc()

CRef< CSeq_literal > variation_ref::CVariationUtil::x_GetLiteralAtLoc ( const CSeq_loc loc)

◆ x_ProtToPrecursor()

void variation_ref::CVariationUtil::x_ProtToPrecursor ( CVariation_ref v)

◆ x_SetVariantProperties()

void variation_ref::CVariationUtil::x_SetVariantProperties ( CVariantProperties p,
const CVariation_inst vi,
const CSeq_loc loc 

◆ x_SetVariantPropertiesForIntronic()

void variation_ref::CVariationUtil::x_SetVariantPropertiesForIntronic ( CVariantProperties p,
int  offset,
const CSeq_loc loc,
CBioseq_Handle bsh 

Member Data Documentation

◆ m_scope

CRef<CScope> variation_ref::CVariationUtil::m_scope

◆ m_variant_properties_schema_version

const int variation_ref::CVariationUtil::m_variant_properties_schema_version = 1

The documentation for this class was generated from the following files:
Modified on Thu Dec 07 10:10:59 2023 by rev. 669887