This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Plink2 --keep Removing All Samples

I am trying to include the --keep and --remove options in my plink2 command. I am finding that despite my files for these options having identical text to the main file's IDs, all the samples are removed.

Command: plink2 --bfile  pca_final --keep EUR.sample --remove toberemoved.txt \
--make-bed --out unrelated_EUR

So my original .fam file has:

0002

The --keep file would have:

#FID    IID
0002    0002

The --remove file would have:

#FID    IID
1067    1067
plink plink2

Do you have the full header of the .fam file? The file format of your .fam seems to be wrong.

0   0002    0   0   0   -9
0   0005    0   0   0   -9
0   0007    0   0   0   -9
0   0008    0   0   0   -9
0   0009    0   0   0   -9

The code I used to make the given fam and other files:

plink2 --vcf $FILE_PATH --make-bed --out working/all_vcf_for_pc --threads 4 --max-alleles 2

plink2 --bfile all_vcf_for_pc --chr 1-22 --exclude range LD_exclude_grch38_pca.txt --geno 0.05 --hwe 1E-6 midp --indep-pairwise 50 5 0.05 \
--keep-allele-order --mac 5 --maf 0.01 --out bqc19_pca --threads 4

plink2 --bfile all_vcf_for_pc --extract pca.prune.in --make-bed --out pca_final

1 answer

I was able to figure out the issue. The FID column (the first column in the fam file) was all zeroes and I put text there as I was confused by the format used by my colleague.

Log in to answer this question.