There are two different kinds of .bed
files in bioinformatics; one related to storing genomic coordinate data and one which is part of the plink binary dataset, so it's important to check which kind of file you are actually converting. If you have .bed
, .bim
and .fam
files, you could use PLINK 2.0 to export them as VCF:
plink2 --bfile [prefix] --export vcf --out <prefix>
The relevant options from the docs:
<...>
--bfile <prefix> ['vzs'] : Specify .bed + .bim[.zst] + .fam prefix
<...>
--out <prefix> : Specify prefix for output files.
<...>
--export <output format(s)...> [{01 | 12}] ['bgz'] ['id-delim='<char>]
['id-paste='<column set descriptor>] ['include-alt']
['omit-nonmale-y'] ['spaces'] ['vcf-dosage='<field>] ['ref-first']
['bits='<#>] ['sample-v2']
Create a new fileset with all filters applied. The following output
formats are supported:
...
* 'vcf', : VCF (default version 4.3). If PAR1 and PAR2 are present,
'vcf-4.2', they are automatically merged with chrX, with proper
'bcf', handling of chromosome codes and male ploidy.
'bcf-4.2' When the 'bgz' modifier is present, the VCF file is
block-gzipped. (This always happens with BCF output.)
The 'id-paste' modifier controls which .psam columns are
used to construct sample IDs (choices are maybefid, fid,
iid, maybesid, and sid; default is maybefid,iid,maybesid),
while the 'id-delim' modifier sets the character between the
ID pieces (default '_').
...