<p>You can filter records in Python for example using <code>pyvcf.VcfFrame.filter_flagany()</code> <a href="https://sbslee-fuc.readthedocs.io/en/latest/api.html#fuc.api.pyvcf.VcfFrame.filter_flagany" rel="nofollow noreferrer">method</a> I wrote:</p>
<pre><code>&gt;&gt;&gt; from fuc import pyvcf
&gt;&gt;&gt; data = {
...     'CHROM': ['chr1', 'chr1', 'chr1', 'chr1'],
...     'POS': [100, 101, 102, 103],
...     'ID': ['.', '.', '.', '.'],
...     'REF': ['G', 'T', 'A', 'C'],
...     'ALT': ['A', 'C', 'T', 'A'],
...     'QUAL': ['.', '.', '.', '.'],
...     'FILTER': ['.', '.', '.', '.'],
...     'INFO': ['DB', 'DB;H2;Match=EXACT', 'DB;H2;Match=EXACT', '.'],
...     'FORMAT': ['GT', 'GT', 'GT', 'GT'],
...     'Steven': ['0/0', '0/1', '0/1', '0/0'],
... }
&gt;&gt;&gt; vf = pyvcf.VcfFrame.from_dict([], data)
&gt;&gt;&gt; # vf = pyvcf.VcfFrame.from_file('your_vcf.vcf')
&gt;&gt;&gt; vf.df
  CHROM  POS ID REF ALT QUAL FILTER               INFO FORMAT Steven
0  chr1  100  .   G   A    .      .                 DB     GT    0/0
1  chr1  101  .   T   C    .      .  DB;H2;Match=EXACT     GT    0/1
2  chr1  102  .   A   T    .      .  DB;H2;Match=EXACT     GT    0/1
3  chr1  103  .   C   A    .      .                  .     GT    0/0
&gt;&gt;&gt; vf.filter_flagany(['Match=EXACT'], opposite=True).df
  CHROM  POS ID REF ALT QUAL FILTER INFO FORMAT Steven
0  chr1  100  .   G   A    .      .   DB     GT    0/0
1  chr1  103  .   C   A    .      .    .     GT    0/0
&gt;&gt;&gt; # vf.to_file('filtered.vcf')
</code></pre>

CC BY-SA 4.0
2021-06-10T21:01:55.400Z
2021-06-11T15:58:22.827Z
2021-06-11T15:58:22.827Z
Seung-been Steven Lee
<p>Hard to say without seeing VCF rows, but generally speaking with text files you can use <code>grep</code>, if I understand the question:</p>
<pre><code>grep -vw &quot;Match=EXACT&quot; file.vcf &gt; filtered.vcf
</code></pre>

CC BY-SA 4.0
2021-03-24T20:46:00.707Z
2021-03-30T19:05:38.273Z
2021-03-30T19:05:38.273Z
Maximilian Press
<p>How do I remove rows in a VCF file on 1kGenome column, where Match=EXACT using bash ?</p>

CC BY-SA 4.0
2021-03-24T17:06:59.303Z
Please edit your question to include a couple of relevant lines from your .vcf.
user438383
<vcf><ngs><bash><filtering><data-preprocessing>
Filter rows of VCF file for Match=EXACT?
# Filter rows of VCF file for Match=EXACT?

(Asked by: username_0 on 2021-03-24)

How do I remove rows in a VCF file on 1kGenome column, where Match=EXACT using bash ?

**Tags:** vcf, ngs, bash, filtering, data-preprocessing
> **Comments:**
> **username_1**: Please edit your question to include a couple of relevant lines from your .vcf.  

---

## 2 answers

### Answer by username_2 on 2021-06-10. Score: 2

You can filter records in Python for example using pyvcf.VcfFrame.filter_flagany() method I wrote:
>>> from fuc import pyvcf
>>> data = {
...     'CHROM': ['chr1', 'chr1', 'chr1', 'chr1'],
...     'POS': [100, 101, 102, 103],
...     'ID': ['.', '.', '.', '.'],
...     'REF': ['G', 'T', 'A', 'C'],
...     'ALT': ['A', 'C', 'T', 'A'],
...     'QUAL': ['.', '.', '.', '.'],
...     'FILTER': ['.', '.', '.', '.'],
...     'INFO': ['DB', 'DB;H2;Match=EXACT', 'DB;H2;Match=EXACT', '.'],
...     'FORMAT': ['GT', 'GT', 'GT', 'GT'],
...     'Steven': ['0/0', '0/1', '0/1', '0/0'],
... }
>>> vf = pyvcf.VcfFrame.from_dict([], data)
>>> # vf = pyvcf.VcfFrame.from_file('your_vcf.vcf')
>>> vf.df
  CHROM  POS ID REF ALT QUAL FILTER               INFO FORMAT Steven
0  chr1  100  .   G   A    .      .                 DB     GT    0/0
1  chr1  101  .   T   C    .      .  DB;H2;Match=EXACT     GT    0/1
2  chr1  102  .   A   T    .      .  DB;H2;Match=EXACT     GT    0/1
3  chr1  103  .   C   A    .      .                  .     GT    0/0
>>> vf.filter_flagany(['Match=EXACT'], opposite=True).df
  CHROM  POS ID REF ALT QUAL FILTER INFO FORMAT Steven
0  chr1  100  .   G   A    .      .   DB     GT    0/0
1  chr1  103  .   C   A    .      .    .     GT    0/0
>>> # vf.to_file('filtered.vcf')


---

### Answer by username_3 on 2021-03-24. Score: 1

Hard to say without seeing VCF rows, but generally speaking with text files you can use grep, if I understand the question:
grep -vw "Match=EXACT" file.vcf > filtered.vcf


---

