0
$\begingroup$

I have a 1000 genomes vcf file for chromosome 14. And I want to remove variants in repetitive regions flagged by repeatMasker. I have a bed file for those repeats. I downloaded that file from UCSC. How can I eliminate/remove those sites in vcf file using repeat masker's bed file? Insights will be appreciated.

$\endgroup$
0
2
$\begingroup$

A couple fast alternatives:

$ bedops --chrom chr14 -n 1 <(vcf2bed < variants.vcf) <(sort-bed repeats.bed) > answer.bed
$ bedops --chrom chr14 -n 1 <(vcf2bed < variants.vcf) <(rmsk2bed < repeats.rmsk) > answer.bed

Using --chrom chr14 focuses set operations on that chromosome.

$\endgroup$
1
  • $\begingroup$ This worked for me. Thanks Alex Reynolds $\endgroup$
    – John
    May 28 at 12:17
0
$\begingroup$

vcftools with the --exclude-bed option or bedtools with the subtract command should do the trick.

$\endgroup$
2
  • $\begingroup$ how about using bedtools intersect -v? $\endgroup$
    – John
    May 27 at 13:25
  • 1
    $\begingroup$ probably better to use bcftools view -R .bedfile - vcftools isn't maintained any more and a fair bit slower than bcftools. $\endgroup$
    – user438383
    May 27 at 13:47

Not the answer you're looking for? Browse other questions tagged or ask your own question.