Question: Merging bed bim fam files from chromosome 1 to 22 at one time
0
gravatar for khn
2.6 years ago by
khn110
khn110 wrote:

Hello,

I am trying to merge multiple bed bim fam files (each chromosome has separate file) into one file.

plink --allow-no-sex --bfile XX.chr1 --merge-list mylist.txt --make-bed --out XX.ch1-22

This does not work.

mylist.txt contains:

XX.chr2.bed XX.chr2.bim XX.chr2.fam
XX.chr3.bed XX.chr3.bim XX.chr3.fam
XX.chr4.bed XX.chr4.bim XX.chr4.fam
...
XX.chr22.bed XX.chr22.bim XX.chr22.fam

Thank you in advance!

snp genome • 5.4k views
ADD COMMENTlink modified 8 months ago by Shicheng Guo8.4k • written 2.6 years ago by khn110

Is plink giving you an error? Otherwise, please define "does not work".

ADD REPLYlink written 2.6 years ago by Devon Ryan97k

Yes, it says that "cannot open the file XX.chr2.fam". What would you think is wrong?

ADD REPLYlink written 2.6 years ago by khn110

Does that file exist?

ADD REPLYlink written 2.6 years ago by Devon Ryan97k

Yes. I changed the txt file to csv file, but it still says "Error: Failed to open XX.chr2.fam."

ADD REPLYlink modified 2.6 years ago • written 2.6 years ago by khn110

Message is as below... What would you think is wrong??

*** MB RAM detected; reserving *** MB for main workspace.
.ped scan complete (for binary autoconversion).
Performing single-pass .bed write (*** variants, *** people).
--file:
XX.ch1-22-temporary.bed
+
XX.ch1-22-temporary.bim
+
xx.ch1-22-temporary.fam
written.
Error: Failed to open XX.ch2.fam.
ADD REPLYlink modified 8 months ago by RamRS30k • written 2.6 years ago by khn110

@khn How did you solve this problem? I am also new to plink. I am facing the same problem. How can we merge multiple binary files of different chromosomes using plink?

ADD REPLYlink written 21 months ago by bk1140

I have a similar trouble, but it seems to be different.

After conduct of command described in this page,

XX.ch1-22-merge.fam
XX.ch1-22-merge.missnp
XX.ch1-22.log

were generated, and no XX.ch1-22-merge.bed XX.ch1-22-merge.bim.

Is there any solutions?

ADD REPLYlink modified 8 months ago by RamRS30k • written 11 months ago by T.F0
2
gravatar for mike313177
12 months ago by
mike31317720
mike31317720 wrote:

Hi, it seems I just solved my problem on this issue. It may worth to check the file path in your merge-list text file, which means you need to make sure each path is really directed to the corresponding bed/bim/fam file, not just the file name, but the completed path to it. Hope it helps. Xiao

ADD COMMENTlink written 12 months ago by mike31317720
2
gravatar for chrchang523
11 months ago by
chrchang5237.3k
United States
chrchang5237.3k wrote:

See https://www.cog-genomics.org/plink/1.9/data#merge3 .

ADD COMMENTlink written 11 months ago by chrchang5237.3k
2
gravatar for Shicheng Guo
8 months ago by
Shicheng Guo8.4k
Shicheng Guo8.4k wrote:

Here is the solution:

Be careful, before you merge different plink files, check the duplicate SNPs and remove them! and You'd better remove non-ATCG variants before merging, such as . in the dataset. Here, suppose you have chr1, chr2 .... and want to merge them.

rm mergelist.txt

for i in {1..22}
do
echo chr$i >> mergelist.txt
done

plink --merge-list mergelist.txt --make-bed --out G1000plink
ADD COMMENTlink modified 8 months ago • written 8 months ago by Shicheng Guo8.4k

Why the rm? OP's commands do not show an existing file by that name.

ADD REPLYlink written 8 months ago by RamRS30k

See https://www.cog-genomics.org/plink/1.9/data#merge3 .

ADD REPLYlink written 8 months ago by Shicheng Guo8.4k

What is in there that justifies your rm command?

ADD REPLYlink written 8 months ago by RamRS30k

You comment helped me Shicheng Guo. Thank you!

ADD REPLYlink written 4 months ago by arctic20
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1305 users visited in the last hour