From 7f8bb285b631bd30a116ff5b5495563c7f5438f2 Mon Sep 17 00:00:00 2001 From: Heng Li Date: Mon, 26 Jul 2010 02:18:38 +0000 Subject: [PATCH] * samtools-0.1.8-7 (r639) * fixed the reference allele assignment --- bam_mcns.c | 8 +++++--- bam_plcmd.c | 2 +- bamtk.c | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/bam_mcns.c b/bam_mcns.c index 7ef9f0f..40335ee 100644 --- a/bam_mcns.c +++ b/bam_mcns.c @@ -115,9 +115,11 @@ static void set_allele(int ref, mc_aux_t *ma) 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 } } diff --git a/bam_plcmd.c b/bam_plcmd.c index a1c87ab..bbdca64 100644 --- a/bam_plcmd.c +++ b/bam_plcmd.c @@ -701,7 +701,7 @@ int bam_mpileup(int argc, char *argv[]) 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"); diff --git a/bamtk.c b/bamtk.c index e80d042..c70b41d 100644 --- a/bamtk.c +++ b/bamtk.c @@ -9,7 +9,7 @@ #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[]); -- 2.39.2