r806: polish BAM support

This commit is contained in:
Heng Li 2014-08-08 13:36:56 -04:00
parent 8a230db596
commit 1de61b556e
5 changed files with 20 additions and 18 deletions

View File

@ -2,10 +2,9 @@ CC= gcc
#CC= clang --analyze
CFLAGS= -g -Wall -Wno-unused-function -O2
WRAP_MALLOC=-DUSE_MALLOC_WRAPPERS
# set to 1 if you wish to have bam support, type 'make clean; make all'
USE_HTSLIB=0
HTSLIB_PATH=
AR= ar
DFLAGS= -DHAVE_PTHREAD $(WRAP_MALLOC)
DFLAGS= -DHAVE_PTHREAD $(WRAP_MALLOC)
LOBJS= utils.o kthread.o kstring.o ksw.o bwt.o bntseq.o bwa.o bwamem.o bwamem_pair.o bwamem_extra.o malloc_wrap.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 pemerge.o \
@ -13,14 +12,14 @@ AOBJS= QSufSort.o bwt_gen.o bwase.o bwaseqio.o bwtgap.o bwtaln.o bamlite.o \
bwtsw2_chain.o fastmap.o bwtsw2_pair.o
PROG= bwa
INCLUDES=
LIBS= -lm -lz -lpthread
LIBS= -lm -lz -lpthread
SUBDIRS= .
.SUFFIXES:.c .o .cc
.c.o:
ifeq ($(USE_HTSLIB),1)
$(CC) -c $(CFLAGS) $(DFLAGS) -DUSE_HTSLIB $(INCLUDES) -I ../htslib $< -o $@
ifneq ($(HTSLIB_PATH),)
$(CC) -c $(CFLAGS) $(DFLAGS) -DUSE_HTSLIB $(INCLUDES) -I$(HTSLIB_PATH) $< -o $@
else
$(CC) -c $(CFLAGS) $(DFLAGS) $(INCLUDES) $< -o $@
endif
@ -28,15 +27,15 @@ endif
all:$(PROG)
bwa:libbwa.a $(AOBJS) main.o
ifeq ($(USE_HTSLIB),1)
$(CC) $(CFLAGS) $(DFLAGS) $(AOBJS) main.o -o $@ ../htslib/libhts.a -L. -L../htslib -lbwa $(LIBS)
ifneq ($(HTSLIB_PATH),)
$(CC) $(CFLAGS) $(DFLAGS) $(AOBJS) main.o -o $@ $(HTSLIB_PATH)/libhts.a -L. -lbwa $(LIBS)
else
$(CC) $(CFLAGS) $(DFLAGS) $(AOBJS) main.o -o $@ -L. -lbwa $(LIBS)
endif
bwamem-lite:libbwa.a example.o
ifeq ($(USE_HTSLIB),1)
$(CC) $(CFLAGS) $(DFLAGS) example.o -o $@ ../htslib/libhts.a -L. -L../htslib -lbwa $(LIBS)
ifneq ($(HTSLIB_PATH),)
$(CC) $(CFLAGS) $(DFLAGS) example.o -o $@ $(HTSLIB_PATH)/libhts.a -L. -lbwa $(LIBS)
else
$(CC) $(CFLAGS) $(DFLAGS) example.o -o $@ -L. -lbwa $(LIBS)
endif

View File

@ -1125,7 +1125,7 @@ static void worker2(void *data, int i, int tid)
}
}
void mem_process_seqs(const mem_opt_t *opt, const bwt_t *bwt, const bntseq_t *bns, const uint8_t *pac, int64_t n_processed, int n, bseq1_t *seqs, const mem_pestat_t *pes0, bam_hdr_t *h)
void mem_process_seqs2(const mem_opt_t *opt, const bwt_t *bwt, const bntseq_t *bns, const uint8_t *pac, int64_t n_processed, int n, bseq1_t *seqs, const mem_pestat_t *pes0, bam_hdr_t *h)
{
extern void kt_for(int n_threads, void (*func)(void*,int,int), void *data, int n);
worker_t w;
@ -1157,3 +1157,8 @@ void mem_process_seqs(const mem_opt_t *opt, const bwt_t *bwt, const bntseq_t *bn
if (bwa_verbose >= 3)
fprintf(stderr, "[M::%s] Processed %d reads in %.3f CPU sec, %.3f real sec\n", __func__, n, cputime() - ctime, realtime() - rtime);
}
void mem_process_seqs(const mem_opt_t *opt, const bwt_t *bwt, const bntseq_t *bns, const uint8_t *pac, int64_t n_processed, int n, bseq1_t *seqs, const mem_pestat_t *pes0)
{
mem_process_seqs2(opt, bwt, bns, pac, n_processed, n, seqs, pes0, 0);
}

View File

@ -128,7 +128,8 @@ extern "C" {
* corresponding to each FF, FR, RF and RR orientation. See mem_pestat() for more info.
* @param h the BAM header, NULL if not using HTSLIB
*/
void mem_process_seqs(const mem_opt_t *opt, const bwt_t *bwt, const bntseq_t *bns, const uint8_t *pac, int64_t n_processed, int n, bseq1_t *seqs, const mem_pestat_t *pes0, bam_hdr_t *h);
void mem_process_seqs(const mem_opt_t *opt, const bwt_t *bwt, const bntseq_t *bns, const uint8_t *pac, int64_t n_processed, int n, bseq1_t *seqs, const mem_pestat_t *pes0);
void mem_process_seqs2(const mem_opt_t *opt, const bwt_t *bwt, const bntseq_t *bns, const uint8_t *pac, int64_t n_processed, int n, bseq1_t *seqs, const mem_pestat_t *pes0, bam_hdr_t *h);
/**
* Find the aligned regions for one query sequence
@ -160,7 +161,6 @@ extern "C" {
* @return CIGAR, strand, mapping quality and forward-strand position
*/
mem_aln_t mem_reg2aln(const mem_opt_t *opt, const bntseq_t *bns, const uint8_t *pac, int l_seq, const char *seq, const mem_alnreg_t *ar);
mem_aln_t mem_reg2aln2(const mem_opt_t *opt, const bntseq_t *bns, const uint8_t *pac, int l_seq, const char *seq, const mem_alnreg_t *ar, const char *name);
/**
* Infer the insert size distribution from interleaved alignment regions

View File

@ -127,10 +127,8 @@ int main_mem(int argc, char *argv[])
#ifdef USE_HTSLIB
} else if (c == 'o') {
opt->bam_output = atoi(optarg);
}
#else
}
#endif
}
else return 1;
}
if (opt->n_threads < 1) opt->n_threads = 1;
@ -280,7 +278,7 @@ int main_mem(int argc, char *argv[])
for (i = 0; i < n; ++i) size += seqs[i].l_seq;
if (bwa_verbose >= 3)
fprintf(stderr, "[M::%s] read %d sequences (%ld bp)...\n", __func__, n, (long)size);
mem_process_seqs(opt, idx->bwt, idx->bns, idx->pac, n_processed, n, seqs, pes0, h);
mem_process_seqs2(opt, idx->bwt, idx->bns, idx->pac, n_processed, n, seqs, pes0, h);
n_processed += n;
for (i = 0; i < n; ++i) {
#ifdef USE_HTSLIB

2
main.c
View File

@ -4,7 +4,7 @@
#include "utils.h"
#ifndef PACKAGE_VERSION
#define PACKAGE_VERSION "0.7.10-r789"
#define PACKAGE_VERSION "0.7.10-r806-dirty"
#endif
int bwa_fa2pac(int argc, char *argv[]);