Commit 3a59834b authored by Steffen Möller's avatar Steffen Möller
Browse files

New upstream version 1.2.15

parent d16e92cc
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
CFLAGS = -Wall -O3 -std=c99
LIBS = align.o alnfrags.o ankers.o assembly.o chain.o compdna.o compkmers.o compress.o decon.o ef.o filebuff.o frags.o hashmap.o hashmapindex.o hashmapkma.o hashmapkmers.o hashtable.o index.o kma.o kmapipe.o kmeranker.o kmerlink.o kmers.o kmmap.o loadupdate.o makeindex.o mt1.o nw.o pherror.o printconsensus.o qseqs.o qualcheck.o runinput.o runkma.o sam.o savekmers.o seq2fasta.o seqmenttree.o seqparse.o shm.o sparse.o spltdb.o stdnuc.o stdstat.o tmp.o update.o updateindex.o updatescores.o valueshash.o vcf.o
CFLAGS ?= -Wall -O3
CFLAGS += -std=c99
LIBS = align.o alnfrags.o ankers.o assembly.o chain.o compdna.o compkmers.o compress.o decon.o ef.o filebuff.o frags.o hashmap.o hashmapindex.o hashmapkma.o hashmapkmers.o hashtable.o index.o kma.o kmapipe.o kmeranker.o kmers.o kmmap.o loadupdate.o makeindex.o mt1.o nw.o pherror.o printconsensus.o qseqs.o qualcheck.o runinput.o runkma.o sam.o savekmers.o seq2fasta.o seqmenttree.o seqparse.o shm.o sparse.o spltdb.o stdnuc.o stdstat.o tmp.o update.o updateindex.o updatescores.o valueshash.o vcf.o
PROGS = kma kma_index kma_shm kma_update

.c .o:
@@ -8,16 +9,16 @@ PROGS = kma kma_index kma_shm kma_update
all: $(PROGS)

kma: main.c libkma.a
	$(CC) $(CFLAGS) -o $@ main.c libkma.a -lm -lpthread -lz
	$(CC) $(CFLAGS) -o $@ main.c libkma.a -lm -lpthread -lz $(LDFLAGS)

kma_index: kma_index.c libkma.a
	$(CC) $(CFLAGS) -o $@ kma_index.c libkma.a -lm -lz
	$(CC) $(CFLAGS) -o $@ kma_index.c libkma.a -lm -lz $(LDFLAGS)

kma_shm: kma_shm.c libkma.a
	$(CC) $(CFLAGS) -o $@ kma_shm.c libkma.a
	$(CC) $(CFLAGS) -o $@ kma_shm.c libkma.a $(LDFLAGS)

kma_update: kma_update.c libkma.a
	$(CC) $(CFLAGS) -o $@ kma_update.c libkma.a
	$(CC) $(CFLAGS) -o $@ kma_update.c libkma.a $(LDFLAGS)

libkma.a: $(LIBS)
	$(AR) -csru $@ $(LIBS)
@@ -46,7 +47,6 @@ index.o: index.h compress.h decon.h hashmap.h hashmapkma.h loadupdate.h makeinde
kma.o: kma.h ankers.h assembly.h chain.h hashmapkma.h kmers.h mt1.h penalties.h pherror.h qseqs.h runinput.h runkma.h savekmers.h sparse.h spltdb.h tmp.h version.h
kmapipe.o: kmapipe.h pherror.h
kmeranker.o: kmeranker.h penalties.h
kmerlink.o: kmerlink.h kmeranker.h
kmers.o: kmers.h ankers.h compdna.h hashmapkma.h kmapipe.h pherror.h qseqs.h savekmers.h spltdb.h
kmmap.o: kmmap.h hashmapkma.h
loadupdate.o: loadupdate.h pherror.h hashmap.h hashmapkma.h updateindex.h
+1 −1
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ cd kma && make
```

# Introduction #
KMA is mapping a method designed to map raw reads directly against redundant databases, in an 
KMA is a mapping method designed to map raw reads directly against redundant databases, in an 
ultra-fast manner using seed and extend. KMA is particulary good at aligning 
high quality reads against highly redundant databases, where unique matches often does 
not exist. It works for long low quality reads as well, such as those from Nanopore. 
+20 −9
Original line number Diff line number Diff line
@@ -237,9 +237,11 @@ AlnScore KMA(const HashMap_index *template_index, const unsigned char *qseq, int
		q_s = 0;
		q_e = i;
		if((q_e << 1) < t_e || (q_e + 64) < t_e) { // big leading template gap, cut down
			t_s = t_e - MIN(64, (q_e << 1));
			//t_s = t_e - MIN(64, (q_e << 1));
			t_s = t_e - (q_e + (q_e < 64 ? q_e : 64));
		} else if((t_e << 1) < q_e || (t_e + 64) < q_e) { // big leading query gap, cut down
			q_s = q_e - MIN(64, (t_e << 1));
			//q_s = q_e - MIN(64, (t_e << 1));
			q_s = q_e - (t_e + (t_e < 64 ? t_e : 64));
		}
		
		/* align */
@@ -249,7 +251,6 @@ AlnScore KMA(const HashMap_index *template_index, const unsigned char *qseq, int
				NWstat = NW(template_index->seq, qseq, -1 - (t_s == 0), t_s, t_e, q_s, q_e, Frag_align, matrices);
			} else {
				NWstat = NW_band(template_index->seq, qseq, -1 - (t_s == 0), t_s, t_e, q_s, q_e, Frag_align, band, matrices);
				/* here */
				//NWstat = NW(template_index->seq, qseq, -1 - (t_s == 0), t_s, t_e, q_s, q_e, Frag_align, matrices);
			}
			
@@ -366,9 +367,13 @@ AlnScore KMA(const HashMap_index *template_index, const unsigned char *qseq, int
	q_e = q_len;
	t_e = t_len;
	if(((q_len - q_s) << 1) < (t_len - t_s) || (q_len - q_s + 64) < (t_len - t_s)) { // big trailing template gap, cut down
		t_e = t_s + MIN(64, ((q_len - q_s) << 1));
		//t_e = t_s + MIN(64, ((q_len - q_s) << 1));
		t_e = q_len - q_s;
		t_e = t_s + (t_e + (t_e < 64 ? t_e : 64));
	} else if(((t_len - t_s) << 1) < (q_len - q_s) || (t_len - t_s + 64) < (q_len - q_s)) { // big leading query gap, cut down
		q_e = q_s + MIN(64, ((t_len - t_s) << 1));
		//q_e = q_s + MIN(64, ((t_len - t_s) << 1));
		q_e = t_len - t_s;
		q_e = q_s + (q_e + (q_e < 64 ? q_e : 64));
	}
	
	/* align trailing gap */
@@ -582,9 +587,11 @@ AlnScore KMA_score(const HashMap_index *template_index, const unsigned char *qse
		q_s = 0;
		q_e = i;
		if((q_e << 1) < t_e || (q_e + 64) < t_e) { // big leading template gap, cut down
			t_s = t_e - MIN(64, (q_e << 1));
			//t_s = t_e - MIN(64, (q_e << 1));
			t_s = t_e - (q_e + (q_e < 64 ? q_e : 64));
		} else if((t_e << 1) < q_e || (t_e + 64) < q_e) { // big leading query gap, cut down
			q_s = q_e - MIN(64, (t_e << 1));
			//q_s = q_e - MIN(64, (t_e << 1));
			q_s = q_e - (t_e + (t_e < 64 ? t_e : 64));
		}
		
		/* align */
@@ -675,9 +682,13 @@ AlnScore KMA_score(const HashMap_index *template_index, const unsigned char *qse
	q_e = q_len;
	t_e = t_len;
	if((t_len - t_s) > (q_len - q_s + 64) || (t_len - t_s) > ((q_len - q_s) << 1)) { // big trailing template gap, cut down
		t_e = t_s + MIN(64, ((q_len - q_s) << 1));
		//t_e = t_s + MIN(64, ((q_len - q_s) << 1));
		t_e = q_len - q_s;
		t_e = t_s + (t_e + (t_e < 64 ? t_e : 64));
	} else if ((q_len - q_s) > (t_len - t_s + 64) || (q_len - q_s) > ((t_len - t_s) << 1)) { // big leading query gap, cut down
		q_e = q_s + MIN(64, ((t_len - t_s) << 1));
		//q_e = q_s + MIN(64, ((t_len - t_s) << 1));
		q_e = t_len - t_s;
		q_e = q_s + (q_e + (q_e < 64 ? q_e : 64));
	}
	
	/* align trailing gap */
+32 −10
Original line number Diff line number Diff line
@@ -553,7 +553,7 @@ void * assemble_KMA_threaded(void *arg) {
								samwrite(qseq, header, 0, template_name, aligned, stats);
							}
							
						} else if(sam) {
						} else if(sam && !(sam & 2096)) {
							stats[1] = read_score;
							stats[2] = start;
							stats[3] = end;
@@ -567,7 +567,7 @@ void * assemble_KMA_threaded(void *arg) {
								samwrite(qseq, header, 0, template_name, 0, stats);
							}
						}
					} else if(sam) {
					} else if(sam && !(sam & 2096)) {
						stats[4] |= 4;
						stats[1] = stats[4];
						header->seq[header->len - 1] = 0;
@@ -599,6 +599,7 @@ void * assemble_KMA_threaded(void *arg) {
				++file_i;
			}
		}
		
		lock(excludeIn);
		--thread_wait;
		unlock(excludeIn);
@@ -618,6 +619,7 @@ void * assemble_KMA_threaded(void *arg) {
		
		return NULL;
	}
	
	/* diff */
	/* pre on dense */
	/* Pepare and make alignment on consensus */
@@ -697,7 +699,6 @@ void * assemble_KMA_threaded(void *arg) {
		pos = assembly[pos].next;
	}
	

	/* Trim alignment on consensus */
	coverScore = 0;
	bias = 0;
@@ -724,7 +725,6 @@ void * assemble_KMA_threaded(void *arg) {
	aligned_assem->depthVar = depthVar;
	aligned_assem->len = asm_len;
	aligned_assem->aln_len = aln_len;
	
	return NULL;
}

@@ -971,8 +971,7 @@ void * assemble_KMA_dense_threaded(void *arg) {
								header->seq[header->len - 1] = 0;
								samwrite(qseq, header, 0, template_name, aligned, stats);
							}
						} else if(sam) {
							/* here */
						} else if(sam && !(sam & 2096)) {
							stats[1] = read_score;
							stats[2] = start;
							stats[3] = end;
@@ -987,7 +986,7 @@ void * assemble_KMA_dense_threaded(void *arg) {
								samwrite(qseq, header, 0, template_name, 0, stats);
							}
						}
					} else if(sam) {
					} else if(sam && !(sam & 2096)) {
						stats[4] |= 4;
						stats[1] = stats[4];
						header->seq[header->len - 1] = 0;
@@ -1115,10 +1114,29 @@ void * assemble_KMA_dense_threaded(void *arg) {
	return NULL;
}

void skip_assemble_KMA(int template, int sam, int t_len, char *template_name, int file_count, FILE **files, Assem *aligned_assem, Qseqs *qseq, Qseqs *header) {
void * skip_assemble_KMA(void *arg) {
	
	Assemble_thread *thread = arg;
	int template, t_len, sam, nextTemplate, file_count, file_i, status;
	int stats[5], buffer[8];
	char *template_name;
	FILE *file, **files;
	Assem *aligned_assem;
	Qseqs *qseq, *header;
	
	int nextTemplate, file_i, status, stats[5], buffer[8];
	FILE *file;
	if((template = thread->template) < 0) {
		return NULL;
	}
	
	/* get input */
	sam = thread->sam;
	t_len = thread->template_index->len;
	template_name = thread->template_name;
	file_count = thread->file_count;
	files = thread->files;
	aligned_assem = thread->aligned_assem;
	qseq = thread->qseq;
	header = thread->header;
	
	aligned_assem->cover = 0;
	aligned_assem->depth = 0;
@@ -1188,4 +1206,8 @@ void skip_assemble_KMA(int template, int sam, int t_len, char *template_name, in
			++file_i;
		}
	}
	
	aligned_assem->cover = 0; 
	aligned_assem->aln_len = (1 - exp((-1.0) * aligned_assem->depth / t_len)) * t_len; // expected coverage from depth
	return NULL;
}
+1 −1
Original line number Diff line number Diff line
@@ -96,4 +96,4 @@ unsigned char nanoCaller(unsigned char bestNuc, unsigned char tNuc, int bestScor
unsigned char refNanoCaller(unsigned char bestNuc, unsigned char tNuc, int bestScore, int depthUpdate, double evalue, Assembly *calls);
void * assemble_KMA_threaded(void *arg);
void * assemble_KMA_dense_threaded(void *arg);
void skip_assemble_KMA(int template, int sam, int t_len, char *template_name, int file_count, FILE **files, Assem *aligned_assem, Qseqs *qseq, Qseqs *header);
void * skip_assemble_KMA(void *arg);
Loading