83 int phase = (prot_prev+1)%3;
89 int added_len =
min(3-phase,
len);
90 if (prev_not_intron_pos ==
m_protein.size()-1 && phase+added_len==3 && (phase==1 ||
m_protein[prev_not_intron_pos-1]==aa)) {
98 prot_prev += added_len;
104 const char* p =
buf.c_str();
128 size_t start_pos =
m_dna.size()-
len;
131 size_t prev_exon_pos = 0;
133 ((prev_exon_pos=
m_protein.find_last_not_of(is_insertion?INTRON:
INTRON_OR_GAP,start_pos-1))!=start_pos-1 ||
136 string codon =
m_dna.substr(prev_exon_pos-phase+1,phase)+
m_dna.substr(start_pos,3-phase);
138 for(
size_t i = prev_exon_pos-phase+1;
i<=prev_exon_pos;++
i) {
151 for ( ; start_pos+3 <=
m_dna.size(); start_pos += 3) {
157 if (start_pos <
m_dna.size()) {
194 const string& triplet)
196 return table.GetCodonResidue(
197 table.SetCodonState(triplet[0], triplet[1], triplet[2]));
201 bool prev_3_prime_splice,
bool cur_5_prime_splice,
203 int& nuc_prev,
int& prot_prev,
204 int nuc_cur_start,
int prot_cur_start)
210 int prot_hole_len = prot_cur_start - prot_prev -1;
211 int nuc_hole_len = nuc_cur_start - nuc_prev -1;
213 bool can_show_splices = prot_hole_len < nuc_hole_len -4;
214 if (can_show_splices && prev_3_prime_splice) {
216 nuc_hole_len = nuc_cur_start - nuc_prev -1;
218 if (can_show_splices && cur_5_prime_splice) {
220 nuc_hole_len = nuc_cur_start - nuc_prev -1;
224 _ASSERT( prot_hole_len>0 || nuc_hole_len>0 );
227 left_gap = (prot_hole_len-nuc_hole_len)/2;
232 if (prot_hole_len>nuc_hole_len)
238 left_gap = (nuc_hole_len-prot_hole_len)/2;
243 if (prot_hole_len<nuc_hole_len)
247 if (can_show_splices && cur_5_prime_splice) {
260 const string& matrix_name)
262 const CSpliced_seg& sps = seqalign.GetSegs().GetSpliced();
286 if (packed_mtx ==
NULL)
294 bool prev_3_prime_splice =
false;
295 int prev_genomic_ins = 0;
305 nuc_cur_start -= nuc_from;
306 nuc_cur_end -= nuc_from;
308 swap(nuc_cur_start,nuc_cur_end);
309 nuc_cur_start = nuc_to - nuc_cur_start;
310 nuc_cur_end = nuc_to - nuc_cur_end;
314 prot_prev+1 != prot_cur_start || !( (prev_3_prime_splice && cur_5_prime_splice) || (prot_cur_start==0 && nuc_cur_start==0) );
317 AddHoleText(prev_3_prime_splice, cur_5_prime_splice,
318 genomic_ci, protein_ci,
320 nuc_cur_start, prot_cur_start);
321 prev_genomic_ins = 0;
323 int intron_len = nuc_cur_start - nuc_prev -1;
339 prev_genomic_ins = 0;
365 if (0<=prot_prev && prot_prev<prot_len-1 && (prot_prev+1)%3==0)
369 prev_genomic_ins = (prev_genomic_ins+
len)%3;
373 _ASSERT(prot_prev <= prot_cur_end);
375 _ASSERT(prot_prev == prot_cur_end);
376 _ASSERT(nuc_prev == nuc_cur_end);
383 int nuc_cur_start = nuc_to - nuc_from +1;
384 int prot_cur_start = prot_len;
385 if (prot_prev+1 != prot_cur_start || nuc_prev+1 != nuc_cur_start) {
386 bool cur_5_prime_splice =
false;
387 AddHoleText(prev_3_prime_splice, cur_5_prime_splice,
388 genomic_ci, protein_ci,
390 nuc_cur_start, prot_cur_start);
404 if ((*b)->GetId() !=
NULL && (*b)->GetId()->Match(nucid)) {
411 genomic->
SetInt().SetFrom(0);
@ eExtreme_Positional
numerical value
USING_SCOPE(ncbi::objects)
static const CTrans_table & GetTransTable(int id)
SNCBIFullScoreMatrix m_matrix
void AddProtText(objects::CSeqVector_CI &protein_ci, int &prot_prev, int len)
static const char MATCH_CHAR
static const char INTRON_CHAR
static char TranslateTriplet(const objects::CTrans_table &table, const string &triplet)
static const char INTRON_OR_GAP[]
static const char SPACE_CHAR
const objects::CTrans_table * m_trans_table
static const char BAD_OR_MISMATCH[]
static const char MISMATCH_CHAR
void AddDNAText(objects::CSeqVector_CI &genomic_ci, int &nuc_prev, int len)
CProteinAlignText(objects::CScope &scope, const objects::CSeq_align &seqalign, const string &matrix_name="BLOSUM62")
void AddSpliceText(objects::CSeqVector_CI &genomic_ci, int &nuc_prev, char match)
void TranslateDNA(int phase, size_t len, bool is_insertion)
void AddHoleText(bool prev_3_prime_splice, bool cur_5_prime_splice, objects::CSeqVector_CI &genomic_ci, objects::CSeqVector_CI &protein_ci, int &nuc_prev, int &prot_prev, int nuc_cur_start, int prot_cur_start)
static CRef< objects::CSeq_loc > GetGenomicBounds(objects::CScope &scope, const objects::CSeq_align &seqalign)
void MatchText(size_t len, bool is_match=false)
static const char BAD_PIECE_CHAR
static const char POSIT_CHAR
static const char GAP_CHAR
Include a standard set of the NCBI C++ Toolkit most basic headers.
unsigned int TSeqPos
Type for sequence locations and lengths.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
void swap(NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair1, NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair2)
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
void SetPacked_int(TPacked_int &v)
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Override Assign() to incorporate cache invalidation.
TRange GetTotalRange(void) const
TSeqPos GetStart(ESeqLocExtremes ext) const
Return start and stop positions of the seq-loc.
const CSeq_id * GetId(void) const
Get the id of the location return NULL if has multiple ids or no id at all.
void SetStrand(ENa_strand strand)
Set the strand for all of the location's ranges.
void SetNull(void)
Override all setters to incorporate cache invalidation.
TSeqPos GetStop(ESeqLocExtremes ext) const
TSeqPos GetLength(const CSeq_id &id, CScope *scope)
Get sequence length if scope not null, else return max possible TSeqPos.
CRef< CSeq_loc > Seq_loc_Merge(const CSeq_loc &loc, CSeq_loc::TOpFlags flags, CScope *scope)
Merge ranges in the seq-loc.
const COrg_ref & GetOrg_ref(const CBioseq_Handle &handle)
Return the org-ref associated with a given sequence.
@ eCoding_Iupac
Set coding to printable coding (Iupacna or Iupacaa)
void GetSeqData(TSeqPos start, TSeqPos stop, string &buffer)
Fill the buffer string with the sequence data for the interval [start, stop).
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
NCBI_NS_STD::string::size_type SIZE_TYPE
TTo GetTo(void) const
Get the To member data.
TFrom GetFrom(void) const
Get the From member data.
const TDonor_after_exon & GetDonor_after_exon(void) const
Get the Donor_after_exon member data.
const TGenomic_id & GetGenomic_id(void) const
Get the Genomic_id member data.
bool CanGetAcceptor_before_exon(void) const
Check if it is safe to call GetAcceptor_before_exon method.
bool CanGetBases(void) const
Check if it is safe to call GetBases method.
bool CanGetBounds(void) const
Check if it is safe to call GetBounds method.
TMatch GetMatch(void) const
Get the variant data.
const TProduct_id & GetProduct_id(void) const
Get the Product_id member data.
TGenomic_start GetGenomic_start(void) const
Get the Genomic_start member data.
const TAcceptor_before_exon & GetAcceptor_before_exon(void) const
Get the Acceptor_before_exon member data.
bool IsMismatch(void) const
Check if variant Mismatch is selected.
TProduct_length GetProduct_length(void) const
Get the Product_length member data.
TDiag GetDiag(void) const
Get the variant data.
TMismatch GetMismatch(void) const
Get the variant data.
TGenomic_strand GetGenomic_strand(void) const
Get the Genomic_strand member data.
const TParts & GetParts(void) const
Get the Parts member data.
const TProduct_start & GetProduct_start(void) const
Get the Product_start member data.
const TProduct_end & GetProduct_end(void) const
Get the Product_end member data.
const TSpliced & GetSpliced(void) const
Get the variant data.
list< CRef< CSeq_loc > > TBounds
bool IsGenomic_ins(void) const
Check if variant Genomic_ins is selected.
bool IsMatch(void) const
Check if variant Match is selected.
TGenomic_ins GetGenomic_ins(void) const
Get the variant data.
list< CRef< CSpliced_exon > > TExons
const TExons & GetExons(void) const
Get the Exons member data.
bool IsDiag(void) const
Check if variant Diag is selected.
const TBases & GetBases(void) const
Get the Bases member data.
list< CRef< CSpliced_exon_chunk > > TParts
bool CanGetDonor_after_exon(void) const
Check if it is safe to call GetDonor_after_exon method.
TGenomic_end GetGenomic_end(void) const
Get the Genomic_end member data.
bool IsProduct_ins(void) const
Check if variant Product_ins is selected.
TProduct_ins GetProduct_ins(void) const
Get the variant data.
const TSegs & GetSegs(void) const
Get the Segs member data.
const TBounds & GetBounds(void) const
Get the Bounds member data.
ENa_strand
strand of nucleic acid
bool IsWhole(void) const
Check if variant Whole is selected.
<!DOCTYPE HTML >< html > n< header > n< title > PubSeq Gateway Help Page</title > n< style > n table
static int match(PCRE2_SPTR start_eptr, PCRE2_SPTR start_ecode, uint16_t top_bracket, PCRE2_SIZE frame_size, pcre2_match_data *match_data, match_block *mb)
const SNCBIPackedScoreMatrix * NCBISM_GetStandardMatrix(const char *name)
void NCBISM_Unpack(const SNCBIPackedScoreMatrix *psm, SNCBIFullScoreMatrix *fsm)
Expand a packed score matrix into an unpacked one, which callers can proceed to index directly by sta...