1
$\begingroup$

I am doing some whole-genome sequence analysis and to speed things up split the data into chromosomes and also into regions within those chromosomes. (So I have my dataset split into ~300ish files) I am doing some IBD analysis with plink files and to do this IBD analysis I am combining the files into one big plink file.

I ran into issues today where when using plink 1.9 and the --bfile and --merge-list commands, the output fam file is different from the input fam file. My dataset has related individuals so the fam file is very important. Also its is important to note that when using binary files the order in the fam file needs to be exactly the same as the order the individuals appear in the other files (I learned this the hard way haha).

Does anyone know why plink 1.9 changes the order in the fam file when merging plink files, and how to fix this? It works with plink 1.07 but with 1.9 I get a different fam file.

Performing "diff" on input and output fam files shows they are different:

plink=$mydir/bin/plink_1_9/plink

$plink --noweb --bfile $indir/chr22/285/$prefix.chr.22.region.285.qc --merge-list $indir/chr22/merge_list.txt --make-bed --out $indir/chr22/$prefix.chr.22.qc

Using the same code but using plink-1.07 creates matching fam files as expected"

plink1=bin/plink-1.07-x86_64/plink
$plink1 --noweb --bfile $indir/chr22/285/$prefix.chr.22.region.285.qc --merge-list $indir/chr22/merge_list.txt --make-bed --out $indir/chr22/$prefix.chr.22.qc

The merge_list.txt file is in this format:

$indir/chr22/286/$prefix.chr.22.region.286.qc.bed $indir/chr22/286/$prefix.chr.22.region.286.qc.bim $indir/chr22/286/$prefix.chr.22.region.286.qc.fam
$indir/chr22/287/$prefix.chr.22.region.287.qc.bed $indir/chr22/287/$prefix.chr.22.region.287.qc.bim $indir/chr22/287/$prefix.chr.22.region.287.qc.fam
$indir/chr22/288/$prefix.chr.22.region.288.qc.bed $indir/chr22/288/$prefix.chr.22.region.288.qc.bim $indir/chr22/288/$prefix.chr.22.region.288.qc.fam

Can someone explain to me why this could be happening and if there is a way to fix it? Thanks so much!!

(Note, I know I can manually replace the fam file with the correct one with cp or mv, but I would like to know how to handle this with plink 1.9, if possible, as I am afraid it could be indicative of an underlying error in the merge process :) )

$\endgroup$

1 Answer 1

2
$\begingroup$

Thanks Christopher Chang for the great answer via the plink2 google group! (See here)

His answer was as follows:

"Yes, plink 1.9 did change the default merged sample order. However, you can request plink 1.07’s behavior by adding “--indiv-sort 0” during the merge. (You can also use --indiv-sort + --make-bed at any time to change the sample order to whatever you want.)

As for why the default was changed, take a look at the new default order: it will probably make a lot of sense. It’s “natural-sorted” which tends to make it easy for humans to manually search through regardless of what mix of letters and numbers are used in the IDs."

See also the Plink 1.9 documentation for --indiv-sort which makes the point that this behavior is default only for merges--in other commands Plink 1.9 uses the same ordering as in Plink 1.07, which is the order the samples were in.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.