Answers.Body: <p>A couple fast alternatives:</p>
  <pre><code><span class="math-container">$ bedops --chrom chr14 -n 1 &lt;(vcf2bed &lt; variants.vcf) &lt;(sort-bed repeats.bed) &gt; answer.bed
  $</span> bedops --chrom chr14 -n 1 &lt;(vcf2bed &lt; variants.vcf) &lt;(rmsk2bed &lt; repeats.rmsk) &gt; answer.bed
  </code></pre>
  <p>Using <code>--chrom chr14</code> focuses set operations on that chromosome.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-05-28T12:17:25.383Z
Answers.Text: This worked for me. Thanks Alex Reynolds
Answers.UserDisplayName: John
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-05-28T06:13:29.053Z
Answers.LastActivityDate: 2021-05-28T06:13:29.053Z
Answers.UserDisplayName: Alex Reynolds
Answers.Body: <p><a href="https://vcftools.github.io/man_latest.html" rel="nofollow noreferrer"><code>vcftools</code></a> with the <code>--exclude-bed</code> option or <a href="https://bedtools.readthedocs.io/en/latest/index.html" rel="nofollow noreferrer"><code>bedtools</code></a> with the <code>subtract</code> command should do the trick.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-05-27T13:25:13.573Z
Answers.Text: how about using bedtools intersect -v?
Answers.UserDisplayName: John
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-05-27T13:47:00.023Z
Answers.Text: probably better to use ``bcftools view -R .bedfile`` - vcftools isn't maintained any more and a fair bit slower than bcftools.
Answers.UserDisplayName: user438383
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-05-27T13:19:59.010Z
Answers.LastActivityDate: 2021-05-27T13:19:59.010Z
Answers.UserDisplayName: haci
Body: <p>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.</p>
  
Tags: <vcf><snp><bedtools><repeatmasker><variants>
Title: Remove repetitive region vcf file using repeatmasker bed file
ThreadText: # Remove repetitive region vcf file using repeatmasker bed file
  
  (Asked by: username_0 on 2021-05-27)
  
  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.
  
  **Tags:** vcf, snp, bedtools, repeatmasker, variants
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2021-05-28. Score: 2 | Accepted answer
  
  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.
  
  > **Comments:**
  > **username_0**: This worked for me. Thanks username_1  
  
  ---
  
  ### Answer by username_2 on 2021-05-27. Score: 0
  
  [`vcftools`](https://vcftools.github.io/man_latest.html) with the `--exclude-bed` option or [`bedtools`](https://bedtools.readthedocs.io/en/latest/index.html) with the `subtract` command should do the trick.
  
  > **Comments:**
  > **username_0**: how about using bedtools intersect -v?  
  > **username_3**: probably better to use ``bcftools view -R .bedfile`` - vcftools isn't maintained any more and a fair bit slower than bcftools.  
  
  ---
  
  