Permalink
Browse files

r334: added pemerge to bwa

  • Loading branch information...
1 parent 773b863 commit 042e1f4442af7ddea66bc669c37e7bec9d2ded40 @lh3 committed Mar 7, 2013
Showing with 24 additions and 66 deletions.
  1. +1 −1 Makefile
  2. +0 −1 bntseq.c
  3. +23 −4 main.c
  4. +0 −28 main.h
  5. +0 −32 pemerge.c
View
@@ -5,7 +5,7 @@ AR= ar
DFLAGS= -DHAVE_PTHREAD #-D_NO_SSE2 #-D_FILE_OFFSET_BITS=64
LOBJS= utils.o kstring.o ksw.o bwt.o bntseq.o bwa.o bwamem.o bwamem_pair.o
AOBJS= QSufSort.o bwt_gen.o bwase.o bwaseqio.o bwtgap.o bwtaln.o bamlite.o \
- is.o bwtindex.o bwape.o kopen.o \
+ is.o bwtindex.o bwape.o kopen.o pemerge.o \
bwtsw2_core.o bwtsw2_main.o bwtsw2_aux.o bwt_lite.o \
bwtsw2_chain.o fastmap.o bwtsw2_pair.o
PROG= bwa bwamem-lite
View
@@ -31,7 +31,6 @@
#include <zlib.h>
#include <unistd.h>
#include "bntseq.h"
-#include "main.h"
#include "utils.h"
#include "kseq.h"
View
27 main.c
@@ -1,12 +1,29 @@
#include <stdio.h>
#include <string.h>
-#include "main.h"
#include "utils.h"
#ifndef PACKAGE_VERSION
-#define PACKAGE_VERSION "0.7.0-r332-beta"
+#define PACKAGE_VERSION "0.7.0-r334-beta"
#endif
+int bwa_fa2pac(int argc, char *argv[]);
+int bwa_pac2bwt(int argc, char *argv[]);
+int bwa_bwtupdate(int argc, char *argv[]);
+int bwa_bwt2sa(int argc, char *argv[]);
+int bwa_index(int argc, char *argv[]);
+int bwt_bwtgen_main(int argc, char *argv[]);
+
+int bwa_aln(int argc, char *argv[]);
+int bwa_sai2sam_se(int argc, char *argv[]);
+int bwa_sai2sam_pe(int argc, char *argv[]);
+
+int bwa_bwtsw2(int argc, char *argv[]);
+
+int main_fastmap(int argc, char *argv[]);
+int main_mem(int argc, char *argv[]);
+
+int main_pemerge(int argc, char *argv[]);
+
static int usage()
{
fprintf(stderr, "\n");
@@ -15,12 +32,13 @@ static int usage()
fprintf(stderr, "Contact: Heng Li <lh3@sanger.ac.uk>\n\n");
fprintf(stderr, "Usage: bwa <command> [options]\n\n");
fprintf(stderr, "Command: index index sequences in the FASTA format\n");
+ fprintf(stderr, " mem BWA-MEM algorithm\n");
+ fprintf(stderr, " fastmap identify super-maximal exact matches\n");
+ fprintf(stderr, " pemerge merge overlapping paired ends\n");
fprintf(stderr, " aln gapped/ungapped alignment\n");
fprintf(stderr, " samse generate alignment (single ended)\n");
fprintf(stderr, " sampe generate alignment (paired ended)\n");
fprintf(stderr, " bwasw BWA-SW for long queries\n");
- fprintf(stderr, " fastmap identify super-maximal exact matches\n");
- fprintf(stderr, " mem BWA-MEM algorithm\n");
fprintf(stderr, "\n");
fprintf(stderr, " fa2pac convert FASTA to PAC format\n");
fprintf(stderr, " pac2bwt generate BWT from PAC\n");
@@ -56,6 +74,7 @@ int main(int argc, char *argv[])
else if (strcmp(argv[1], "bwasw") == 0) ret = bwa_bwtsw2(argc-1, argv+1);
else if (strcmp(argv[1], "fastmap") == 0) ret = main_fastmap(argc-1, argv+1);
else if (strcmp(argv[1], "mem") == 0) ret = main_mem(argc-1, argv+1);
+ else if (strcmp(argv[1], "pemerge") == 0) ret = main_pemerge(argc-1, argv+1);
else {
fprintf(stderr, "[main] unrecognized command '%s'\n", argv[1]);
return 1;
View
28 main.h
@@ -1,28 +0,0 @@
-#ifndef BWA_MAIN_H
-#define BWA_MAIN_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- int bwa_fa2pac(int argc, char *argv[]);
- int bwa_pac2bwt(int argc, char *argv[]);
- int bwa_bwtupdate(int argc, char *argv[]);
- int bwa_bwt2sa(int argc, char *argv[]);
- int bwa_index(int argc, char *argv[]);
- int bwa_aln(int argc, char *argv[]);
- int bwt_bwtgen_main(int argc, char *argv[]);
-
- int bwa_sai2sam_se(int argc, char *argv[]);
- int bwa_sai2sam_pe(int argc, char *argv[]);
-
- int bwa_bwtsw2(int argc, char *argv[]);
-
- int main_fastmap(int argc, char *argv[]);
- int main_mem(int argc, char *argv[]);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
View
@@ -5,35 +5,8 @@
#include <zlib.h>
#include "ksw.h"
#include "kseq.h"
-
-#ifdef _PEM_MAIN
-KSEQ_INIT(gzFile, gzread)
-
-unsigned char nst_nt4_table[128] = {
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 /*'-'*/, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 0, 4, 1, 4, 4, 4, 2, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 0, 4, 1, 4, 4, 4, 2, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
-};
-
-void bwa_fill_scmat(int a, int b, int8_t mat[25])
-{
- int i, j, k;
- for (i = k = 0; i < 4; ++i) {
- for (j = 0; j < 4; ++j)
- mat[k++] = i == j? a : -b;
- mat[k++] = 0; // ambiguous base
- }
- for (j = 0; j < 5; ++j) mat[k++] = 0;
-}
-#else
#include "bwa.h"
KSEQ_DECLARE(gzFile)
-#endif
#define MAX_SCORE_RATIO 0.9f
#define MAX_ERR 8
@@ -183,11 +156,7 @@ static inline void print_seq(const char *n, const char *s, const char *q)
}
}
-#ifdef _PEM_MAIN
-int main(int argc, char *argv[])
-#else
int main_pemerge(int argc, char *argv[])
-#endif
{
int c, flag = 0, i;
int64_t cnt[MAX_ERR+1];
@@ -246,7 +215,6 @@ int main_pemerge(int argc, char *argv[])
} else {
++cnt[-l_seq];
if (flag & 2) {
- printf("*** %d\n", l_seq);
print_seq(r[0].n.s, r[0].s.s, r[0].q.l? r[0].q.s : 0);
print_seq(r[1].n.s, r[1].s.s, r[1].q.l? r[1].q.s : 0);
}

0 comments on commit 042e1f4

Please sign in to comment.