This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Convert .gprobs files to PLINK format

Hello all, I have some imputed .gprobs files (one per chromosome), imputed by Impute2 downloaded from dbGaP, and I need to convert this file into .bed format of PLINK in order to do some analysis.

My .gprobs files look like:

--- rs371609562:61395:CTT:C 61395 CTT C 0 0.023 0.977 0 0.039 0.961 0 0.015 0.985 0 0.026 0.974 0 0 1 0 0 1 0 0 1

Could someone help me find out how convert this kind of file into PLINK format? Or guide me about which files I need to perform the convertion?

gprobs snp plink genome dbgap

Thanks. I have seen that post, and tried some tools from there, but I lost some information in the process so I posted my own question to see if anyone know a direct conversion for my data, that is not the same that the one in that post.

1 answer

If you want to just round dosages to the nearest integer (and erase the dosages which are too far from an integer), you can use plink 1.9's --gen flag to import this type of file. (You'll also need to use --oxford-single-chr to address the '---' chromosome codes.)

If you want to actually save the dosages and use them in association analysis, etc., use plink 2.0, and --make-pgen instead of --make-bed.

I've tried the following code:

plink --gen file_chr10.gprobs.gz --sample file.sample --oxford-single-chr 10 --make-bed --out output

It started converting variants, but then it gave an error:

Error: File read failure.

And I don´t know why it gives this error.

I think it could be because I didn't extract the sample.gz file, because it gives me an error, instead I did less file.sample.gz > file.sample

Any lead about how to extract properly the file.sample.gz? I've tried gunzip and other tools

I know this thread is ~3 years old, but just adding this in case someone comes here looking for this answer...

That code should work, but plink can't read zipped (.gz) files. So, you first need to unzip (using gunzip).

gunzip file_chr10.gprobs.gz

And then run:

plink --gen file_chr10.gprobs --sample file.sample --oxford-single-chr 10 --make-bed --out output

Incidentally, all plink 2.0 text-file-reading commands (including --gen) accept gzipped input. You're correct that this isn't true for plink 1.9, though.

Log in to answer this question.