Convert bfile to bgen files

124 views
Skip to first unread message

Z S

unread,
Mar 31, 2023, 10:00:17 PM3/31/23
to plink2-users
Hi experts,
Recently, I wanted to convert bfile to bgen files by using plink2. fam is like this:
4745615 4745615 0 0 1 -9
4478283 4478283 0 0 2 -9
1206994 1206994 0 0 2 -9
3936245 3936245 0 0 1 -9
1800882 1800882 0 0 2 -9
5936174 5936174 0 0 1 -9
3710063 3710063 0 0 1 -9

bim file is like this:
22 rs587769434 0 16050527 C A
22 rs62224609 0 16051249 T C
22 rs587740681 0 16051493 G A
22 rs376238049 0 16052962 C T
22 rs62224614 0 16053862 C T
22 rs7286962 0 16054454 C T
22 rs9604721 0 16054713 C T
22 rs587757625 0 16054888 A G

Every file is organized. And then I used the following command line to convert
plink2 \
--bfile chr_v2_r2correct_v2_chr22 \
--export bgen-1.2 \
--out imp_chr22_v3_bgen1.2 \
--extract imp_chr22_v3_snp_gwas.txt \
--keep sample31391_ind_fid.txt

After converting,  bgen file has a corresponding sample file, like this:
ID_1 ID_2 missing sex
0 0 0 D
4745615 4745615 0.018239 1
4478283 4478283 0.0159293 2
1206994 1206994 0.0170503 2
3936245 3936245 0.0187477 1
1800882 1800882 0.0143084 2
5936174 5936174 0.0165596 1
3710063 3710063 0.0178473 1

Everything is as usual. And then I used these bgen files to run GWAS analysis with BGENIE toolbox. Everything works very well, no bugs. But, there is something wrong with the output, especially for the allele frequency. The output is like below:
chr rsid pos a_0 a_1 allele_freq
22 rs62224609 16051249 T C 0.0892135
22 rs376238049 16052962 C T -0.1355
22 rs62224614 16053862 C T 0.081249
22 rs7286962 16054454 C T 0.074783
22 rs117246541 16055122 G T -0.42407
22 rs62224618 16057417 T C 0.89906
22 rs372511672 16062988 C T -0.18701
22 rs2844853 16063369 C T -0.19622

So, we can see there are lots of SNP with negative allele frequency, which should be not correct. I previously used BGENIE toolbox to run lots of GWAS analyses, so I guess BGENIE could not correctly read genetic information from bgen files converted from bfile by PLINK2

Do you have any thoughts on how to convert bfiles to the bgen files that BGENIE is able to read? Any suggestions would be appreciated.

Thanks,
Cain

Chris Chang

unread,
Apr 1, 2023, 11:29:45 AM4/1/23
to Z S, plink2-users
Please post or send me a set of files (could contain just one variant) and command lines that allows me to replicate the negative BGENIE allele frequency you are seeing.

--
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 on the web visit https://groups.google.com/d/msgid/plink2-users/da296cf3-22e2-4a70-a227-e5434f5b0a3en%40googlegroups.com.
Reply all
Reply to author
Forward
Message has been deleted
Message has been deleted
0 new messages