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

Steffen Möller gitlab at salsa.debian.org
Sat Nov 30 15:01:59 GMT 2019



Steffen Möller pushed to branch upstream at Debian Med / kma


Commits:
18e38cc7 by Steffen Moeller at 2019-11-30T15:00:12Z
New upstream version 1.2.16
- - - - -


6 changed files:

- align.c
- assembly.c
- kma.c
- main.c
- nw.c
- version.h


Changes:

=====================================
align.c
=====================================
@@ -601,6 +601,7 @@ AlnScore KMA_score(const HashMap_index *template_index, const unsigned char *qse
 				NWstat = NW_score(template_index->seq, qseq, -1 - (t_s == 0), t_s, t_e, q_s, q_e, matrices, t_len);
 			} else {
 				NWstat = NW_band_score(template_index->seq, qseq, -1 - (t_s == 0), t_s, t_e, q_s, q_e, band, matrices, t_len);
+				//NWstat = NW_score(template_index->seq, qseq, -1 - (t_s == 0), t_s, t_e, q_s, q_e, matrices, t_len);
 			}
 			Stat.pos -= (NWstat.len - NWstat.gaps);
 			Stat.score = NWstat.score;


=====================================
assembly.c
=====================================
@@ -18,6 +18,7 @@
 */
 #define _XOPEN_SOURCE 600
 #include <ctype.h>
+#include <limits.h>
 #include <math.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -167,7 +168,7 @@ unsigned char baseCaller(unsigned char bestNuc, unsigned char tNuc, int bestScor
 	} else {
 		/* Use MnNemars test to test significance of the base call */
 		if(significantBase(bestScore, depthUpdate - bestScore, evalue) == 0) {
-			if(bestNuc == '-' && tNuc != '-') {
+			if(bestNuc == '-' && tNuc != '-' && bestScore != depthUpdate) {
 				bestNuc = 'n';
 			} else {
 				bestNuc = tolower(bestNuc);
@@ -213,7 +214,7 @@ unsigned char nanoCaller(unsigned char bestNuc, unsigned char tNuc, int bestScor
 	} else {
 		/* Use MC Neymars test to test significance of the base call */
 		if(significantBase(bestScore, depthUpdate - bestScore, evalue) == 0) {
-			if(bestNuc == '-' && tNuc != '-') {
+			if(bestNuc == '-' && tNuc != '-' && bestScore != depthUpdate) {
 				bestBaseScore = 0;
 				for(j = 0; j < 5; ++j) {
 					if(bestBaseScore < calls->counts[j]) {
@@ -337,10 +338,7 @@ void * assemble_KMA_threaded(void *arg) {
 		if(matrix->size < (t_len << 1)) {
 			matrix->size = (t_len << 1);
 			free(matrix->assmb);
-			matrix->assmb = malloc(matrix->size * sizeof(Assembly));
-			if(!matrix->assmb) {
-				ERROR();
-			}
+			matrix->assmb = smalloc(matrix->size * sizeof(Assembly));
 		}
 		
 		/* cpy template seq */
@@ -473,7 +471,9 @@ void * assemble_KMA_threaded(void *arg) {
 							while(i < aln_len) {
 								if(aligned->t[i] == 5) { // Template gap, insertion
 									if(t_len <= pos) {
-										assembly[pos].counts[aligned->q[i]]++;
+										if(!++assembly[pos].counts[aligned->q[i]]) {
+											assembly[pos].counts[aligned->q[i]] = USHRT_MAX;
+										}
 										++i;
 										pos = assembly[pos].next;
 									} else {
@@ -517,8 +517,8 @@ void * assemble_KMA_threaded(void *arg) {
 											assembly[pos].counts[2] = 0;
 											assembly[pos].counts[3] = 0;
 											assembly[pos].counts[4] = 0;
-											assembly[pos].counts[5] = myBias;
-											assembly[pos].counts[aligned->q[i]]++;
+											assembly[pos].counts[5] = myBias < USHRT_MAX ? myBias : USHRT_MAX;
+											assembly[pos].counts[aligned->q[i]] = 1;
 											
 											++i;
 										}
@@ -528,7 +528,9 @@ void * assemble_KMA_threaded(void *arg) {
 									assembly[pos].counts[5]++;
 									pos = assembly[pos].next;
 								} else {
-									assembly[pos].counts[aligned->q[i]]++;
+									if(!++assembly[pos].counts[aligned->q[i]]) {
+										assembly[pos].counts[aligned->q[i]] = USHRT_MAX;
+									}
 									++i;
 									pos = assembly[pos].next;
 								}
@@ -651,10 +653,10 @@ void * assemble_KMA_threaded(void *arg) {
 		}
 		
 		/* call query */
-		bestNuc = 5;
-		bestScore = 0;
-		depthUpdate = 0;
-		for(j = 0; j < 6; ++j) {
+		bestNuc = 0;
+		bestScore = assembly[pos].counts[0];
+		depthUpdate = bestScore;
+		for(j = 1; j < 6; ++j) {
 			if(bestScore < assembly[pos].counts[j]) {
 				bestScore = assembly[pos].counts[j];
 				bestNuc = j;
@@ -666,9 +668,9 @@ void * assemble_KMA_threaded(void *arg) {
 		/* check for minor base call */
 		if((bestScore << 1) < depthUpdate) {
 			if(bestNuc == '-') {
-				bestBaseScore = 0;
+				bestBaseScore = assembly[pos].counts[4];
 				bestNuc = 4;
-				for(j = 0; j < 5; ++j) {
+				for(j = 0; j < 4; ++j) {
 					if(bestBaseScore < assembly[pos].counts[j]) {
 						bestBaseScore = assembly[pos].counts[j];
 						bestNuc = j;
@@ -948,7 +950,9 @@ void * assemble_KMA_dense_threaded(void *arg) {
 							/* diff */
 							for(i = 0, pos = start; i < aln_len; ++i) {
 								if(aligned->t[i] == aligned_assem->t[pos]) {
-									assembly[pos].counts[aligned->q[i]]++;
+									if(!++assembly[pos].counts[aligned->q[i]]) {
+										assembly[pos].counts[aligned->q[i]] = USHRT_MAX;	
+									}
 									pos = assembly[pos].next;
 								}
 							}


=====================================
kma.c
=====================================
@@ -164,6 +164,7 @@ static void helpMessage(int exeStatus) {
 	fprintf(helpOut, "#\t-transversion\tPenalty for transversion\t-2\n");
 	fprintf(helpOut, "#\t-cge\t\tSet CGE penalties and rewards\tFalse\n");
 	fprintf(helpOut, "#\t-t\t\tNumber of threads\t\t1\n");
+	fprintf(helpOut, "#\t-c\t\tCitation\n");
 	fprintf(helpOut, "#\t-v\t\tVersion\n");
 	fprintf(helpOut, "#\t-h\t\tShows this help message\n");
 	fprintf(helpOut, "#\n");
@@ -789,6 +790,9 @@ int kma_main(int argc, char *argv[]) {
 			} else if(strcmp(argv[args], "-v") == 0) {
 				fprintf(stdout, "KMA-%s\n", KMA_VERSION);
 				exit(0);
+			} else if(strcmp(argv[args], "-c") == 0) {
+				fprintf(stdout, "Philip T.L.C. Clausen, Frank M. Aarestrup & Ole Lund, \"Rapid and precise alignment of raw reads against redundant databases with KMA\", BMC Bioinformatics, 2018;19:307.\n");
+				exit(0);
 			} else if(strcmp(argv[args], "-h") == 0) {
 				helpMessage(0);
 			} else {


=====================================
main.c
=====================================
@@ -24,14 +24,18 @@
 #include "seq2fasta.h"
 #include "update.h"
 
-static int helpmessage() {
+static int helpmessage(FILE *out) {
 	
-	fprintf(stderr, "# For help please use:\n");
-	fprintf(stderr, "#\tkma -h\n");
-	fprintf(stderr, "#\tkma index -h\n");
-	fprintf(stderr, "#\tkma shm -h\n");
-	fprintf(stderr, "#\tkma seq2fasta -h\n");
-	fprintf(stderr, "#\tkma update -h\n");
+	fprintf(out, "# KMA enables alignment towards databases, using two k-mer mapping steps and one alignment step.\n");
+	fprintf(out, "# %16s\t%-32s\n", "Options are:", "Desc:");
+	fprintf(out, "# %16s\t%-32s\n", "", "Alignment and mapping");
+	fprintf(out, "# %16s\t%-32s\n", "index", "Indexing of databases");
+	fprintf(out, "# %16s\t%-32s\n", "shm", "Shared memory");
+	fprintf(out, "# %16s\t%-32s\n", "seq2fasta", "Conversion of database to fasta");
+	fprintf(out, "# %16s\t%-32s\n", "update", "Update database to current version");
+	fprintf(out, "# %16s\t%-32s\n", "-c", "Citation");
+	fprintf(out, "# %16s\t%-32s\n", "-v", "Version");
+	fprintf(out, "# %16s\t%-32s\n", "-h", "Help on alignment and mapping");
 	return 1;
 }
 
@@ -52,11 +56,10 @@ int main(int argc, char *argv[]) {
 			status = update_main(argc, argv);
 		} else {
 			fprintf(stderr, "Invalid option:\t%s\n", *argv);
-			status = helpmessage();
+			status = helpmessage(stderr);
 		}
 	} else {
-		fprintf(stderr, "Too few arguments handed\n");
-		status = helpmessage();
+		status = helpmessage(stdout);
 	}
 	
 	return status;


=====================================
nw.c
=====================================
@@ -556,7 +556,7 @@ AlnScore NW_band(const long unsigned *template, const unsigned char *queryOrg, i
 				Stat.score = D_prev[n];
 				pos[0] = 0;
 				pos[1] = n;
-				q_pos = n;
+				q_pos = n - en;
 			}
 		}
 	}


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



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

-- 
View it on GitLab: https://salsa.debian.org/med-team/kma/commit/18e38cc75163339bc44ef228180b9b1f62a3bee1
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/20191130/d3021994/attachment-0001.html>


More information about the debian-med-commit mailing list