Question: (Closed) Reorder Set Of Ids In Plink
0
gravatar for Joey
6.7 years ago by
Joey410
Seattle
Joey410 wrote:

I have a dataset in PLINK binary format (bed/bim/fam) and this contains unrelated and related (family) individuals.

The FAM file looks like the following:

1553 1553_10 0 0 1 2
1553 1553_03 0 0 2 1
1555 1555_14 0 0 2 1
2001 2001_05 0 0 2 2
1558 1558_05 0 0 2 2
1559 1559_09 0 0 1 1
1021 1021_07 0 0 1 2
1021 1021_09 0 0 1 2
1555 1555_03 0 0 2 2

I need to create a dataset where the IDs are ordered and individuals from the same family appear one after another. Frr this, I think I just need to sort the IDs and create a new plink binary file i.e. the new file should have this as the order of IDs.

1021 1021_07 0 0 1 2
1021 1021_09 0 0 1 2
1553 1553_10 0 0 1 2
1553 1553_03 0 0 2 1
1555 1555_03 0 0 2 2
1555 1555_14 0 0 2 1
1558 1558_05 0 0 2 2
1559 1559_09 0 0 1 1
2001 2001_05 0 0 2 2

I can't seem to get the right option to do this in PLINK.

Thanks,

plink • 2.3k views
ADD COMMENTlink modified 6.7 years ago • written 6.7 years ago by Joey410

Edited to correct the formatting. Please indent lines of data with 4 spaces. Note that questions are previewed as you type, so you can see when things look right.

ADD REPLYlink written 6.7 years ago by Neilfws48k
1
gravatar for Joey
6.7 years ago by
Joey410
Seattle
Joey410 wrote:

Firstly, sorry for the bad format. Thanks for the edit.

I couldn't find a way to re-order in PLINK. I did solve this problem, but not sure if this is the best way.

a) I sorted the FAM file, kept FID and IID and generated a variable to identify families. I used that variable in a for loop to split the dataset into unique families and save each in a different text file (same format we need "--keep" option in PLINK.).

b) Ran PLINK using a loop to generate PLINK files (bed/bim/fam) for each family.

c) Merged them back together by creating a merge list and using the "----merge-list" option in PLINK.

ADD COMMENTlink modified 6.7 years ago • written 6.7 years ago by Joey410

thanks for following up!

ADD REPLYlink written 6.7 years ago by Istvan Albert ♦♦ 81k
Please log in to add an answer.
The thread is closed. No new answers may be added.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 820 users visited in the last hour