If you have created your index with the htslib version of tabix or with 
bcftools index, then this will give you the total number of variants (bcftools 
v1.1):

bcftools index --nrecords $vcf

and this will give you counts per-chromosome:

bcftools index --stats $vcf




On 19 Nov 2014, at 16:15, Heng Li wrote:

> 
> On Nov 19, 2014, at 10:58, Karol Estrada <ka...@broadinstitute.org> wrote:
> 
>> Dear Heng,
>> 
>> We are wondering if there’s a fast approach to use tabix or any other hack 
>> to get the total number of variants that a VCF has without actually reading 
>> the whole vcf file and counting the lines. I assume that the total number of 
>> rows is somehow stored in the tbi file.
> 
> No, this is not stored in the traditional tabix index. The htslib 
> implementation of tabix should have this information in dummy bins, I think. 
> Someone else needs to confirm, though.
> 
> Heng
> 
> 
>> I read the spec of the tabix format, is n_ref the value we would be looking 
>> for? that doesn’t seem to match the number of variants. 
>> 
>> Thanks
>> 
>> Karol
>> 
> 
> 
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
> http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
> _______________________________________________
> Samtools-help mailing list
> Samtools-help@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/samtools-help



-- 
 The Wellcome Trust Sanger Institute is operated by Genome Research 
 Limited, a charity registered in England with number 1021457 and a 
 company registered in England with number 2742969, whose registered 
 office is 215 Euston Road, London, NW1 2BE. 

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
Samtools-help mailing list
Samtools-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/samtools-help

Reply via email to