Skip to content
Snippets Groups Projects
Commit 8133545c authored by Heng Li's avatar Heng Li
Browse files

lite-r228: fixes-frequent fai_fetch(); err filter

parent e24a7c38
Branches lite
No related tags found
No related merge requests found
#ifndef HTS_H
#define HTS_H
#define HTS_VERSION "lite-r219"
#define HTS_VERSION "lite-r228"
#include <stdint.h>
#include "bgzf.h"
......
......@@ -4,8 +4,6 @@
#include <ctype.h>
#include "vcf.h"
#define HTSCMD_VERSION "r227"
int main_samview(int argc, char *argv[]);
int main_vcfview(int argc, char *argv[]);
int main_bamidx(int argc, char *argv[]);
......@@ -21,7 +19,8 @@ int main_razip(int argc, char *argv[]);
static int usage()
{
fprintf(stderr, "\nUsage: htscmd-%s <command> <argument>\n\n", HTSCMD_VERSION);
fprintf(stderr, "\nVersion: %s\n", HTS_VERSION);
fprintf(stderr, "Usage: htscmd <command> <argument>\n\n");
fprintf(stderr, "Command: samview SAM<->BAM conversion\n");
fprintf(stderr, " vcfview VCF<->BCF conversion\n");
fprintf(stderr, " tabix tabix for BGZF'd BED, GFF, SAM, VCF and more\n");
......
......@@ -105,6 +105,7 @@ int main_pileup(int argc, char *argv[])
fprintf(stderr, " -l INT minimum query length [%d]\n", min_len);
fprintf(stderr, " -q INT minimum mapping quality [%d]\n", mapQ);
fprintf(stderr, " -Q INT minimum base quality [%d]\n", baseQ);
fprintf(stderr, " -s INT mininum sum of alt quality to output [%d]\n", min_sum_q);
fprintf(stderr, " -r STR region [null]\n");
fprintf(stderr, "\n");
return 1;
......@@ -151,11 +152,12 @@ int main_pileup(int argc, char *argv[])
while (bam_mplp_auto(mplp, &tid, &pos, n_plp, plp) > 0) { // come to the next covered position
if (pos < beg || pos >= end) continue; // out of range; skip
for (i = aux.tot_dp = 0; i < n; ++i) aux.tot_dp += n_plp[i];
if (aux.tot_dp == 0) continue; // well, this should not happen
if (last_tid != tid && fai) {
free(ref);
ref = fai_fetch(fai, h->target_name[tid], &l_ref);
last_tid = tid;
}
if (aux.tot_dp == 0) continue; // well, this should not happen
if (depth_only) { // only print read depth; no allele information
fputs(h->target_name[tid], stdout); printf("\t%d", pos+1); // a customized printf() would be faster
if (ref == 0 || pos >= l_ref + beg) printf("\tN");
......@@ -184,6 +186,7 @@ int main_pileup(int argc, char *argv[])
a[m] = pileup2allele(&plp[i][j], baseQ, (uint64_t)i<<32 | j);
if (!a[m].is_skip) ++m;
}
if (m == 0) continue;
ks_introsort(allele, m, aux.a);
// count alleles
for (i = n_alleles = 1; i < m; ++i)
......@@ -236,7 +239,6 @@ int main_pileup(int argc, char *argv[])
}
}
putchar('\n');
last_tid = tid;
}
free(n_plp); free(plp);
bam_mplp_destroy(mplp);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment