Skip to content

Commit

Permalink
Implements "bcftools view -G removes all format header lines"
Browse files Browse the repository at this point in the history
Resolves samtools#248
  • Loading branch information
winni2k authored and mcshane committed Jul 6, 2015
1 parent 96e7858 commit baa24a8
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
1 change: 1 addition & 0 deletions test/test.pl
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
test_vcf_view($opts,in=>'view',out=>'view.10.out',args=>q[-ne 'INDEL=1 || PV4[0]<0.006'],reg=>'');
test_vcf_view($opts,in=>'view',out=>'view.exclude.out',args=>'-s ^NA00003',reg=>'');
test_vcf_view($opts,in=>'view.omitgenotypes',out=>'view.omitgenotypes.out',args=>'',reg=>'');
test_vcf_view($opts,in=>'view.omitgenotypes',out=>'view.dropgenotypes.out',args=>'-G',reg=>'');
test_vcf_view($opts,in=>'view.vectors',out=>'view.vectors.A.out',args=>'-asA',reg=>'');
test_vcf_view($opts,in=>'view.vectors',out=>'view.vectors.B.out',args=>'-asB',reg=>'');
test_vcf_view($opts,in=>'view.filter',out=>'view.filter.1.out',args=>q[-H -i'FMT/FGS[0]="AAAAAA"'],reg=>''); # test expressions
Expand Down
4 changes: 0 additions & 4 deletions test/view.9.out
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@
##INFO=<ID=QD,Number=1,Type=Float,Description="Variant confidence/quality by depth">
##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
##FORMAT=<ID=DP,Number=1,Type=Integer,Description="# high-quality bases">
##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
##FORMAT=<ID=PL,Number=G,Type=Integer,Description="List of Phred-scaled genotype likelihoods">
##FILTER=<ID=StrandBias,Description="Min P-value for strand bias (INFO/PV4) [0.0001]">
##FILTER=<ID=BaseQualBias,Description="Min P-value for baseQ bias (INFO/PV4) [1e-100]">
##FILTER=<ID=MapQualBias,Description="Min P-value for mapQ bias (INFO/PV4) [0]">
Expand Down
12 changes: 12 additions & 0 deletions test/view.dropgenotypes.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
##fileformat=VCFv4.2
##FILTER=<ID=PASS,Description="All filters passed">
##reference=file:///seq/references/1000GenomesPilot-NCBI36.fasta
##contig=<ID=20,length=62435964,assembly=B36,md5=f126cdf8a6e0c7f379d618ff66beb2da,species="Homo sapiens",taxonomy=x>
##INFO=<ID=NS,Number=1,Type=Integer,Description="Number of Samples With Data">
##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
#CHROM POS ID REF ALT QUAL FILTER INFO
20 14370 rs6054257 G A 29 PASS NS=3;DP=14
20 17330 . T A 3 PASS NS=3;DP=11
20 1110696 rs6040355 A G,T 67 PASS NS=2;DP=10
20 1230237 . T . 47 PASS NS=3;DP=13
20 1234567 microsat1 GTC G,GTCT 50 PASS NS=3;DP=9
4 changes: 3 additions & 1 deletion vcfview.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,10 @@ static void init_data(args_t *args)
if ( !args->out ) error("%s: %s\n", args->fn_out,strerror(errno));

// headers: hdr=full header, hsub=subset header, hnull=sites only header
if (args->sites_only)
if (args->sites_only){
args->hnull = bcf_hdr_subset(args->hdr, 0, 0, 0);
bcf_hdr_remove(args->hnull, BCF_HL_FMT, NULL);
}
if (args->n_samples > 0)
{
args->hsub = bcf_hdr_subset(args->hdr, args->n_samples, args->samples, args->imap);
Expand Down

0 comments on commit baa24a8

Please sign in to comment.