different PCA outputs from seemingly equivalent code

8 views
Skip to first unread message

James Hemker

unread,
Mar 10, 2026, 7:39:04 PM (7 days ago) Mar 10
to plink2-users
Hello,

I have two different sets of plink2 commands from colleagues to generate eigenvals and eigenvecs for PCA. They appear to be equivalent to me, however the outputs end up being quite different, and I cannot understand why. It is my understand that the pgen and pfile files are simply the updated, more efficient versions of the bed and bfile files. Any insights would be very helpful, and I am happy to provide more information if needed.

Code 1:

plink2 --make-bed --vcf $vcf --allow-extra-chr --chr-set 38 --set-all-var-ids @:# --out $prefix

plink2 --vcf $vcf  --freq --allow-extra-chr --chr-set 38 --out $prefix

plink2 --bfile $prefix --read-freq ${prefix}.afreq --allow-extra-chr --pca 82 -chr-set 38 --out $prefix


Code 2 (the samples file has a list of all 82 samples in the VCF.):

plink2 --make-pgen --vcf $vcf --allow-extra-chr --chr-set 38 --rm-dup force-first --set-all-var-ids @:# --keep $samples --out $prefix

plink2 --freq --pfile $prefix --out $prefix

plink2 --read-freq "${prefix}.afreq" --pca 82 --pfile $prefix --out $prefix


I can see that the .afreq files differs in length after step 2 in each of the codesets (2910103 vs 2903391). Is one more correct than another?

Thank you!

Chris Chang

unread,
Mar 10, 2026, 8:09:06 PM (6 days ago) Mar 10
to James Hemker, plink2-users
1. Please post full .log files when asking for troubleshooting help.
2. In this case, I don’t know how much of a difference it made, but “Code 1” is missing —rm-dup in the first command, and its second command doesn’t refer to the output of the first (so variant IDs may be mismatched…).

--
You received this message because you are subscribed to the Google Groups "plink2-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to plink2-users...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/plink2-users/f2430e4c-327f-470b-a611-1eeb6bb7b84fn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages