TParent(seq_align, save_xcript)
56TCoord spaces (0), gaps (0), aln_len (0);
57 if(seq_align_segs.IsDenseg()) {
61 const CDense_seg& ds (seq_align_segs.GetDenseg());
64 for(
size_t i(0), dim (lens.size());
i< dim; ++
i) {
65 if(starts[2*
i] == -1 || starts[2*
i+1] == -1) {
72 else if(seq_align_segs.IsStd()) {
84 if(stdsegs.empty()) {
86 "CBlastTabular(): Cannot init off of an empty seq-align.");
93 if(locs.size() != 2) {
95 "Unexpected std-seg alignment");
100 if(
r0> 0 &&
r1> 0) {
107 if(
len[0] &&
len[1]) {
109ratio = (6*
len[0])/
len[1];
115}
else if(ratio < 12) {
116scale[0] = scale[1] = 1;
135 if(
delta[0] == 0) {
136 if(
delta[1] == 0) {
138 "CBlastTabular(): Empty std-segs not expected.");
142aln_len += increment;
147 else if(
delta[1] == 0) {
149aln_len += increment;
154aln_len +=
delta[0] / scale[0];
166 if(seq_align.
GetNamedScore(
"bit_score", score) ==
false) {
167score = 2.f * aln_len;
169SetScore(
float(score));
171 intraw_score = (
int)score;
173SetRawScore((TCoord)raw_score);
176 if(seq_align.
GetNamedScore(
"num_ident", matches) ==
false) {
177matches = aln_len - spaces;
179SetIdentity(
float(matches / aln_len));
183SetMismatches(aln_len - spaces - TCoord(matches));
186 if(seq_align.
GetNamedScore(
"e_value", evalue) ==
false) {
196 const CSeq_loc& row_loc (*locs[where]);
199 if(row_loc.
IsInt()) {
201 booldisc_seg_found (
false);
206disc_seg_found =
true;
208 delta[where] = 1 + row_start - row_stop;
209 prev[where] = row_stop;
215disc_seg_found =
true;
217 delta[where] = 1 + row_stop - row_start;
218 prev[where] = row_stop;
221 if(disc_seg_found) {
223 "CBlastTabular(): discontiguous std-segs not expected");
234 const TId& idsubj,
TCoordsstart,
boolsstrand,
235 const string& xcript):
236 TParent(idquery, qstart, qstrand, idsubj, sstart, sstrand, xcript)
243 switch(xcript[
i]) {
245 case 'M': ++matches; diag =
true;
break;
246 case 'I':
case 'D':
if(diag) {diag =
false; ++
m_Gaps; }
break;
258 classCLocalSeqIdCreator {
285 classCBestSeqIdExtractor {
288m_score_func(score_func) {}
322 const char* p0 = m8, *p = p0;
323 for(; *p &&
isspace((
unsigned char)(*p)); ++p);
324 for(p0 = p; *p && !
isspace((
unsigned char)(*p)); ++p);
326 const stringid1 (p0, p - p0);
327 m_Id.first = seq_id_extractor(id1);
330 for(; *p &&
isspace((
unsigned char)(*p)); ++p);
331 for(p0 = p; *p && !
isspace((
unsigned char)(*p)); ++p);
334 const stringid2 (p0, p - p0);
335 m_Id.second = seq_id_extractor(id2);
338 if(
m_Id.first.IsNull() ||
m_Id.second.IsNull()) {
341 "Unable to recognize sequence IDs in " 345 for(; *p &&
isspace((
unsigned char)(*p)); ++p);
474 doubleidentity100, evalue, score;
477>>
a>>
b>> c >> d >> evalue >> score;
479 if(iss.fail() ==
false) {
486 if(
a> 0 &&
b> 0 && c > 0 && d > 0) {
495 "Coordinates in m8 string are expected to be one-based: " 506 "Failed to init from m8 string: " 518 #ifdef ALGO_ALIGN_UTIL_BT_MM_INCLUDED 531 boolm =
false, mm =
false;
532 TCoordmcnt = 0, mmcnt = 0;
536 if(c ==
'D'|| c ==
'I') {
539matches += mcnt == 0? 1: mcnt;
543mismatches += mcnt == 0? 1: mmcnt;
547 else if(c ==
'M') {
551 else if(c ==
'R') {
555 else if(
'0'<= c && c <=
'9') {
557mcnt = 10*mcnt + c -
'0';
560mmcnt = 10*mmcnt + c -
'0';
565 "Unexpected transcript symbol.");
569matches += mcnt == 0? 1: mcnt;
572mismatches += mmcnt == 0? 1: mmcnt;
576 SetLength(matches + mismatches + indels);
584 const doublekq = double(trlen_new) / trlen_old;
595 const doublekq = double(query_span_new) / query_span_old;
TCoord GetQueryStart(void) const
TCoord GetSubjStop(void) const
std::pair< TId, TId > m_Id
static string s_RunLengthDecode(const string &in)
virtual void Modify(Uint1 point, TCoord new_pos)
TCoord GetSubjStart(void) const
void SetSubjStart(TCoord pos)
TCoord GetQueryStop(void) const
void SetQueryStart(TCoord pos)
void SetSubjStop(TCoord pos)
TCoord GetQuerySpan(void) const
const TTranscript & GetTranscript(void) const
void SetQueryStop(TCoord pos)
void SetMismatches(TCoord mismatches)
void SetLength(TCoord length)
float GetScore(void) const
void SetRawScore(TCoord score)
void SetEValue(double evalue)
void SetScore(float score)
virtual void Modify(Uint1 where, TCoord new_pos)
TCoord GetLength(void) const
TCoord GetGaps(void) const
virtual void x_PartialSerialize(CNcbiOstream &os) const
int(* SCORE_FUNC)(const CRef< objects::CSeq_id > &id)
Construct CBlastTabular from m8 line, use score_func to select seq-id from FASTA-style ids.
void SetIdentity(float identity)
float GetIdentity(void) const
virtual void x_PartialDeserialize(const char *m8)
TCoord GetMismatches(void) const
void x_Deserialize(const char *m8, F seq_id_extractor)
double GetEValue(void) const
static void sx_MineSegment(size_t where, const objects::CStd_seg::TLoc &locs, TSeqPos *delta, TSeqPos *prev)
TCoord GetRawScore(void) const
void SetGaps(TCoord gaps)
bool GetNamedScore(const string &id, int &score) const
Get score.
static DLIST_TYPE *DLIST_NAME() prev(DLIST_LIST_TYPE *list, DLIST_TYPE *item)
unsigned int TSeqPos
Type for sequence locations and lengths.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
static SIZE_TYPE ParseFastaIds(CBioseq::TId &ids, const CTempString &s, bool allow_partial_failure=false)
Parse an entire set of |-delimited FASTA-style IDs, appending the results to IDS.
ENa_strand GetStrand(void) const
Get the location's strand.
TSeqPos GetLength(const CSeq_id &id, CScope *scope)
Get sequence length if scope not null, else return max possible TSeqPos.
void Reset(void)
Reset reference object.
uint8_t Uint1
1-byte (8-bit) unsigned integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
C::value_type FindBestChoice(const C &container, F score_func)
Find the best choice (lowest score) for values in a container.
TStr & SetStr(void)
Select the variant.
vector< CRef< CSeq_loc > > TLoc
list< CRef< CStd_seg > > TStd
vector< TSignedSeqPos > TStarts
const TSegs & GetSegs(void) const
Get the Segs member data.
TFrom GetFrom(void) const
Get the From member data.
TLocal & SetLocal(void)
Select the variant.
TTo GetTo(void) const
Get the To member data.
bool IsInt(void) const
Check if variant Int is selected.
const TInt & GetInt(void) const
Get the variant data.
list< CRef< CSeq_id > > TId
unsigned int
A callback function used to compare two keys in a database.
#define F(x)
Make a parametrized function appear to have only one variable.
Useful/utility classes and methods.
Int4 delta(size_t dimension_, const Int4 *score_)
static const sljit_gpr r1
static const sljit_gpr r0
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4