[med-svn] [Git][med-team/kma][upstream] New upstream version 1.3.14

Nilesh Patra gitlab at salsa.debian.org
Wed Apr 14 11:01:10 BST 2021



Nilesh Patra pushed to branch upstream at Debian Med / kma


Commits:
8e430e2c by Nilesh Patra at 2021-04-14T15:27:03+05:30
New upstream version 1.3.14
- - - - -


6 changed files:

- align.c
- chain.c
- chain.h
- kma.c
- nw.c
- version.h


Changes:

=====================================
align.c
=====================================
@@ -226,6 +226,9 @@ AlnScore KMA(const HashMapCCI *template_index, const unsigned char *qseq, int q_
 		return Stat;
 	}
 	
+	/* trim seeds */
+	trimSeeds(points, start);
+	
 	/* initialize */
 	Stat.len = 0;
 	Stat.score = 0;


=====================================
chain.c
=====================================
@@ -137,12 +137,13 @@ int chainSeeds(AlnPoints *points, int q_len, int t_len, int kmersize, unsigned *
 						MMs = Ms / kmersize + (Ms % kmersize ? 1 : 0);
 						MMs = MAX(2, MMs);
 						Ms = MIN(Ms - MMs, kmersize);
+						Ms = MIN(Ms, MMs);
 					}
 					
 					gap += weight + points->score[j] + Ms * M + MMs * MM;
 					
 					/* check if score is max */
-					if(score < gap) {
+					if(score <= gap) {
 						score = gap;
 						points->next[i] = j;
 					}
@@ -194,14 +195,12 @@ int chainSeeds(AlnPoints *points, int q_len, int t_len, int kmersize, unsigned *
 		points->score[i] = score;
 		
 		/* update bestScore */
-		if(bestScore < score) {
+		if(bestScore <= score) {
 			if(points->next[i] != bestPos) {
 				secondScore = bestScore;
 			}
 			bestScore = score;
 			bestPos = i;
-		} else if(bestScore == score && points->next[i] != bestPos) {
-			secondScore = bestScore;
 		}
 	}
 	/* calculate mapping quality */
@@ -284,12 +283,13 @@ int chainSeeds_circular(AlnPoints *points, int q_len, int t_len, int kmersize, u
 						MMs = Ms / kmersize + (Ms % kmersize ? 1 : 0);
 						MMs = MAX(2, MMs);
 						Ms = MIN(Ms - MMs, kmersize);
+						Ms = MIN(Ms, MMs);
 					}
 					
 					gap += weight + points->score[j] + Ms * M + MMs * MM;
 					
 					/* check if score is max */
-					if(score < gap) {
+					if(score <= gap) {
 						score = gap;
 						points->next[i] = j;
 					}
@@ -327,6 +327,7 @@ int chainSeeds_circular(AlnPoints *points, int q_len, int t_len, int kmersize, u
 						MMs = Ms / kmersize + (Ms % kmersize ? 1 : 0);
 						MMs = MAX(2, MMs);
 						Ms = MIN(Ms - MMs, kmersize);
+						Ms = MIN(Ms, MMs);
 					}
 					
 					gap += weight + points->score[j] + Ms * M + MMs * MM;
@@ -353,7 +354,7 @@ int chainSeeds_circular(AlnPoints *points, int q_len, int t_len, int kmersize, u
 					gap += (weight + points->score[j] - (tStart - tEnd) * M);
 					
 					/* check if score is max */
-					if(score < gap) {
+					if(score <= gap) {
 						score = gap;
 						points->next[i] = j;
 					}
@@ -390,14 +391,12 @@ int chainSeeds_circular(AlnPoints *points, int q_len, int t_len, int kmersize, u
 		points->score[i] = score;
 		
 		/* update bestScore */
-		if(bestScore < score) {
+		if(bestScore <= score) {
 			if(points->next[i] != bestPos) {
 				secondScore = bestScore;
 			}
 			bestScore = score;
 			bestPos = i;
-		} else if(bestScore == score && points->next[i] != bestPos) {
-			secondScore = bestScore;
 		}
 	}
 	/* calculate mapping quality */
@@ -417,3 +416,31 @@ int chainSeeds_circular(AlnPoints *points, int q_len, int t_len, int kmersize, u
 	
 	return bestPos;
 }
+
+void trimSeeds(AlnPoints *points, int start) {
+	
+	/* trim the start of each seed */
+	static int ts = 0;
+	int len;
+	
+	if(!points) {
+		ts = start;
+		return;
+	} else if(!ts) {
+		return;
+	}
+	
+	/* iterate seeds on best chain */
+	do {
+		/* trim seed */
+		len = points->qEnd[start] - points->qStart[start];
+		if(len < ts) {
+			/* ensure at least one nucleotide remains in seed */
+			points->tStart[start] += --len;
+			points->qStart[start] += len;
+		} else {
+			points->tStart[start] += ts;
+			points->qStart[start] += ts;
+		}
+	} while((start = points->next[start]));
+}


=====================================
chain.h
=====================================
@@ -45,3 +45,4 @@ void seedPoint_realloc(AlnPoints *dest, int size);
 void seedPoint_free(AlnPoints *src);
 int chainSeeds(AlnPoints *points, int q_len, int t_len, int kmersize, unsigned *mapQ);
 int chainSeeds_circular(AlnPoints *points, int q_len, int t_len, int kmersize, unsigned *mapQ);
+void trimSeeds(AlnPoints *points, int start);


=====================================
kma.c
=====================================
@@ -113,6 +113,7 @@ static void helpMessage(int exeStatus) {
 	fprintf(helpOut, "#\t-ipe\t\tInput paired end file name(s)\n");
 	fprintf(helpOut, "#\t-int\t\tInput interleaved file name(s)\n");
 	fprintf(helpOut, "#\t-k\t\tKmersize\t\t\t%s\n", "DB defined");
+	fprintf(helpOut, "#\t-ts\t\tTrim front of seeds with ts\t%d\n", 0);
 	fprintf(helpOut, "#\t-ml\t\tMinimum alignment length\t%d\n", 16);
 	fprintf(helpOut, "#\t-p\t\tp-value\t\t\t\t0.05\n");
 	fprintf(helpOut, "#\t-ConClave\tConClave version\t\t1\n");
@@ -203,7 +204,7 @@ int kma_main(int argc, char *argv[]) {
 	static int fileCounter, fileCounter_PE, fileCounter_INT, Ts, Tv, minlen;
 	static int extendedFeatures, spltDB, thread_num, kmersize, targetNum, mq;
 	static int ref_fsa, print_matrix, print_all, sam, vcf, Mt1, bcd, one2one;
-	static int sparse_run, **d, status = 0;
+	static int sparse_run, ts, **d, status = 0;
 	static unsigned xml, nc, nf, shm, exhaustive, verbose;
 	static char *outputfilename, *templatefilename, **templatefilenames;
 	static char **inputfiles, **inputfiles_PE, **inputfiles_INT, ss;
@@ -251,6 +252,7 @@ int kma_main(int argc, char *argv[]) {
 		print_all = 0;
 		ref_fsa = 0;
 		kmersize = 0;
+		ts = 0;
 		minlen = 16;
 		evalue = 0.05;
 		support = 0.0;
@@ -504,6 +506,15 @@ int kma_main(int argc, char *argv[]) {
 						exit(1);
 					}
 				}
+			} else if(strcmp(argv[args], "-ts") == 0) {
+				++args;
+				if(args < argc) {
+					ts = strtoul(argv[args], &exeBasic, 10);
+					if(*exeBasic != 0 || ts < 0 || ts > 30) {
+						fprintf(stderr, "# Invalid seed trim parsed\n");
+						exit(1);
+					}
+				}
 			} else if(strcmp(argv[args], "-ml") == 0) {
 				++args;
 				if(args < argc) {
@@ -969,6 +980,7 @@ int kma_main(int argc, char *argv[]) {
 			++args;
 		}
 		preseed(0, 0, exhaustive);
+		trimSeeds(0, ts);
 		
 		if(sam && kmaPipe != &kmaPipeThread) {
 			fprintf(stderr, "\"-sam\" and \"-status\" cannot coincide.\n");


=====================================
nw.c
=====================================
@@ -183,8 +183,8 @@ AlnScore NW(const long unsigned *template, const unsigned char *queryOrg, int k,
 			thisScore = Q_prev + U;
 			if(Q < thisScore) {
 				Q = thisScore;
-				if(e == 2) {
-					D_ptr[n] = Q;
+				if(D_ptr[n] <= thisScore) {
+					D_ptr[n] = thisScore;
 					e = 3;
 				}
 			} else {
@@ -193,7 +193,7 @@ AlnScore NW(const long unsigned *template, const unsigned char *queryOrg, int k,
 			thisScore = P_prev[n] + U;
 			if(P_ptr[n] < thisScore) {
 				P_ptr[n] = thisScore;
-				if(D_ptr[n] < thisScore) {
+				if(D_ptr[n] <= thisScore) {
 					D_ptr[n] = thisScore;
 					e = 5;
 				}
@@ -483,8 +483,8 @@ AlnScore NW_band(const long unsigned *template, const unsigned char *queryOrg, i
 			thisScore = Q_prev + U;
 			if(Q < thisScore) {
 				Q = thisScore;
-				if(e == 2) {
-					D_ptr[n] = Q;
+				if(D_ptr[n] <= thisScore) {
+					D_ptr[n] = thisScore;
 					e = 3;
 				}
 			} else {
@@ -493,7 +493,7 @@ AlnScore NW_band(const long unsigned *template, const unsigned char *queryOrg, i
 			thisScore = P_prev[n - 1] + U;
 			if(P_ptr[n] < thisScore) {
 				P_ptr[n] = thisScore;
-				if(D_ptr[n] < thisScore) {
+				if(D_ptr[n] <= thisScore) {
 					D_ptr[n] = thisScore;
 					e = 5;
 				}
@@ -784,8 +784,8 @@ AlnScore NW_score(const long unsigned *template, const unsigned char *queryOrg,
 			thisScore = Q_prev + U;
 			if(Q < thisScore) {
 				Q = thisScore;
-				if(e == 2) {
-					D_ptr[n] = Q;
+				if(D_ptr[n] <= thisScore) {
+					D_ptr[n] = thisScore;
 					e = 3;
 				}
 			} else {
@@ -794,7 +794,7 @@ AlnScore NW_score(const long unsigned *template, const unsigned char *queryOrg,
 			thisScore = P_prev[n] + U;
 			if(P_ptr[n] < thisScore) {
 				P_ptr[n] = thisScore;
-				if(D_ptr[n] < thisScore) {
+				if(D_ptr[n] <= thisScore) {
 					D_ptr[n] = thisScore;
 					e = 5;
 				}
@@ -1049,8 +1049,8 @@ AlnScore NW_band_score(const long unsigned *template, const unsigned char *query
 			thisScore = Q_prev + U;
 			if(Q < thisScore) {
 				Q = thisScore;
-				if(e == 2) {
-					D_ptr[n] = Q;
+				if(D_ptr[n] <= thisScore) {
+					D_ptr[n] = thisScore;
 					e = 3;
 				}
 			} else {
@@ -1059,7 +1059,7 @@ AlnScore NW_band_score(const long unsigned *template, const unsigned char *query
 			thisScore = P_prev[n - 1] + U;
 			if(P_ptr[n] < thisScore) {
 				P_ptr[n] = thisScore;
-				if(D_ptr[n] < thisScore) {
+				if(D_ptr[n] <= thisScore) {
 					D_ptr[n] = thisScore;
 					e = 5;
 				}


=====================================
version.h
=====================================
@@ -17,4 +17,4 @@
  * limitations under the License.
 */
 
-#define KMA_VERSION "1.3.13"
+#define KMA_VERSION "1.3.14"



View it on GitLab: https://salsa.debian.org/med-team/kma/-/commit/8e430e2ca0158e260b1ca99993f2d5fb0f1cc72d

-- 
View it on GitLab: https://salsa.debian.org/med-team/kma/-/commit/8e430e2ca0158e260b1ca99993f2d5fb0f1cc72d
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20210414/fd63199b/attachment-0001.htm>


More information about the debian-med-commit mailing list