From 02a39613666be62d4e2184ebe4c6d30062c1a784 Mon Sep 17 00:00:00 2001 From: Petr Danecek Date: Mon, 6 Feb 2023 09:05:20 +0000 Subject: [PATCH] Drop offending space character in `query -H` output The header printed by `bcftools query -H` and `bcftools +split-vep -H` contained a space after the leading hash # [1]columnName The space is unnecessary and complicates machine processing, so is dropped to produce output like #[1]columnName Resolves #1856 --- NEWS | 7 ++++++- convert.c | 4 ++-- test/split-vep.12.2.out | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 443eb9ff7..d1730ee19 100644 --- a/NEWS +++ b/NEWS @@ -19,12 +19,17 @@ Changes affecting the whole of bcftools, or multiple commands: FORMAT/AD[0:GT] > 10 .. same as above, but in the first sample sSUM(FORMAT/AD[GT]) > 20 .. require total sample depth bigger than 20 +* The commands `consensus -H` and `+split-vep -H` + + - Drop unnecessary leading space in the first header column and newly print `#[1]columnName` + instead of the previous `# [1]columnName` (#1856) + Changes affecting specific commands: * bcftools +allele-length - - fix overflow for indels longer than 512bp and aggregate alleles equal or larger than + - Fix overflow for indels longer than 512bp and aggregate alleles equal or larger than that in the same bin (#1837) * bcftools annotate diff --git a/convert.c b/convert.c index 4ae57b7d4..80e54747d 100644 --- a/convert.c +++ b/convert.c @@ -1,6 +1,6 @@ /* convert.c -- functions for converting between VCF/BCF and related formats. - Copyright (C) 2013-2022 Genome Research Ltd. + Copyright (C) 2013-2023 Genome Research Ltd. Author: Petr Danecek @@ -1568,7 +1568,7 @@ int convert_header(convert_t *convert, kstring_t *str) if ( i!=convert->nfmt ) return str->l - l_ori; - kputs("# ", str); + kputc('#', str); for (i=0; infmt; i++) { // Genotype fields diff --git a/test/split-vep.12.2.out b/test/split-vep.12.2.out index 60a8c1996..9b2a0f8d5 100644 --- a/test/split-vep.12.2.out +++ b/test/split-vep.12.2.out @@ -1,4 +1,4 @@ -# [1]POS [2]Allele [3]Consequence [4]IMPACT [5]SYMBOL [6]Gene [7]Feature_type [8]Feature [9]BIOTYPE [10]EXON [11]INTRON [12]HGVSc [13]HGVSp [14]cDNA_position [15]CDS_position [16]Protein_position [17]Amino_acids [18]Codons [19]Existing_variation [20]ALLELE_NUM [21]DISTANCE [22]STRAND [23]FLAGS [24]VARIANT_CLASS [25]SYMBOL_SOURCE [26]HGNC_ID [27]CANONICAL [28]TSL [29]APPRIS [30]CCDS [31]ENSP [32]SWISSPROT [33]TREMBL [34]UNIPARC [35]SOURCE [36]GENE_PHENO [37]SIFT [38]PolyPhen [39]DOMAINS [40]miRNA [41]HGVS_OFFSET [42]AF [43]AFR_AF [44]AMR_AF [45]EAS_AF [46]EUR_AF [47]SAS_AF [48]AA_AF [49]EA_AF [50]gnomAD_AF [51]gnomAD_AFR_AF [52]gnomAD_AMR_AF [53]gnomAD_ASJ_AF [54]gnomAD_EAS_AF [55]gnomAD_FIN_AF [56]gnomAD_NFE_AF [57]gnomAD_OTH_AF [58]gnomAD_SAS_AF [59]MAX_AF [60]MAX_AF_POPS [61]CLIN_SIG [62]SOMATIC [63]PHENO [64]PUBMED [65]MOTIF_NAME [66]MOTIF_POS [67]HIGH_INF_POS [68]MOTIF_SCORE_CHANGE [69]LoF [70]LoF_filter [71]LoF_flags [72]LoF_info [73]CADD_PHRED [74]CADD_RAW [75]gnomAD2.1 [76]gnomAD2.1_AF_raw [77]gnomAD2.1_AF_popmax [78]gnomAD2.1_AF_afr [79]gnomAD2.1_AF_amr [80]gnomAD2.1_AF_asj [81]gnomAD2.1_AF_eas [82]gnomAD2.1_AF_fin [83]gnomAD2.1_AF_nfe [84]gnomAD2.1_AF_oth [85]gnomAD2.1_AF_sas +#[1]POS [2]Allele [3]Consequence [4]IMPACT [5]SYMBOL [6]Gene [7]Feature_type [8]Feature [9]BIOTYPE [10]EXON [11]INTRON [12]HGVSc [13]HGVSp [14]cDNA_position [15]CDS_position [16]Protein_position [17]Amino_acids [18]Codons [19]Existing_variation [20]ALLELE_NUM [21]DISTANCE [22]STRAND [23]FLAGS [24]VARIANT_CLASS [25]SYMBOL_SOURCE [26]HGNC_ID [27]CANONICAL [28]TSL [29]APPRIS [30]CCDS [31]ENSP [32]SWISSPROT [33]TREMBL [34]UNIPARC [35]SOURCE [36]GENE_PHENO [37]SIFT [38]PolyPhen [39]DOMAINS [40]miRNA [41]HGVS_OFFSET [42]AF [43]AFR_AF [44]AMR_AF [45]EAS_AF [46]EUR_AF [47]SAS_AF [48]AA_AF [49]EA_AF [50]gnomAD_AF [51]gnomAD_AFR_AF [52]gnomAD_AMR_AF [53]gnomAD_ASJ_AF [54]gnomAD_EAS_AF [55]gnomAD_FIN_AF [56]gnomAD_NFE_AF [57]gnomAD_OTH_AF [58]gnomAD_SAS_AF [59]MAX_AF [60]MAX_AF_POPS [61]CLIN_SIG [62]SOMATIC [63]PHENO [64]PUBMED [65]MOTIF_NAME [66]MOTIF_POS [67]HIGH_INF_POS [68]MOTIF_SCORE_CHANGE [69]LoF [70]LoF_filter [71]LoF_flags [72]LoF_info [73]CADD_PHRED [74]CADD_RAW [75]gnomAD2.1 [76]gnomAD2.1_AF_raw [77]gnomAD2.1_AF_popmax [78]gnomAD2.1_AF_afr [79]gnomAD2.1_AF_amr [80]gnomAD2.1_AF_asj [81]gnomAD2.1_AF_eas [82]gnomAD2.1_AF_fin [83]gnomAD2.1_AF_nfe [84]gnomAD2.1_AF_oth [85]gnomAD2.1_AF_sas 14464 T non_coding_transcript_exon_variant MODIFIER WASH7P ENSG00000227232 Transcript ENST00000423562 unprocessed_pseudogene 10/10 . ENST00000423562.1:n.1568T>A . 1568 . . . . rs546169444 1 . -1 . SNV HGNC 38034 . . . . . . . . . . . . . . . 0.0958 0.0144 0.1138 0.005 0.1859 0.1943 . . . . . . . . . . . 0.1943 SAS . . . . . . . . . . . . . . . . . . . . . . . . . 14464 T non_coding_transcript_exon_variant MODIFIER WASH7P ENSG00000227232 Transcript ENST00000438504 unprocessed_pseudogene 12/12 . ENST00000438504.2:n.1682T>A . 1682 . . . . rs546169444 1 . -1 . SNV HGNC 38034 YES . . . . . . . . . . . . . . 0.0958 0.0144 0.1138 0.005 0.1859 0.1943 . . . . . . . . . . . 0.1943 SAS . . . . . . . . . . . . . . . . . . . . . . . . . 14464 T downstream_gene_variant MODIFIER DDX11L1 ENSG00000223972 Transcript ENST00000456328 processed_transcript . . . . . . . . . rs546169444 1 55 1 . SNV HGNC 37102 YES . . . . . . . . . . . . . . 0.0958 0.0144 0.1138 0.005 0.1859 0.1943 . . . . . . . . . . . 0.1943 SAS . . . . . . . . . . . . . . . . . . . . . . . . .