This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Plink Raw Format To Ped Format

Hi I have ped file in plink raw format (0, 1, 2 of minor allele). I want to convert it to ped format. Is there program which can do this? If not can someone help me with a script to complete the task.

Thanks, M

plink snps ped

I have generated the raw format file with --recodeA option in plink. I want to convert these files back to ped format.

M

this should be a comment to an answer, not an answer itself.

When using --recodeA you had an original file that was used to create this raw format, what happened to that original file?

Did you figure out how to do this? I'm having the same issue. I have the raw file but not the .ped or .bed files from which it was generated.

2 answers

I haven't heard of that plink "raw format". the most common one is indeed the PED format, plus its binary version BED. all the data formats supported by plink and the conversions from one to another are very well described in that documentation.

EDIT: the "--recode" option generates the standard PED format. if you need the binary PED format (BED) the "--make-bed" option is needed.

I have pedigree file in dosage format

FID IID PAT MAT SEX PHENOTYPE rs138257042_G rs141845380_C rs116378360_C a2x

100 001 016 017 2 2 NA NA NA 1

100 005 004 001 1 -9 2 2 1 1

100 008 007 006 1 1 2 2 2 2

and map file

22 rs138257042 0.027263 16449075 A G

22 rs141845380 0.027263 16449076 G A

22 rs116378360 0.027547 16620701 T C

22 a2x 0.027549 16620722 T C

I want to convert it to plink ped file. Please suggest some program or script to complete the task.

M

the first file, what you call a dosage format, is almost a PED file. you simply have to change all the "NA" codes for "-9":

sed 's/NA/-9/g' dosagefile > pedfile

the second one is a typical BIM format, which is almost a MAP. you simply have to remove the last 2 allele columns:

cut -f1-4 bimfile > mapfile

once transformed, you'll be able to load them directly into plink.

Leaving this here in case people still run into this problem. I implemented a suggestion from Chris Chang to beat a dosage file (subset of PLINK RAW) through a PLINK formatting pipeline. The output can be PED/MAP, BED/BIM/BAM, or whatever other PLINK output you like.

See discussion here.

KLK

Log in to answer this question.