X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=bam_sort.c;h=402792aea44952a5962e340e9a0efbad75654494;hb=1a23a35867ee992dcffcf3d17df2b7d41732f33b;hp=7c5fbb2faf4e7cc5268cbf924550461979bb4a84;hpb=63e8f525a5fd57be4c3471739a3996016e0c25f9;p=samtools.git diff --git a/bam_sort.c b/bam_sort.c index 7c5fbb2..402792a 100644 --- a/bam_sort.c +++ b/bam_sort.c @@ -47,6 +47,16 @@ static inline int heap_lt(const heap1_t a, const heap1_t b) KSORT_INIT(heap, heap1_t, heap_lt) +/*! + @abstract Merge multiple sorted BAM. + @param is_by_qname whether to sort by query name + @param out output BAM file name + @param n number of files to be merged + @param fn names of files to be merged + + @discussion Padding information may NOT correctly maintained. This + function is NOT thread safe. + */ void bam_merge_core(int by_qname, const char *out, int n, char * const *fn) { bamFile fpout, *fp; @@ -155,6 +165,20 @@ static void sort_blocks(int n, int k, bam1_p *buf, const char *prefix, const bam bam_close(fp); } +/*! + @abstract Sort an unsorted BAM file based on the chromosome order + and the leftmost position of an alignment + + @param is_by_qname whether to sort by query name + @param fn name of the file to be sorted + @param prefix prefix of the output and the temporary files; upon + sucessess, prefix.bam will be written. + @param max_mem approxiate maximum memory (very inaccurate) + + @discussion It may create multiple temporary subalignment files + and then merge them by calling bam_merge_core(). This function is + NOT thread safe. + */ void bam_sort_core(int is_by_qname, const char *fn, const char *prefix, size_t max_mem) { int n, ret, k, i;