NCBI C++ ToolKit
Functions | Variables
cds_fix.cpp File Reference
#include <ncbi_pch.hpp>
#include <corelib/ncbistd.hpp>
#include <corelib/ncbiobj.hpp>
#include <objtools/edit/cds_fix.hpp>
#include <objtools/edit/loc_edit.hpp>
#include <objects/seq/Seq_descr.hpp>
#include <objects/seq/Seqdesc.hpp>
#include <objects/seq/Seq_inst.hpp>
#include <objects/general/Object_id.hpp>
#include <objects/seqfeat/Cdregion.hpp>
#include <objects/seqfeat/Code_break.hpp>
#include <objects/seqfeat/Imp_feat.hpp>
#include <objects/seqfeat/Org_ref.hpp>
#include <objects/seqfeat/RNA_ref.hpp>
#include <objects/seqfeat/SeqFeatXref.hpp>
#include <objects/seqfeat/seqfeat_macros.hpp>
#include <objects/seqfeat/Genetic_code_table.hpp>
#include <util/checksum.hpp>
#include <objmgr/bioseq_handle.hpp>
#include <objmgr/seqdesc_ci.hpp>
#include <objmgr/seq_annot_ci.hpp>
#include <util/sequtil/sequtil_convert.hpp>
#include <objmgr/util/sequence.hpp>
#include <objmgr/seq_vector.hpp>
#include <objects/general/Dbtag.hpp>
+ Include dependency graph for cds_fix.cpp:

Go to the source code of this file.

Go to the SVN repository for this file.

Functions

unsigned char GetCodeBreakCharacter (const CCode_break &cbr)
 
bool DoesCodingRegionHaveTerminalCodeBreak (const CCdregion &cdr)
 
TSeqPos GetLastPartialCodonLength (const CSeq_feat &cds, CScope &scope)
 
CRef< CSeq_locGetLastCodonLoc (const CSeq_feat &cds, CScope &scope)
 
bool AddTerminalCodeBreak (CSeq_feat &cds, CScope &scope)
 
bool DoesCodingRegionEndWithStopCodon (const CSeq_feat &cds, CScope &scope)
 
void ExtendStop (CSeq_loc &loc, TSeqPos len, CScope &scope)
 
TSeqPos ExtendLocationForTranslExcept (CSeq_loc &loc, CScope &scope)
 
bool IsOverhangOkForTerminalCodeBreak (const CSeq_feat &cds, CScope &scope, bool strict)
 
bool SetTranslExcept (CSeq_feat &cds, const string &comment, bool strict, bool extend, CScope &scope)
 SetTranslExcept A function to set a code break at the 3' end of a coding region to indicate that the stop codon is formed by the addition of a poly-A tail. More...
 
bool AdjustProteinMolInfoToMatchCDS (CMolInfo &molinfo, const CSeq_feat &cds)
 AdjustProteinMolInfoToMatchCDS A function to change an existing MolInfo to match a coding region. More...
 
bool AdjustProteinFeaturePartialsToMatchCDS (CSeq_feat &new_prot, const CSeq_feat &cds)
 AdjustProteinFeaturePartialsToMatchCDS A function to change an existing MolInfo to match a coding region. More...
 
bool AdjustForCDSPartials (const CSeq_feat &cds, CSeq_entry_Handle seh)
 AdjustForCDSPartials A function to make all of the necessary related changes to a Seq-entry after the partialness of a coding region has been changed. More...
 
string s_GetProductName (const CProt_ref &prot)
 
string s_GetProductName (const CSeq_feat &cds, CScope &scope)
 
string s_GetmRNAName (const CSeq_feat &mrna)
 
CRef< CSeq_featMakemRNAforCDS (const CSeq_feat &cds, CScope &scope)
 MakemRNAforCDS A function to create a CSeq_feat that represents the appropriate mRNA for a given CDS. More...
 
CConstRef< CSeq_featGetmRNAforCDS (const CSeq_feat &cds, CScope &scope)
 GetmRNAforCDS A function to find a CSeq_feat representing the appropriate mRNA for a given CDS. More...
 
CRef< CGenetic_codeGetGeneticCodeForBioseq (CBioseq_Handle bh)
 GetGeneticCodeForBioseq A function to construct the appropriate CGenetic_code object to use when constructing a coding region for a given Bioseq (if the default code should not be used). More...
 
static CRef< CSeq_locTruncateSeqLoc (const CSeq_loc &orig_loc, size_t new_len)
 
bool TruncateCDSAtStop (CSeq_feat &cds, CScope &scope)
 TruncateCDSAtStop A function to truncate a CDS location after the first stop codon in the protein translation. More...
 
bool ExtendCDSToStopCodon (CSeq_feat &cds, CScope &scope)
 ExtendCDSToStopCodon A function to extend a CDS location to the first in-frame stop codon in the protein translation. More...
 
void AdjustCDSFrameForStartChange (CCdregion &cds, int change)
 
bool DemoteCDSToNucSeq (CSeq_feat_Handle &orig_feat)
 
static string GetIdHash (const string &str)
 
string GetIdHashOrValue (const string &base, int offset)
 
CRef< CSeq_idGetNewLocalProtId (const string &id_base, CScope &scope, int &offset)
 
static CRef< CSeq_idGetNewGeneralProtId (const string &id_base, const string &db, CScope &scope, int &offset)
 
static CRef< CSeq_idGetGeneralOrLocal (CSeq_id_Handle hid, CScope &scope, int &offset, bool fall_through)
 
vector< CRef< CSeq_id > > GetNewProtIdFromExistingProt (CBioseq_Handle bsh, int &offset, string &id_label)
 
CRef< CSeq_idGetNewProtId (CBioseq_Handle bsh, int &offset, string &id_label, bool general_only)
 
bool IsGeneralIdProtPresent (CSeq_entry_Handle tse)
 

Variables

const unsigned int MAX_ID_LENGTH = 50
 

Function Documentation

◆ AddTerminalCodeBreak()

bool AddTerminalCodeBreak ( CSeq_feat cds,
CScope scope 
)

◆ AdjustCDSFrameForStartChange()

void AdjustCDSFrameForStartChange ( CCdregion cds,
int  change 
)

◆ AdjustProteinFeaturePartialsToMatchCDS()

bool AdjustProteinFeaturePartialsToMatchCDS ( CSeq_feat new_prot,
const CSeq_feat cds 
)

◆ DemoteCDSToNucSeq()

bool DemoteCDSToNucSeq ( CSeq_feat_Handle orig_feat)

◆ DoesCodingRegionEndWithStopCodon()

bool DoesCodingRegionEndWithStopCodon ( const CSeq_feat cds,
CScope scope 
)

Definition at line 177 of file cds_fix.cpp.

References NStr::EndsWith(), and CSeqTranslator::Translate().

Referenced by SetTranslExcept().

◆ DoesCodingRegionHaveTerminalCodeBreak()

bool DoesCodingRegionHaveTerminalCodeBreak ( const CCdregion cdr)

◆ ExtendCDSToStopCodon()

bool ExtendCDSToStopCodon ( CSeq_feat cds,
CScope scope 
)

ExtendCDSToStopCodon A function to extend a CDS location to the first in-frame stop codon in the protein translation.

Note that adjustments are not made to the protein sequence in this function, only the location and partialness of the coding region.

Parameters
cdsThe feature to adjust
scopeThe scope in which adjustments are to be made (if necessary)
Returns
true if stop codon was found, false otherwise

Definition at line 835 of file cds_fix.cpp.

References CSeq_loc::Add(), CSeq_loc::Assign(), CSeqVector::begin(), CBioseq_Handle::eCoding_Iupac, eExtreme_Biological, eExtreme_Positional, CCdregion_Base::eFrame_three, CCdregion_Base::eFrame_two, eNa_strand_minus, CScope::GetBioseqHandle(), CSeqFeatData_Base::GetCdregion(), CCdregion_Base::GetCode(), CTrans_table::GetCodonResidue(), CSeq_feat_Base::GetData(), CCdregion_Base::GetFrame(), CSeq_loc::GetId(), CBioseq_Handle::GetInst_Length(), GetLength(), CSeq_feat_Base::GetLocation(), CSeq_loc_CI::GetRangeAsSeq_loc(), CSeq_loc::GetStart(), CSeq_loc::GetStop(), CSeq_loc::GetStrand(), CGen_code_table::GetTransTable(), i, CSeqFeatData_Base::IsCdregion(), CCdregion_Base::IsSetCode(), CSeq_feat_Base::IsSetData(), CCdregion_Base::IsSetFrame(), CSeq_feat_Base::IsSetLocation(), CSeq_loc::IsSetStrand(), len, mod(), CTrans_table::NextCodonState(), CRef< C, Locker >::Reset(), SeqLocExtend(), CSeq_loc::SetInt(), CSeq_feat_Base::SetLocation(), CSeq_loc::SetPartialStop(), CSeq_loc::SetStrand(), and CSeqVector::size().

Referenced by BOOST_AUTO_TEST_CASE().

◆ ExtendLocationForTranslExcept()

TSeqPos ExtendLocationForTranslExcept ( CSeq_loc loc,
CScope scope 
)

◆ ExtendStop()

void ExtendStop ( CSeq_loc loc,
TSeqPos  len,
CScope scope 
)

◆ GetCodeBreakCharacter()

unsigned char GetCodeBreakCharacter ( const CCode_break cbr)

◆ GetGeneralOrLocal()

static CRef<CSeq_id> GetGeneralOrLocal ( CSeq_id_Handle  hid,
CScope scope,
int offset,
bool  fall_through 
)
static

◆ GetGeneticCodeForBioseq()

CRef<CGenetic_code> GetGeneticCodeForBioseq ( CBioseq_Handle  bh)

GetGeneticCodeForBioseq A function to construct the appropriate CGenetic_code object to use when constructing a coding region for a given Bioseq (if the default code should not be used).

Parameters
bhThe Bioseq_Handle of the nucleotide sequence on which the coding region is to be created.
Returns
CRef<CGenetic_code> for new CGenetic_code (will be NULL if default should be used)

Definition at line 707 of file cds_fix.cpp.

References CSeqdesc_Base::e_Source, CBioSource::GetGenCode(), CBioSource_Base::GetOrg(), CSeqdesc_Base::GetSource(), CBioSource_Base::IsSetOrg(), and COrg_ref_Base::IsSetOrgname().

Referenced by CBulkCDSAddPanel::AddOneCommand(), CAlignCDSAddPanel::AddOneCommand(), BOOST_AUTO_TEST_CASE(), CEditObjectSeq_feat::CreateWindowImpl(), CMacroFunction_ApplyCDS::TheFunction(), and CImportFeatTable::x_DoImportCDS().

◆ GetIdHash()

static string GetIdHash ( const string str)
inlinestatic

◆ GetIdHashOrValue()

string GetIdHashOrValue ( const string base,
int  offset 
)

◆ GetLastCodonLoc()

CRef<CSeq_loc> GetLastCodonLoc ( const CSeq_feat cds,
CScope scope 
)

◆ GetLastPartialCodonLength()

TSeqPos GetLastPartialCodonLength ( const CSeq_feat cds,
CScope scope 
)

◆ GetNewGeneralProtId()

static CRef<CSeq_id> GetNewGeneralProtId ( const string id_base,
const string db,
CScope scope,
int offset 
)
static

◆ GetNewLocalProtId()

CRef<CSeq_id> GetNewLocalProtId ( const string id_base,
CScope scope,
int offset 
)

◆ GetNewProtId()

CRef<CSeq_id> GetNewProtId ( CBioseq_Handle  bsh,
int offset,
string id_label,
bool  general_only 
)

◆ GetNewProtIdFromExistingProt()

vector<CRef<CSeq_id> > GetNewProtIdFromExistingProt ( CBioseq_Handle  bsh,
int offset,
string id_label 
)

◆ IsGeneralIdProtPresent()

bool IsGeneralIdProtPresent ( CSeq_entry_Handle  tse)

Definition at line 1298 of file cds_fix.cpp.

References CSeq_inst_Base::eMol_aa.

◆ IsOverhangOkForTerminalCodeBreak()

bool IsOverhangOkForTerminalCodeBreak ( const CSeq_feat cds,
CScope scope,
bool  strict 
)

Definition at line 271 of file cds_fix.cpp.

References CBioseq_Handle::eCoding_Iupac, GetLastCodonLoc(), GetLength(), and len.

Referenced by SetTranslExcept().

◆ MakemRNAforCDS()

CRef<CSeq_feat> MakemRNAforCDS ( const CSeq_feat cds,
CScope scope 
)

◆ s_GetmRNAName()

string s_GetmRNAName ( const CSeq_feat mrna)

◆ s_GetProductName() [1/2]

string s_GetProductName ( const CProt_ref prot)

Definition at line 472 of file cds_fix.cpp.

References kEmptyStr, and prot.

Referenced by MakemRNAforCDS(), and s_GetProductName().

◆ s_GetProductName() [2/2]

string s_GetProductName ( const CSeq_feat cds,
CScope scope 
)

◆ SetTranslExcept()

bool SetTranslExcept ( CSeq_feat cds,
const string comment,
bool  strict,
bool  extend,
CScope scope 
)

SetTranslExcept A function to set a code break at the 3' end of a coding region to indicate that the stop codon is formed by the addition of a poly-A tail.

Parameters
cdsThe coding region to be adjusted (if necessary)
commentThe string to place in the note on cds if a code break is added
strictOnly add code break if last partial codon consists of "TA" or just "T". If strict is false, add code break if first NT of last partial codon is T or N.
extendIf true, extend coding region to cover partial stop codon

Definition at line 304 of file cds_fix.cpp.

References AddTerminalCodeBreak(), DoesCodingRegionEndWithStopCodon(), DoesCodingRegionHaveTerminalCodeBreak(), eExtreme_Biological, ExtendLocationForTranslExcept(), NStr::Find(), CSeq_feat_Base::GetComment(), CSeq_feat_Base::GetData(), GetLastPartialCodonLength(), CSeq_feat_Base::GetLocation(), NStr::IsBlank(), CSeqFeatData_Base::IsCdregion(), IsOverhangOkForTerminalCodeBreak(), CSeq_loc::IsPartialStop(), CSeq_feat_Base::IsSetComment(), CSeq_feat_Base::IsSetData(), CSeq_feat_Base::SetComment(), CSeq_feat_Base::SetData(), and CSeq_feat_Base::SetLocation().

◆ TruncateCDSAtStop()

bool TruncateCDSAtStop ( CSeq_feat cds,
CScope scope 
)

TruncateCDSAtStop A function to truncate a CDS location after the first stop codon in the protein translation.

Note that adjustments are not made to the protein sequence in this function, only the location and partialness of the coding region.

Parameters
cdsThe feature to adjust
scopeThe scope in which adjustments are to be made (if necessary)
Returns
true if stop codon was found, false otherwise

Definition at line 786 of file cds_fix.cpp.

References eExtreme_Biological, CCdregion_Base::eFrame_three, CCdregion_Base::eFrame_two, NStr::Find(), CSeqFeatData_Base::GetCdregion(), CSeq_feat_Base::GetData(), CCdregion_Base::GetFrame(), CSeq_feat_Base::GetLocation(), CSeq_loc::IsPartialStart(), CCdregion_Base::IsSetFrame(), CSeq_feat_Base::ResetPartial(), CSeq_feat_Base::SetLocation(), CSeq_feat_Base::SetPartial(), CSeq_loc::SetPartialStart(), CSeq_loc::SetPartialStop(), CSeqTranslator::Translate(), CSeqTranslator::TranslateToProtein(), and TruncateSeqLoc().

Referenced by BOOST_AUTO_TEST_CASE(), CTruncateCDS::GetCommand(), and CRetranslateCDS::GetCommand().

◆ TruncateSeqLoc()

static CRef<CSeq_loc> TruncateSeqLoc ( const CSeq_loc orig_loc,
size_t  new_len 
)
static

Variable Documentation

◆ MAX_ID_LENGTH

const unsigned int MAX_ID_LENGTH = 50

Definition at line 1126 of file cds_fix.cpp.

Referenced by GetIdHashOrValue(), GetNewGeneralProtId(), and GetNewLocalProtId().

Modified on Sun Mar 03 03:12:02 2024 by modify_doxy.py rev. 669887