Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:samtools/bcftools into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
pd3 committed Apr 26, 2022
2 parents 8e5edbe + fe0ba97 commit 439a14f
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 35 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ endif

include config.mk

PACKAGE_VERSION = 1.15
PACKAGE_VERSION = 1.15.1

# If building from a Git repository, replace $(PACKAGE_VERSION) with the Git
# description of the working tree: either a release tag with the same value
Expand Down
15 changes: 15 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
## Release a.b


* New plugin `bcftools +variant-distance` to annotate records with distance to the
nearest variant (#1690)


## Release 1.15.1 (7th April 2022)


* bcftools annotate

- New `-H, --header-line` convenience option to pass a header line on command line,
this complements the existing `-h, --header-lines` option which requires a file
with header lines

* bcftools csq

- A list of consequence types supported by `bcftools csq` has been added to
the manual page. (#1671)

* bcftools +fill-tags

- Extend generalized functions so that FORMAT tags can be filled as well, for example:
Expand All @@ -20,6 +30,11 @@

* bcftools norm

- Fix an assertion failure triggered when a faulty VCF file with a '-'
character in the REF allele was used with `bcftools norm --atomize`. This
option now checks that the REF allele only includes the allowed characters
A, C, G, T and N. (#1668)

- Fix the loss of phasing in half-missing genotypes in variant atomization (#1689)

* bcftools roh
Expand Down
43 changes: 15 additions & 28 deletions consensus.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,17 @@ typedef struct
}
args_t;

static void destroy_chain(chain_t *chain)
{
if ( !chain ) return;
free(chain->ref_gaps);
free(chain->alt_gaps);
free(chain->block_lengths);
free(chain);
}
static chain_t* init_chain(chain_t *chain, int ref_ori_pos)
{
// fprintf(stderr, "init_chain(*chain, ref_ori_pos=%d)\n", ref_ori_pos);
if ( chain ) destroy_chain(chain);
chain = (chain_t*) calloc(1,sizeof(chain_t));
chain->num = 0;
chain->block_lengths = NULL;
Expand All @@ -137,18 +145,6 @@ static chain_t* init_chain(chain_t *chain, int ref_ori_pos)
return chain;
}

static void destroy_chain(args_t *args)
{
chain_t *chain = args->chain;
free(chain->ref_gaps);
free(chain->alt_gaps);
free(chain->block_lengths);
free(chain);
chain = NULL;
free(args->chr);
args->chr = NULL;
}

static void print_chain(args_t *args)
{
/*
Expand Down Expand Up @@ -197,7 +193,7 @@ static void print_chain(args_t *args)

static void push_chain_gap(chain_t *chain, int ref_start, int ref_len, int alt_start, int alt_len)
{
// fprintf(stderr, "push_chain_gap(*chain, ref_start=%d, ref_len=%d, alt_start=%d, alt_len=%d)\n", ref_start, ref_len, alt_start, alt_len);
// fprintf(stderr, "push_chain_gap(chain=%p, ref_start=%d, ref_len=%d, alt_start=%d, alt_len=%d)\n", chain, ref_start, ref_len, alt_start, alt_len);
int num = chain->num;

if (num && ref_start <= chain->ref_last_block_ori) {
Expand Down Expand Up @@ -305,6 +301,7 @@ static void destroy_data(args_t *args)
if ( args->chain_fname )
if ( fclose(args->fp_chain) ) error("Close failed: %s\n", args->chain_fname);
if ( fclose(args->fp_out) ) error("Close failed: %s\n", args->output_fname);
destroy_chain(args->chain);
}

static void init_region(args_t *args, char *line)
Expand Down Expand Up @@ -346,12 +343,8 @@ static void init_region(args_t *args, char *line)
bcf_sr_seek(args->files,line,args->fa_ori_pos);
if ( tmp_ptr ) *tmp_ptr = tmp;
fprintf(args->fp_out,">%s%s\n",args->chr_prefix?args->chr_prefix:"",line);
if (args->chain_fname )
{
if ( args->chain_fname )
args->chain = init_chain(args->chain, args->fa_ori_pos);
} else {
args->chain = NULL;
}
}

static bcf1_t **next_vcf_line(args_t *args)
Expand Down Expand Up @@ -949,10 +942,8 @@ static void consensus(args_t *args)
if ( str.s[0]=='>' )
{
// new sequence encountered
if (args->chain) {
print_chain(args);
destroy_chain(args);
}
if ( args->chain ) print_chain(args);

// apply all cached variants and variants that might have been missed because of short fasta (see test/consensus.9.*)
bcf1_t **rec_ptr = NULL;
while ( args->rid>=0 && (rec_ptr = next_vcf_line(args)) )
Expand Down Expand Up @@ -1026,11 +1017,7 @@ static void consensus(args_t *args)
if ( args->fa_ori_pos + args->fa_buf.l - args->fa_mod_off <= rec->pos ) break;
apply_variant(args, rec);
}
if (args->chain)
{
print_chain(args);
destroy_chain(args);
}
if (args->chain) print_chain(args);
if ( args->absent_allele ) apply_absent(args, HTS_POS_MAX);
flush_fa_buffer(args, 0);
bgzf_close(fasta);
Expand Down
39 changes: 36 additions & 3 deletions doc/bcftools.1
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
.\" Title: bcftools
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 2.0.16.dev
.\" Date: 2022-02-21
.\" Date: 2022-04-07
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
.TH "BCFTOOLS" "1" "2022-02-21" "\ \&" "\ \&"
.TH "BCFTOOLS" "1" "2022-04-07" "\ \&" "\ \&"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
Expand Down Expand Up @@ -51,7 +51,7 @@ standard input (stdin) and outputs to the standard output (stdout). Several
commands can thus be combined with Unix pipes.
.SS "VERSION"
.sp
This manual page was last updated \fB2022\-02\-21\fP and refers to bcftools git version \fB1.15\fP.
This manual page was last updated \fB2022\-04\-07\fP and refers to bcftools git version \fB1.15.1\fP.
.SS "BCF1"
.sp
The BCF1 format output by versions of samtools <= 0.1.19 is \fBnot\fP
Expand Down Expand Up @@ -2177,6 +2177,39 @@ see \fBCommon Options\fP
.fam
.fi
.if n .RE
.sp
\fBSupported consequence types\fP
.sp
.if n .RS 4
.nf
.fam C
3_prime_utr
5_prime_utr
coding_sequence
feature_elongation
frameshift
inframe_altering
inframe_deletion
inframe_insertion
intergenic
intron
missense
non_coding
splice_acceptor
splice_donor
splice_region
start_lost
start_retained
stop_gained
stop_lost
stop_retained
synonymous
.fam
.fi
.if n .RE
.sp
See also \c
.URL "https://ensembl.org/info/genome/variation/prediction/predicted_data.html" "" ""
.SS "bcftools filter \fI[OPTIONS]\fP \fIFILE\fP"
.sp
Apply fixed\-threshold filters.
Expand Down
35 changes: 33 additions & 2 deletions doc/bcftools.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ <h2 id="_description">DESCRIPTION</h2>
<div class="sect2">
<h3 id="_version">VERSION</h3>
<div class="paragraph">
<p>This manual page was last updated <strong>2022-02-21</strong> and refers to bcftools git version <strong>1.15</strong>.</p>
<p>This manual page was last updated <strong>2022-04-07</strong> and refers to bcftools git version <strong>1.15.1</strong>.</p>
</div>
</div>
<div class="sect2">
Expand Down Expand Up @@ -1911,6 +1911,37 @@ <h3 id="csq">bcftools csq <em>[OPTIONS]</em> <em>FILE</em></h3>
BCSQ=*missense|PER3|ENST00000361923|+|1028M&gt;1028T|7890117T&gt;C</pre>
</div>
</div>
<div class="paragraph">
<p><strong>Supported consequence types</strong></p>
</div>
<div class="listingblock">
<div class="content">
<pre>3_prime_utr
5_prime_utr
coding_sequence
feature_elongation
frameshift
inframe_altering
inframe_deletion
inframe_insertion
intergenic
intron
missense
non_coding
splice_acceptor
splice_donor
splice_region
start_lost
start_retained
stop_gained
stop_lost
stop_retained
synonymous</pre>
</div>
</div>
<div class="paragraph">
<p>See also <a href="https://ensembl.org/info/genome/variation/prediction/predicted_data.html" class="bare">https://ensembl.org/info/genome/variation/prediction/predicted_data.html</a></p>
</div>
</div>
<div class="sect2">
<h3 id="filter">bcftools filter <em>[OPTIONS]</em> <em>FILE</em></h3>
Expand Down Expand Up @@ -4988,7 +5019,7 @@ <h2 id="_copying">COPYING</h2>
</div>
<div id="footer">
<div id="footer-text">
Last updated 2022-02-21 11:43:27 UTC
Last updated 2022-04-07 16:32:56 +0100
</div>
</div>
</body>
Expand Down
2 changes: 1 addition & 1 deletion version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
# DEALINGS IN THE SOFTWARE.

# Master version, for use in tarballs or non-git source copies
VERSION=1.15
VERSION=1.15.1

# If we have a git clone, then check against the current tag
if [ -e .git ]
Expand Down

0 comments on commit 439a14f

Please sign in to comment.