Skip to content
Commits on Source (5)
......@@ -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;
......
......@@ -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 (1.2.16-1) unstable; urgency=medium
* Team upload.
* New upstream version
* Set upstream metadata fields: Repository.
-- Steffen Moeller <moeller@debian.org> Sat, 30 Nov 2019 16:00:16 +0100
kma (1.2.15-1) unstable; urgency=medium
* Team upload.
......
......@@ -10,8 +10,7 @@ Reference:
DOI: 10.1186/s12859-018-2336-6
PMID: 30157759
URL: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6116485/
eprint: "https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6116485/\
pdf/12859_2018_Article_2336.pdf"
eprint: "https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6116485/pdf/12859_2018_Article_2336.pdf"
Registry:
- Name: OMICtools
Entry: OMICS_31606
......@@ -19,3 +18,4 @@ Registry:
Entry: NA
- Name: conda:bioconda
Entry: kma
Repository: https://bitbucket.org/genomicepidemiology/kma
......@@ -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 {
......
......@@ -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;
......
......@@ -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;
}
}
}
......
......@@ -17,4 +17,4 @@
* limitations under the License.
*/
#define KMA_VERSION "1.2.15"
#define KMA_VERSION "1.2.16"