Error: Invalid .bed file size (expected 9996779 bytes)

164 views
Skip to first unread message

Hena Jose

unread,
Sep 11, 2023, 9:38:37 AM9/11/23
to plink2-users

Hello Christopher,

We have data in PGEN format, and as part of our workflow, we initially created temporary PSAM, PVAR, and PGEN files using the following command:
./plink2 --bgen data.bgen ref-first --sample data.sample --set-missing-var-ids @:#:'\$r':'\$a' --new-id-max-allele-len 99 truncate --make-pgen --out data.intermediate

 2. Following this step, we convert these temporary files to the BED, BIM, and FAM file format using the command:
./plink2 --pfile data.intermediate --chr "${chrm}" --from-bp "${upstream_start}" --to-bp "${downstream_end}" --make-bed --out cons_imp_data_sep_8th

These two steps are essential components of our workflow. However, when attempting to run an association analysis on the resulting BED file using the following command:
./plink2 --bfile cons_imp_data_sep_8th --glm --out test_assoc --covar cons_imp_data_sep_8th_imp_generic.cov --covar-name Sex --pheno constipation_cc.phe --pheno-name constipation_cc
log file information:
PLINK v2.00a4.4LM 64-bit Intel (21 Jun 2023)   www.cog-genomics.org/plink/2.0/
(C) 2005-2023 Shaun Purcell, Christopher Chang   GNU General Public License v3
Logging to test_assoc.log.
Options in effect:
  --1
  --bfile cons_imp_data_sep_8th
  --covar cons_imp_data_sep_8th_imp_generic.cov
  --covar-name Sex
  --glm
  --out test_assoc
  --pheno constipation_cc.phe
  --pheno-name constipation_cc
Start time: Mon Sep 11 18:21:10 2023
7882 MiB RAM detected, ~7185 available; reserving 3941 MiB for main workspace.
Using up to 4 compute threads.
48352 samples (26548 females, 21804 males; 48352 founders) loaded from
cons_imp_data_sep_8th.fam.
827 variants loaded from cons_imp_data_sep_8th.bim.
Error: Unexpected PLINK 1 .bed file size (expected 9996779 bytes).
End time: Mon Sep 11 18:21:10 2023
We encounter an error message stating, 'Unexpected PLINK 1.bed file size (expected 9996779 bytes).' 
While it may initially appear to be a file size issue, we believe there might be other issues contributing to this error. Because we have successfully run association analyses on smaller files without encountering this particular error.

We would appreciate any guidance or insights into resolving this issue and successfully conducting our association analysis.

Thank you in advance

Hena Jose

Christopher Chang

unread,
Sep 11, 2023, 1:05:13 PM9/11/23
to plink2-users
This implies that you mismanaged your .bed+.bim+.fam fileset, in the sense that at least one of those files was not generated by the same command as the other two.  Look for this type of mistake in your scripts.

Hena Jose

unread,
Sep 13, 2023, 4:51:04 AM9/13/23
to plink2-users
Thank you Christopher once again. 
We were able to fix the bug and move ahead

Regards
Hena

Reply all
Reply to author
Forward
0 new messages