This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How To Detect Overlaping Indels In Vcf File?

Hi all,

I have a vcf file with indels from a whole genome analysis and I want to detect overlapping between indels... I tried to use BEDtools-intersect but it asks for 2 files, and I only have a single file. Before trying the option of giving the same file 2 times to BEDtools-intersect maybe someone knows a better way or a better tool to achieve this.

Thanks!

indel vcf

interesting, but my file is 10Gb, does Galaxy support those upload sizes?

BEDOPS tools are designed to handle arbitrarily-sized inputs and may be a useful alternative to uploading a 10 Gb file. Please see my comment to Irsan's answer.

Is the data phased? If so you can use something like vcfgeno2haplo -w 1000 and it will describe when the indels are "impossible" (e.g. overlapping on the same haplotype) on stderr.

Alternatively, you could call with a method that doesn't generate overlapping indels (a haplotype detection method) and ensure that the input is left-aligned and homogenized.

2 answers

Try bedops. It has a merge option that collapses overlapping elements in 1 or more input files. Make sure you have sorted the vcf file with sort-bed first

sorry, but it seems that bedop only uses BED as input and I have VCF files

The BEDOPS suite includes a vcf2bed conversion script, if this helps. The bedops tool operates on file streams in linear time and has a low, constant memory footprint, so it will scale to your 10 Gb input file size very nicely (see the Bioinformatics paper and supplementary figures for performance analysis), but you would want to do sorting with the "Big Bed Merge Sort" (bbms) tool, instead of sort-bed, unless you have more than 10 Gb of system memory. (When BEDOPS v2 comes out in a month or so, the sort-bed tool will include the functionality in bbms and be able to do sorts on arbitrarily large BED inputs.)

Please see: http://code.google.com/p/bedops/wiki/vcf2bed for conversion, http://code.google.com/p/bedops/wiki/sortBed for sorting, and http://code.google.com/p/bedops/wiki/bedops for documentation for the bedops tool.

The --element-of operator is probably most useful for reporting overlapping BED elements, while the --merge operator will concatenate overlapping regions. You can combine operators, if this is needed for your analysis, by using standard UNIX piping; BEDOPS apps can usually take in standard input from upstream processing, e.g.

vcf2bed < foo.vcf | bbms - | bedops --element-of - bar.bed > answer.bed

Thanks for the explanation! I'll surely give it a try

I have my own script to filter down different cases and overlapping indels is one of them. I use a window of 20 bp and if I find 2 or more indels within that window I keep the one with the highest supporting reads or you can use some other criteria. Let me know if you need that script. It takes vcf as input and emits a vcf output.

Log in to answer this question.