diff --git a/Makefile b/Makefile index de45ff1..98d0eb6 100644 --- a/Makefile +++ b/Makefile @@ -28,14 +28,19 @@ bwa:libbwa.a $(AOBJS) main.o libbwa.a:$(LOBJS) $(AR) -csru $@ $(LOBJS) -QSufSort.o:QSufSort.h -bwt_gen.o:QSufSort.h - ksw.o:ksw.h +kstring.o:kstring.h utils.o:utils.h ksort.h kseq.h bntseq.o:bntseq.h bwt.o:bwt.h utils.h -bwa.o:bwa.h +bwa.o:bwa.h bwt.h bntseq.h +bwamem.o:ksw.h kbtree.h ksort.h kvec.h kstring.h utils.h bwamem.h +bwamem_pair.o:ksw.h kvec.h kstring.h utils.h bwamem.h + +QSufSort.o:QSufSort.h +bwt_gen.o:QSufSort.h + +fastmap.o:bwt.h bwamem.h bwtaln.o:bwt.h bwtaln.h kseq.h bwtgap.o:bwtgap.h bwtaln.h bwt.h @@ -44,9 +49,5 @@ bwtsw2_core.o:bwtsw2.h bwt.h bwt_lite.h stdaln.h bwtsw2_aux.o:bwtsw2.h bwt.h bwt_lite.h stdaln.h bwtsw2_main.o:bwtsw2.h -bwamem.o:bwamem.h -bwamem_pair.o:bwamem.h -fastmap.o:bwt.h bwamem.h - clean: rm -f gmon.out *.o a.out $(PROG) *~ *.a diff --git a/ksw.h b/ksw.h index 40216d9..d2975de 100644 --- a/ksw.h +++ b/ksw.h @@ -30,7 +30,7 @@ extern "C" { * @param tlen length of the target sequence * @param target target sequence * @param m number of residue types - * @param mat m*m scoring matrix in one-dimention array + * @param mat m*m scoring matrix in one-dimension array * @param gapo gap open penalty; a gap of length l cost "-(gapo+l*gape)" * @param gape gap extension penalty * @param xtra extra information (see below) @@ -62,8 +62,47 @@ extern "C" { */ kswr_t ksw_align(int qlen, uint8_t *query, int tlen, uint8_t *target, int m, const int8_t *mat, int gapo, int gape, int xtra, kswq_t **qry); - int ksw_extend(int qlen, const uint8_t *query, int tlen, const uint8_t *target, int m, const int8_t *mat, int gapo, int gape, int w, int h0, int *_qle, int *_tle, int *_gtle, int *_gscore); - int ksw_global(int qlen, const uint8_t *query, int tlen, const uint8_t *target, int m, const int8_t *mat, int gapo, int gape, int w, int *_n_cigar, uint32_t **_cigar); + /** + * Banded global alignment + * + * @param qlen query length + * @param query query sequence with 0 <= query[i] < m + * @param tlen target length + * @param target target sequence with 0 <= target[i] < m + * @param m number of residue types + * @param mat m*m scoring mattrix in one-dimension array + * @param gapo gap open penalty; a gap of length l cost "-(gapo+l*gape)" + * @param gape gap extension penalty + * @param w band width + * @param n_cigar (out) number of CIGAR elements + * @param cigar (out) BAM-encoded CIGAR; caller need to deallocate with free() + * + * @return score of the alignment + */ + int ksw_global(int qlen, const uint8_t *query, int tlen, const uint8_t *target, int m, const int8_t *mat, int gapo, int gape, int w, int *n_cigar, uint32_t **cigar); + + /** + * Extend alignment + * + * The routine aligns $query and $target, assuming their upstream sequences, + * which are not provided, have been aligned with score $h0. In return, + * region [0,*qle) on the query and [0,*tle) on the target sequences are + * aligned together. If *gscore>=0, *gscore keeps the best score such that + * the entire query sequence is aligned; *gtle keeps the position on the + * target where *gscore is achieved. Returning *gscore and *gtle helps the + * caller to decide whether an end-to-end hit or a partial hit is preferred. + * + * The first 9 parameters are identical to those in ksw_global() + * + * @param h0 alignment score of upstream sequences + * @param _qle (out) length of the query in the alignment + * @param _tle (out) length of the target in the alignment + * @param _gtle (out) length of the target if query is fully aligned + * @param _gscore (out) score of the best end-to-end alignment; negative if not found + * + * @return best semi-local alignment score + */ + int ksw_extend(int qlen, const uint8_t *query, int tlen, const uint8_t *target, int m, const int8_t *mat, int gapo, int gape, int w, int h0, int *qle, int *tle, int *gtle, int *gscore); #ifdef __cplusplus }