From 6ad0dc55ff3abf908a99935321ff8fa5efed4d88 Mon Sep 17 00:00:00 2001 From: Heng Li Date: Mon, 1 Feb 2010 14:13:19 +0000 Subject: [PATCH] * samtools-0.1.7-6 * fixed a bug in faidx --- ChangeLog | 158 +++++++++++++++++++++++++++++++++++++++++++++++ bam_plcmd.c | 2 +- bamtk.c | 2 +- misc/samtools.pl | 17 ++--- misc/wgsim.c | 4 +- 5 files changed, 172 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6b1a695..64df707 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,161 @@ +------------------------------------------------------------------------ +r529 | jmarshall | 2010-01-11 18:51:49 -0500 (Mon, 11 Jan 2010) | 2 lines +Changed paths: + M /trunk/samtools/faidx.c + +Put the right filename in the error message. + +------------------------------------------------------------------------ +r528 | lh3lh3 | 2009-12-14 11:26:47 -0500 (Mon, 14 Dec 2009) | 3 lines +Changed paths: + M /trunk/samtools/bam_plcmd.c + M /trunk/samtools/bamtk.c + + * samtools-0.1.7-5 (r528) + * further add new consensus generation strategy + +------------------------------------------------------------------------ +r527 | petulda | 2009-12-11 12:31:05 -0500 (Fri, 11 Dec 2009) | 1 line +Changed paths: + M /trunk/samtools/knetfile.c + +Fixed a bug in knet_seek +------------------------------------------------------------------------ +r526 | petulda | 2009-12-11 07:51:18 -0500 (Fri, 11 Dec 2009) | 1 line +Changed paths: + M /trunk/samtools/misc/sam2vcf.pl + +Small fix in VCF format: dot for the empty INFO field +------------------------------------------------------------------------ +r525 | petulda | 2009-12-11 04:36:18 -0500 (Fri, 11 Dec 2009) | 1 line +Changed paths: + M /trunk/samtools/sam_header.c + +Allow tabs in the CO header field +------------------------------------------------------------------------ +r524 | jmarshall | 2009-12-10 10:03:58 -0500 (Thu, 10 Dec 2009) | 3 lines +Changed paths: + M /trunk/samtools/Makefile + M /trunk/samtools/Makefile.mingw + +Depend on libbam.a rather than the phony target, so that samtools is not +unnecessarily rebuilt every time. Also clean bgzip. + +------------------------------------------------------------------------ +r523 | jmarshall | 2009-12-10 09:45:32 -0500 (Thu, 10 Dec 2009) | 4 lines +Changed paths: + M /trunk/samtools/Makefile + M /trunk/samtools/Makefile.mingw + +Fix a bug in compiling bgzip: this also needs knetfile.o when _USE_KNETFILE +is defined. Also introduce $(KNETFILE_O) which can be set to empty to +facilitate non-knet builds. + +------------------------------------------------------------------------ +r522 | lh3lh3 | 2009-12-01 13:02:36 -0500 (Tue, 01 Dec 2009) | 4 lines +Changed paths: + M /trunk/samtools/bamtk.c + M /trunk/samtools/sam_view.c + + * samtools-0.1.7-4 (r522) + * fixed a bug in "view -r" + * added a new option "view -R" to read required read groups from a file + +------------------------------------------------------------------------ +r521 | lh3lh3 | 2009-12-01 10:00:12 -0500 (Tue, 01 Dec 2009) | 3 lines +Changed paths: + M /trunk/samtools/bam_md.c + M /trunk/samtools/bamtk.c + + * samtools-0.1.7-3 (r521) + * calmd: optionally mask matching bases as N + +------------------------------------------------------------------------ +r520 | lh3lh3 | 2009-12-01 09:37:17 -0500 (Tue, 01 Dec 2009) | 4 lines +Changed paths: + M /trunk/samtools/bam_plcmd.c + M /trunk/samtools/bamtk.c + M /trunk/samtools/misc/samtools.pl + + * samtools-0.1.7-2 (r520) + * fixed a few issues with compilation in Windows (on behalf of John) + * choose a random base as the consensus (for population genetics studies) + +------------------------------------------------------------------------ +r519 | jmarshall | 2009-11-30 10:53:02 -0500 (Mon, 30 Nov 2009) | 6 lines +Changed paths: + M /trunk/samtools/Makefile + +Put libraries at the end, so they can resolve references from libbam.a +as well, even with old-fashioned linkers. + +Also use libbam.a explicitly rather than "-L. -lbam" to ensure that we get +the freshly built library, not some other libbam.a lying around the system. + +------------------------------------------------------------------------ +r518 | jmarshall | 2009-11-30 08:44:56 -0500 (Mon, 30 Nov 2009) | 2 lines +Changed paths: + M /trunk/samtools/Makefile + M /trunk/samtools/misc/Makefile + +Also clean *.exe (for Cygwin users using this makefile). + +------------------------------------------------------------------------ +r517 | jmarshall | 2009-11-30 07:09:04 -0500 (Mon, 30 Nov 2009) | 2 lines +Changed paths: + M /trunk/samtools/bam_index.c + +Index files should be opened in binary mode, not text mode. + +------------------------------------------------------------------------ +r516 | lh3lh3 | 2009-11-27 15:18:59 -0500 (Fri, 27 Nov 2009) | 2 lines +Changed paths: + A /trunk/samtools/examples/bam2bed.c + +another example program + +------------------------------------------------------------------------ +r515 | lh3lh3 | 2009-11-27 10:44:56 -0500 (Fri, 27 Nov 2009) | 3 lines +Changed paths: + M /trunk/samtools/bam_import.c + M /trunk/samtools/bamtk.c + M /trunk/samtools/misc/wgsim_eval.pl + M /trunk/samtools/sam.c + + * samtools-0.1.7-1 (r515) + * report an error when .fai contains duplicated names, instead of segfault + +------------------------------------------------------------------------ +r514 | jmarshall | 2009-11-24 09:45:35 -0500 (Tue, 24 Nov 2009) | 2 lines +Changed paths: + M /trunk/samtools/bam.c + +Format 'c'-encoded auxiliary fields correctly, as *signed* integers. + +------------------------------------------------------------------------ +r513 | lh3lh3 | 2009-11-16 10:13:07 -0500 (Mon, 16 Nov 2009) | 2 lines +Changed paths: + M /trunk/samtools/Makefile.mingw + +Update Makefile.mingw for the same reason + +------------------------------------------------------------------------ +r512 | lh3lh3 | 2009-11-16 10:00:08 -0500 (Mon, 16 Nov 2009) | 2 lines +Changed paths: + M /trunk/samtools/Makefile + +Fixed a bug in compiling razip + +------------------------------------------------------------------------ +r510 | lh3lh3 | 2009-11-10 10:55:41 -0500 (Tue, 10 Nov 2009) | 2 lines +Changed paths: + M /trunk/samtools/ChangeLog + M /trunk/samtools/NEWS + M /trunk/samtools/bamtk.c + M /trunk/samtools/samtools.1 + +Release samtools-0.1.7 (r510) + ------------------------------------------------------------------------ r509 | lh3lh3 | 2009-11-06 09:17:09 -0500 (Fri, 06 Nov 2009) | 3 lines Changed paths: diff --git a/bam_plcmd.c b/bam_plcmd.c index cbb55cc..ccc5eb9 100644 --- a/bam_plcmd.c +++ b/bam_plcmd.c @@ -174,7 +174,7 @@ static int pileup_func(uint32_t tid, uint32_t pos, int n, const bam_pileup1_t *p // update d->ref if necessary if (d->fai && (int)tid != d->tid) { free(d->ref); - d->ref = fai_fetch(d->fai, d->h->target_name[tid], &d->len); + d->ref = faidx_fetch_seq(d->fai, d->h->target_name[tid], 0, 0x7fffffff, &d->len); d->tid = tid; } rb = (d->ref && (int)pos < d->len)? d->ref[pos] : 'N'; diff --git a/bamtk.c b/bamtk.c index 94838a4..902bd80 100644 --- a/bamtk.c +++ b/bamtk.c @@ -9,7 +9,7 @@ #endif #ifndef PACKAGE_VERSION -#define PACKAGE_VERSION "0.1.7-5 (r528)" +#define PACKAGE_VERSION "0.1.7-6 (r530)" #endif int bam_taf2baf(int argc, char *argv[]); diff --git a/misc/samtools.pl b/misc/samtools.pl index 1d9cf59..e6dd8e8 100755 --- a/misc/samtools.pl +++ b/misc/samtools.pl @@ -328,10 +328,11 @@ sub sra2hdr { sub unique { my %opts = (f=>250.0, q=>5, r=>2, a=>1, b=>3); - getopts('Qf:q:r:a:b:', \%opts); + getopts('Qf:q:r:a:b:m', \%opts); die("Usage: samtools.pl unique [-f $opts{f}] \n") if (@ARGV == 0 && -t STDIN); my $last = ''; my $recal_Q = !defined($opts{Q}); + my $multi_only = defined($opts{m}); my @a; while (<>) { my $score = -1; @@ -349,16 +350,16 @@ sub unique { } $score = 1 if ($score < 1); if ($t[0] ne $last) { - &unique_aux(\@a, $opts{f}, $recal_Q) if (@a); + &unique_aux(\@a, $opts{f}, $recal_Q, $multi_only) if (@a); $last = $t[0]; } push(@a, [$score, \@t]); } - &unique_aux(\@a, $opts{f}, $recal_Q) if (@a); + &unique_aux(\@a, $opts{f}, $recal_Q, $multi_only) if (@a); } sub unique_aux { - my ($a, $fac, $is_recal) = @_; + my ($a, $fac, $is_recal, $multi_only) = @_; my ($max, $max2, $max_i) = (0, 0, -1); for (my $i = 0; $i < @$a; ++$i) { if ($a->[$i][0] > $max) { @@ -368,9 +369,11 @@ sub unique_aux { } } if ($is_recal) { - my $q = int($fac * ($max - $max2) / $max + .499); - $q = 250 if ($q > 250); - $a->[$max_i][1][4] = $q < 250? $q : 250; + if (!$multi_only || @$a > 1) { + my $q = int($fac * ($max - $max2) / $max + .499); + $q = 250 if ($q > 250); + $a->[$max_i][1][4] = $q < 250? $q : 250; + } } print join("\t", @{$a->[$max_i][1]}); @$a = (); diff --git a/misc/wgsim.c b/misc/wgsim.c index 1522eee..7b5f095 100644 --- a/misc/wgsim.c +++ b/misc/wgsim.c @@ -238,7 +238,7 @@ void maq_print_mutref(const char *name, const seq_t *seq, mutseq_t *hap1, mutseq c[0] = nst_nt4_table[(int)seq->s[i]]; c[1] = hap1->s[i]; c[2] = hap2->s[i]; if (c[0] >= 4) continue; - if ((c[1] & mutmsk) != NOCHANGE || (c[1] & mutmsk) != NOCHANGE) { + if ((c[1] & mutmsk) != NOCHANGE || (c[2] & mutmsk) != NOCHANGE) { printf("%s\t%d\t", name, i+1); if (c[1] == c[2]) { // hom if ((c[1]&mutmsk) == SUBSTITUTE) { // substitution @@ -304,7 +304,7 @@ void wgsim_core(FILE *fpout1, FILE *fpout2, FILE *fp_fa, int is_hap, uint64_t N, tmp_seq[1] = (uint8_t*)calloc(l+2, 1); size[0] = size_l; size[1] = size_r; - Q = (int)(-10.0 * log(ERR_RATE) / log(10.0) + 0.499) + 33; + Q = (ERR_RATE == 0.0)? 'I' : (int)(-10.0 * log(ERR_RATE) / log(10.0) + 0.499) + 33; tot_len = n_ref = 0; while ((l = seq_read_fasta(fp_fa, &seq, name, 0)) >= 0) { -- 2.39.2