Skip to content

Commit 9b351fa

Browse files
y3tsengy3tseng
authored andcommitted
merge branch
2 parents 8716e95 + 2e15066 commit 9b351fa

File tree

14 files changed

+854
-1508
lines changed

14 files changed

+854
-1508
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
## <a name="intro"></a> Introduction
2222

23+
**\**This experimental version is still in development and has not been fully debugged. It may contain bugs. Please refer to the main branch for a stable version.\****
24+
2325
TWILIGHT (**T**all and **Wi**de A**lig**nments at **H**igh **T**hroughput) is a tool designed for ultrafast and ultralarge multiple sequence alignment. It is able to scale to millions of long nucleotide sequences (>10000 bases). TWILIGHT can run on CPU-only platforms (Linux/Mac) or take advantage of CUDA-capable GPUs for further acceleration.
2426

2527
By default, TWILIGHT requires an unaligned sequence file in FASTA format and an input guide tree in Newick format to generate the output alignment in FASTA format (Fig. 1a). When a guide tree is unavailable, users can utilize the iterative mode, which provides a Snakemake workflow to estimate guide trees using external tools (Fig 1b.).

src/TALCO-XDrop.cpp

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,17 @@ void Talco_xdrop::Traceback(
171171
ref_idx--;
172172
}
173173
aln.push_back(dir);
174+
if (firstTile && (ref_idx < 0 || query_idx < 0)) break;
175+
}
176+
if (firstTile) {
177+
while (ref_idx > -1) {
178+
aln.push_back(2);
179+
ref_idx--;
180+
}
181+
while (query_idx > -1) {
182+
aln.push_back(1);
183+
query_idx--;
184+
}
174185
}
175186
}
176187

@@ -215,8 +226,8 @@ void Talco_xdrop::Tile (
215226
// int8_t tb_state_marker = 0;
216227

217228
float denominator = refNum * qryNum;
218-
219229

230+
220231
int32_t L[3], U[3];
221232
int32_t *S[3], *I[2], *D[2];
222233
int32_t *CS[3], *CI[2], *CD[2];
@@ -330,10 +341,9 @@ void Talco_xdrop::Tile (
330341
int32_t offsetUp = L[k%3]-L[(k+2)%3]+offset;
331342
int32_t offsetLeft = L[k%3]-L[(k+2)%3]+offset-1;
332343

333-
334344

335345
if ((k==0) ||
336-
((offsetDiag >= 0) && (offsetDiag <= U[(k+1)%3]-L[(k+1)%3])) ||
346+
((offsetDiag >= 0) && (offsetDiag <= U[(k+1)%3]-L[(k+1)%3])) ||
337347
(tile == 0 && (i == 0 || j == 0 ))) {
338348
int32_t similarScore = 0;
339349
float numerator = 0;
@@ -345,10 +355,10 @@ void Talco_xdrop::Tile (
345355
}
346356
}
347357

348-
similarScore = static_cast<int32_t>(std::nearbyint(numerator/denominator));
349-
if (tile == 0 && (i == 0 || j == 0 )) match = similarScore + param.gapExtend * std::max(reference_idx + j, query_idx + i);
350-
else if (offsetDiag < 0) match = similarScore;
351-
else match = S[(k+1)%3][offsetDiag] + similarScore;
358+
similarScore = static_cast<int32_t>(roundeven(numerator/denominator));
359+
if (tile == 0 && (i == 0 || j == 0 )) match = similarScore + param.gapBoundary * std::max(reference_idx + j, query_idx + i);
360+
else if (offsetDiag < 0) match = similarScore;
361+
else match = S[(k+1)%3][offsetDiag] + similarScore;
352362
}
353363

354364
int32_t pos_gapOpen_ref = static_cast<int32_t>(std::nearbyint(gapOp[0][reference_idx+j]));
@@ -357,29 +367,24 @@ void Talco_xdrop::Tile (
357367
int32_t pos_gapExtend_qry = static_cast<int32_t>(std::nearbyint(gapEx[1][query_idx+i]));
358368

359369
if (query_idx + i == query.size() - 1) {
360-
pos_gapOpen_ref = param.gapExtend;
361-
pos_gapExtend_ref = param.gapExtend;
370+
pos_gapOpen_ref = param.gapBoundary;
371+
pos_gapExtend_ref = param.gapBoundary;
362372
}
363373
if (reference_idx + j == reference.size() - 1) {
364-
pos_gapOpen_qry = param.gapExtend;
365-
pos_gapExtend_qry = param.gapExtend;
374+
pos_gapOpen_qry = param.gapBoundary;
375+
pos_gapExtend_qry = param.gapBoundary;
366376
}
367-
377+
368378
if ((offsetUp >= 0) && (offsetUp <= U[(k+2)%3]-L[(k+2)%3])) {
369-
// delOp = S[(k+2)%3][offsetUp] + gapOpen;
370379
delOp = S[(k+2)%3][offsetUp] + pos_gapOpen_ref;
371-
// delExt = D[(k+1)%2][offsetUp] + gapExtend;
372380
delExt = D[(k+1)%2][offsetUp] + pos_gapExtend_ref;
373381
}
374382

375383
if ((offsetLeft >= 0) && (offsetLeft <= U[(k+2)%3]-L[(k+2)%3])) {
376-
// insOp = S[(k+2)%3][offsetLeft] + gapOpen;
377384
insOp = S[(k+2)%3][offsetLeft] + pos_gapOpen_qry;
378-
// insExt = I[(k+1)%2][offsetLeft] + gapExtend;
379385
insExt = I[(k+1)%2][offsetLeft] + pos_gapExtend_qry;
380386
}
381387

382-
383388
I[k%2][offset] = insOp;
384389
D[k%2][offset] = delOp;
385390

@@ -395,8 +400,8 @@ void Talco_xdrop::Tile (
395400
Dptr = true;
396401
}
397402

398-
if (match > I[k%2][offset]) {
399-
if (match > D[k%2][offset]) {
403+
if (match >= I[k%2][offset]) {
404+
if (match >= D[k%2][offset]) {
400405
S[k%3][offset] = match;
401406
ptr = 0;
402407
}
@@ -548,7 +553,7 @@ void Talco_xdrop::Tile (
548553
tb_start_ftr = (tb_state == 3) ? ftr_length.size() - 2: ftr_length.size() - 1;
549554
}
550555
}
551-
556+
552557
reference_idx += conv_ref_idx;
553558
query_idx += conv_query_idx;
554559

src/TALCO-XDrop.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,12 @@ namespace Talco_xdrop {
4040
struct Params {
4141
float scoreMatrix [5][5];
4242
float gapOpen;
43-
float gapClose;
43+
float gapBoundary;
4444
float gapExtend;
4545
int32_t xdrop;
4646
int32_t fLen;
4747
int32_t marker;
48+
int type;
4849

4950
void updateXDrop(int32_t new_xdrop) {
5051
this->xdrop = new_xdrop;
@@ -59,7 +60,7 @@ namespace Talco_xdrop {
5960
}
6061
this->gapOpen = t_param[25];
6162
this->gapExtend = t_param[26];
62-
this->gapClose = t_param[27];
63+
this->gapBoundary = t_param[27];
6364
this->xdrop = static_cast<int32_t> (1000 * -1 * t_param[26]);
6465
this->fLen = (1 << 12);
6566
this->marker = (1 << 10); //reduce this value to save memory

0 commit comments

Comments
 (0)