for (j = i; j > 0 && sum[j] < sum[j-1]; --j)
tmp = sum[j], sum[j] = sum[j-1], sum[j-1] = tmp;
ma->ref = sum[3]&3; ma->alt = sum[2]&3; ma->alt2 = -1;
- if (ma->ref != ref) {
- if (ma->alt == ref) tmp = ma->ref, ma->ref = ma->alt, ma->alt = tmp;
- else ma->alt2 = ma->alt, ma->alt = ma->ref, ma->ref = ref;
+ if (ma->ref != ref) { // the best base is not ref
+ if (ref >= 0 && ref <= 3) { // ref is not N
+ if (ma->alt == ref) tmp = ma->ref, ma->ref = ma->alt, ma->alt = tmp; // then switch alt and ref
+ else ma->alt2 = ma->alt, ma->alt = ma->ref, ma->ref = ref; // then set ref as ref
+ } else ma->alt2 = ma->alt, ma->alt = ma->ref, ma->ref = sum[0]&3; // then set the weakest as ref
}
}
fprintf(stderr, " -M INT cap mapping quality at INT [%d]\n", mplp.max_mq);
fprintf(stderr, " -q INT filter out alignment with MQ smaller than INT [%d]\n", mplp.min_mq);
fprintf(stderr, " -t FLOAT scaled mutation rate [%lg]\n", mplp.theta);
- fprintf(stderr, " -P STR prior: full, flat, cond2 [full]");
+ fprintf(stderr, " -P STR prior: full, flat, cond2 [full]\n");
fprintf(stderr, " -c generate VCF output (consensus calling)\n");
fprintf(stderr, " -v show variant sites only\n");
fprintf(stderr, " -S calculate AFS (slow, to stderr)\n");
#endif
#ifndef PACKAGE_VERSION
-#define PACKAGE_VERSION "0.1.8-6 (r638)"
+#define PACKAGE_VERSION "0.1.8-7 (r639)"
#endif
int bam_taf2baf(int argc, char *argv[]);