The vcf2bed script will handle the last three issues:
- Use
--deletions to convert deletions to one set
- Use
--snvs to convert single-nucleotide variants to convert to a second set
- Conversion of one VCF line will generate multiple BED lines if there are multiple alternate alleles
You can use bedops --everything to union the deletion and single-base variant sets:
$ vcf2bed --deletions < foo.vcf > foo_deletions.bed
$ vcf2bed --snvs < foo.vcf > foo_snvs.bed
$ bedops --everything foo_{deletions,snvs}.bed > foo.bed
Once you have your deletions and SNVs in one file, it's easy to deal with the first issue. The conversion script maps the REF and ALT fields of the VCF input to the sixth and seventh columns of the BED output. So you can filter out lines from the BED output where those columns are equivalent, using a simple awk statement:
$ awk '$6 != $7' foo.bed > foo_filtered.bed
Hello gareth862!
It appears that your post has been cross-posted to another site: SEQanswers.
This is typically not recommended as it runs the risk of annoying people in both communities.
What result are you expecting?
We are trying to get the "affected positions" from the vcf. Our plan was to use bed tools to intersect our bed file with the vcf affected positions to produce a bed file of reference ranges