This is a test version of Biostars. For the public version, visit https://www.biostars.org.
PLINK: merge .bed files

Hi,

I had a set of .bed,.bim, .fam files (myfile1.bed, myfile2.bed, ...) that I wanted to merge to get one file in .bed , bim, fam format.

I am trying:

plink --file myfile1 --merge-list all_my_files.txt --make-bed --out mymerged

where all_my_files.txt is a file containing the filepaths for the files I want merged (myfile2, myfile3, ....)

However, I get the following error:

ERROR: No file [ myfile1.ped ] exists.

How can I specify that I want my bed (and not ped) files merged into a new bed file?

Many thanks!

plink

Aren't you merging binary files? You should use --bfile:

plink --bfile myfile1 --merge-list all_my_files.txt --make-bed --out mymerged

Hi alesssia,

Thanks for that. My command is now:

plink --bfile myfile1 --merge-list all_my_files.txt --make-bed --out mymerged

and my all_my_files.txt now contains:

myfile10.bed
myfile10.bim
myfile10.fam
myfile11.bed
myfile11.bim
myfile11.fam
.
.
.

Does this look like the right command, and does my file list contain the correct nomenclature/order of the files?

thanks!!

3 answers

The --merge-list (without a preceding b) flag is also used to merge multiple binary filesets; see alesssia's link.

Note that you cannot split a fileset across multiple lines of the --merge-list file; i.e. bsmith030465's sample all_my_files.txt is not in the correct input format. Either fully spell out all three filenames on the same line in .bed-.bim-.fam order, or include just the common prefix (this latter mode is only supported by PLINK 1.9).

plink --bfile myfile1 --bmerge-list all_my_files.txt --make-bed --out mymerged

should work.

I use plink v1.07, and merged bed files using command:

plink --merge-list allfiles.txt --make-bed --out mynewdata
#error: plink --noweb --bfile fA --merge-list allfiles.txt --make-bed --out mynewdata
#please do not use bfile, or file, or else it will combine the first file without pruned, damn it!!

the allfiles.txt shows like:

fA.ped fA.map
fB.ped fB.map
fC.ped fC.map
fD.ped fD.map
fE.bed fE.bim fE.fam
fF.bed fF.bim fF.fam
fG.bed fG.bim fG.fam
fH.bed fH.bim fH.fam

Important:

Each fileset must be on a line by itself: lines with two files are interpreted as PED/MAP filesets; lines with three files are interpreted as binary BED/BIM/FAM filesets. The files on a line must always be in this order (PED then MAP; BED then BIM then FAM)

Log in to answer this question.