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

Search Toolkit Book for NSnp

NSnp –. More...

#include <objtools/snputil/snp_utils.hpp>

Public Types

enum  ELetterCase { eLetterCase_ForceLower , eLetterCase_Mixed }
 controls the case of strings returned from ClinSigAsString() More...
 
typedef CObject_id::TId8 TRsid
 
typedef CPhenotype::EClinical_significance EClinSigID
 
typedef int TClinSigID
 
typedef vector< stringTAlleles
 list of alleles belonging to particular SNP a deletion is represented by a "-" More...
 

Static Public Member Functions

static bool IsSnp (const CMappedFeat &mapped_feat)
 Determine if feature is a SNP. More...
 
static bool IsSnp (const CSeq_feat &feat)
 
static bool IsSnp (const CDbtag &tag)
 
static CConstRef< CDbtagGetTag (const CSeq_feat &SrcFeat)
 find a SNP tag in the feature returns NULL if no such tag (sm_dbTag_dbSNP) More...
 
static CConstRef< CDbtagGetTag (const CMappedFeat &SrcFeat)
 
static CTime GetCreateTime (const CMappedFeat &mapped_feat)
 Get Create Time It will fetch the creation time based on the CAnnotDescr of the feature's parent annotation object. More...
 
static TRsid GetRsid (const CMappedFeat &mapped_feat)
 Return rsid of SNP. More...
 
static TRsid GetRsid (const CSeq_feat &feat)
 Return rsid of SNP. More...
 
static TRsid GetRsid (const CDbtag &tag)
 
static int GetLength (const CMappedFeat &)
 Return distance of neighbors in flanking sequence. More...
 
static int GetLength (const CSeq_feat &)
 Return distance of neighbors in flanking sequence. More...
 
static CSnpBitfield GetBitfield (const CMappedFeat &)
 Return bitfield information stored in the feature. More...
 
static CSnpBitfield GetBitfield (const CSeq_feat &feat)
 Return bitfield information stored in the feature. More...
 
static bool IsSnpKnown (CScope &scope, const CMappedFeat &private_snp, const string &allele=kEmptyStr)
 Check if SNP exists in GenBank database. More...
 
static bool IsSnpKnown (CScope &scope, const CSeq_loc &loc, const string &allele=kEmptyStr)
 Check if SNP exists in GenBank database. More...
 
static void GetAlleles (const CMappedFeat &mapped_feat, TAlleles &Alleles)
 Return list of alleles encoded in qual. More...
 
static void GetAlleles (const CSeq_feat &feat, TAlleles &Alleles, bool isPadding=false, CBioseq_Handle *bsh=NULL)
 Return list of alleles encoded in qual. More...
 
static string ClinSigAsString (const CVariation_ref &var, ELetterCase LetterCase=eLetterCase_Mixed)
 get a human-readable text for various clinical significance types More...
 
static string ClinSigAsString (TClinSigID ClinSigID, ELetterCase LetterCase=eLetterCase_Mixed)
 get a human-readable text for various clinical significance types More...
 

Static Public Attributes

static const string sm_dbTag_dbSNP
 

Detailed Description

NSnp –.

Helper functions for SNP features

Definition at line 62 of file snp_utils.hpp.

Member Typedef Documentation

◆ EClinSigID

Definition at line 75 of file snp_utils.hpp.

◆ TAlleles

typedef vector<string> NSnp::TAlleles

list of alleles belonging to particular SNP a deletion is represented by a "-"

Definition at line 188 of file snp_utils.hpp.

◆ TClinSigID

Definition at line 76 of file snp_utils.hpp.

◆ TRsid

Definition at line 70 of file snp_utils.hpp.

Member Enumeration Documentation

◆ ELetterCase

controls the case of strings returned from ClinSigAsString()

Enumerator
eLetterCase_ForceLower 

always use lower case only

eLetterCase_Mixed 

return strings in mixes case

Definition at line 211 of file snp_utils.hpp.

Member Function Documentation

◆ ClinSigAsString() [1/2]

string NSnp::ClinSigAsString ( const CVariation_ref var,
ELetterCase  LetterCase = eLetterCase_Mixed 
)
static

get a human-readable text for various clinical significance types

Parameters
varthe clinical significance will be taken from var.phenotype.clinical-significance if it is defined
LetterCasecontrols the letter case of the result
Returns
string describing the first clinical significance in the first phenotype
  • will be empty if clinical-significance is not present

Definition at line 172 of file snp_utils.cpp.

References CVariation_ref_Base::GetPhenotype(), and ITERATE.

Referenced by NSnpGui::GetBinTooltip(), CSeq_featHandler::GetLabel(), and CGuiObjectInfoVariant::GetToolTip().

◆ ClinSigAsString() [2/2]

string NSnp::ClinSigAsString ( TClinSigID  ClinSigID,
ELetterCase  LetterCase = eLetterCase_Mixed 
)
static

◆ GetAlleles() [1/2]

void NSnp::GetAlleles ( const CMappedFeat mapped_feat,
TAlleles Alleles 
)
static

Return list of alleles encoded in qual.

"replace"

Parameters
mapped_featCMappedFeat object representing snp feature
Returns
  • list of alleles found in the feature (if any)

Definition at line 237 of file snp_utils.cpp.

References CMappedFeat::GetOriginalFeature().

Referenced by CFeatGlyph::GetAdditionalInfo(), CSeq_featHandler::GetLabel(), CGuiObjectInfoVariation::GetToolTip(), and NSNPVariationHelper::x_CommonConvertFeat().

◆ GetAlleles() [2/2]

void NSnp::GetAlleles ( const CSeq_feat feat,
TAlleles Alleles,
bool  isPadding = false,
CBioseq_Handle bsh = NULL 
)
static

Return list of alleles encoded in qual.

"replace"

Parameters
featCSeq_feat object representing snp feature
isPaddingif true, add allele padding according to VCF spec
bshmust be not NULL if isPadding == true
Returns
  • list of alleles found in the feature (if any)

Definition at line 242 of file snp_utils.cpp.

References CSeq_feat_Base::CanGetQual(), delta(), CBioseq_Handle::eCoding_Iupac, eExtreme_Positional, CSeq_feat_Base::GetLocation(), CGb_qual_Base::GetQual(), CSeq_feat_Base::GetQual(), CSeqVector::GetSeqData(), CSeq_loc::GetStart(), CSeq_loc::GetStop(), CGb_qual_Base::GetVal(), and ITERATE.

◆ GetBitfield() [1/2]

CSnpBitfield NSnp::GetBitfield ( const CMappedFeat mapped_feat)
static

Return bitfield information stored in the feature.

Parameters
mapped_featCMappedFeat object representing snp feature
Returns

Definition at line 220 of file snp_utils.cpp.

References CMappedFeat::GetOriginalFeature().

Referenced by NSNPVariationHelper::ConvertFeat(), GetLength(), CGuiObjectInfoVariation::GetToolTip(), and NSNPVariationHelper::x_CommonConvertFeat().

◆ GetBitfield() [2/2]

CSnpBitfield NSnp::GetBitfield ( const CSeq_feat feat)
static

Return bitfield information stored in the feature.

Parameters
mapped_featCSeq_feat object representing snp feature
Returns
  • bitfield created from octect sequence of QualityCodes
  • CSnpBitfield is empty if no "QualityCodes" are found

Definition at line 225 of file snp_utils.cpp.

References b, and IsSnp().

◆ GetCreateTime()

CTime NSnp::GetCreateTime ( const CMappedFeat mapped_feat)
static

Get Create Time It will fetch the creation time based on the CAnnotDescr of the feature's parent annotation object.

Parameters
mapped_featCMappedFeat object representing feature
Returns
  • CTime object representing Creation time. A default constructed CTime object will be returned if no Create-time was found.

Definition at line 88 of file snp_utils.cpp.

References CDate::AsCTime(), CAnnot_descr_Base::CanGet(), CAnnot_descr_Base::Get(), CSeq_feat_Handle::GetAnnot(), CAnnotdesc_Base::GetCreate_date(), CAnnotdesc_Base::IsCreate_date(), ITERATE, CSeq_annot_Handle::Seq_annot_CanGetDesc(), and CSeq_annot_Handle::Seq_annot_GetDesc().

◆ GetLength() [1/2]

int NSnp::GetLength ( const CMappedFeat mapped_feat)
static

Return distance of neighbors in flanking sequence.

Parameters
mapped_featCMappedFeat object representing feature
Returns
  • length of neighbors on flanking sequencer
  • 0 if no length information found

Definition at line 133 of file snp_utils.cpp.

References CMappedFeat::GetOriginalFeature().

Referenced by CSeq_featHandler::GetLabel().

◆ GetLength() [2/2]

int NSnp::GetLength ( const CSeq_feat feat)
static

Return distance of neighbors in flanking sequence.

Parameters
mapped_featCSeq_feat object representing feature
Returns
  • length of neighbors on flanking sequencer
  • 0 if no length information found

Definition at line 138 of file snp_utils.cpp.

References CSeq_feat_Base::CanGetLocation(), NStr::fConvErr_NoThrow, GetBitfield(), CUser_field_Base::GetData(), CSeq_feat_Base::GetExt(), CUser_object::GetFieldRef(), COpenRange< Position >::GetLength(), CSeq_feat_Base::GetLocation(), CUser_field_Base::C_Data::GetStr(), CSeq_loc::GetTotalRange(), CSeq_feat_Base::IsSetExt(), lc, NStr::Split(), NStr::SplitInTwo(), str(), and NStr::StringToInt().

◆ GetRsid() [1/3]

NSnp::TRsid NSnp::GetRsid ( const CDbtag tag)
static

Definition at line 122 of file snp_utils.cpp.

References tag.

◆ GetRsid() [2/3]

NSnp::TRsid NSnp::GetRsid ( const CMappedFeat mapped_feat)
static

Return rsid of SNP.

Parameters
mapped_featCMappedFeat object representing SNP feature
Returns
  • rsid of SNP as set in its Tag data
  • 0 if no rsid found

Definition at line 109 of file snp_utils.cpp.

References CMappedFeat::GetOriginalFeature().

Referenced by CLinkUtils::AddDbxrefLinksForSNP(), CSeq_featHandler::GetLabel(), CGuiObjectInfoVariation::GetLinks(), GetRsid(), CGuiObjectInfoVariation::GetToolTip(), NSearchFeatPanel::s_GetFeatureLabel(), and NSNPVariationHelper::x_CommonConvertFeat().

◆ GetRsid() [3/3]

NSnp::TRsid NSnp::GetRsid ( const CSeq_feat feat)
static

Return rsid of SNP.

Parameters
featCSeq_feat object representing SNP feature
Returns
  • rsid of SNP as set in its Tag data
  • 0 if no rsid found

Definition at line 114 of file snp_utils.cpp.

References GetRsid(), and GetTag().

◆ GetTag() [1/2]

CConstRef< CDbtag > NSnp::GetTag ( const CMappedFeat SrcFeat)
static

Definition at line 82 of file snp_utils.cpp.

References CMappedFeat::GetOriginalFeature(), and GetTag().

◆ GetTag() [2/2]

CConstRef< CDbtag > NSnp::GetTag ( const CSeq_feat SrcFeat)
static

find a SNP tag in the feature returns NULL if no such tag (sm_dbTag_dbSNP)

Definition at line 77 of file snp_utils.cpp.

References CSeq_feat::GetNamedDbxref(), and sm_dbTag_dbSNP.

Referenced by CFeatGlyph::GetHTMLActiveAreas(), GetRsid(), GetTag(), IsSnp(), and NSNPVariationHelper::x_CommonConvertFeat().

◆ IsSnp() [1/3]

bool NSnp::IsSnp ( const CDbtag tag)
static

Definition at line 72 of file snp_utils.cpp.

References CDbtag::eDbtagType_dbSNP, and tag.

◆ IsSnp() [2/3]

bool NSnp::IsSnp ( const CMappedFeat mapped_feat)
static

Determine if feature is a SNP.

Parameters
mapped_featCMappedFeat object representing feature
Returns
  • true if Subtype is variation
  • false otherwise

Definition at line 62 of file snp_utils.cpp.

References CMappedFeat::GetOriginalFeature().

Referenced by GetBitfield(), CGuiObjectInfoVariation::GetLinks(), CGuiObjectInfoVariation::GetToolTip(), IsSnp(), and NSNPVariationHelper::x_CommonConvertFeat().

◆ IsSnp() [3/3]

bool NSnp::IsSnp ( const CSeq_feat feat)
static

◆ IsSnpKnown() [1/2]

bool NSnp::IsSnpKnown ( CScope scope,
const CMappedFeat private_snp,
const string allele = kEmptyStr 
)
static

Check if SNP exists in GenBank database.

Parameters
scopeCScope object representing scope of data
mapped_featCMappedFeat object representing snp feature
allelestring object representing allele of SNP (e.g. A or GG or -)
Returns
  • true if SNP was found
  • false otherwise

Definition at line 282 of file snp_utils.cpp.

References CMappedFeat::GetLocation().

◆ IsSnpKnown() [2/2]

bool NSnp::IsSnpKnown ( CScope scope,
const CSeq_loc loc,
const string allele = kEmptyStr 
)
static

Member Data Documentation

◆ sm_dbTag_dbSNP

const string NSnp::sm_dbTag_dbSNP
static

Definition at line 67 of file snp_utils.hpp.

Referenced by GetTag().


The documentation for this class was generated from the following files:
Modified on Sat Dec 02 09:21:40 2023 by modify_doxy.py rev. 669887