I'm not sure if I fully understood your situation correctly, but you may want to check out the `pyvcf` [submodule](https://sbslee-fuc.readthedocs.io/en/latest/api.html#module-fuc.api.pyvcf) I wrote if you are familiar with Python:

```
from fuc import pyvcf

vcf_files = ['sample1.vcf', 'sample2.vcf', ..., 'sampleN.vcf']
bed_files = ['sample1.bed', 'sample2.bed', ..., 'sampleN.bed']

vf_list = []

for i, vcf_file in enumerate(vcf_files):
vf = pyvcf.VcfFrame.from_file(vcf_file) # Create a VcfFrame object for each sample.
filtered_vf = vf.filter_bed(bed_files[i]) # Filter each VcfFrame by the sample's BED file.
vf_list.append(filtered_vf)

merged_vf = pyvcf.merge(vf_list, how='outer') # Merge all the VcfFrame objects.
final_vf = merged_vf.filter_sampnum(0.9) # Select rows where 90% of the samples have the variant.
bf = final_vf.to_bed() # This creates a BedFrame object.
bf.to_file('final.bed')
```



Source link