plinks 2 haps files error

11 views
Skip to first unread message

E C

unread,
Jul 11, 2025, 4:14:49 PMJul 11
to plink2-users
Hello,

I use plink2 quite frequently for my research, and I've run into an issue that I know is a known problem concerning haps files. I need to generate a genotype matrix (012) to run some phenotypic simulations, and what used to work (or maybe I didn't catch this problem until now) no longer does. Before, I think I used plink-ng (? now deprecated for a year or more) to convert beagle files into haps files to then use farther down my pipeline. Recently I realized that if I run this code (as seen in my first screenshot where I run the --vcf flag), I get an N haps file rather than a 2N, as I thought I was getting.

This throws a huge wrench into my pipeline, so I thought to use bcftools to generate the haps/legend files instead and generate the geno matrix from those as before. However, I continually get this error (second screenshot of terminal output). However, I have checked and there is no header column, and the format of this file is as is expected for a haps file--and I believe that these flags allow for both 2N and 2N +5 meta fields, and I have tried both with no success. I've also tried changing the legend flag arguments, no success (third screenshot). Essentially I just want to take these haps files, convert to bed files, then generate the genotype matrix. My concern is that if these files fail at this step, they will fail at other steps on my pipeline that also use plink2 utility for haps files.  For context, I'm uploading my screenshot of the code I used to generate the haps and legend files with bcftools. 

Included in this email are files to reproduce my error, any guidance or insight is much appreciated. 
Screenshot 2025-07-11 at 12.43.36 PM.png
Screenshot 2025-07-11 at 12.51.09 PM.png
repro_plink2.zip
Screenshot 2025-07-11 at 12.41.50 PM.png
Screenshot 2025-07-11 at 12.53.02 PM.png

Chris Chang

unread,
Jul 11, 2025, 4:32:03 PMJul 11
to E C, plink2-users
For the unexpected "N haplotype matrix, not 2N as expected" behavior, please post a .beagle.vcf.gz file (could be e.g. truncated down to just the first few variants) and the corresponding --vcf + --export hapslegend log.

--
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/79351fe0-526d-4489-8bde-71c70ca3984cn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages