This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Plink: Getting IDs of Individuals in a BED File

Hello,

I am currently working with a bed file that I filtered for individuals and variants matching a preselected list (CHR:POS:REF:ALT). I am presently having difficulty getting the individual IDs of the remaining individuals in the dataset, i.e. those who have the preselected variants. My FAM file lists all individuals in the original cohort. I know for a fact that all individuals do not harbor these variants (rare variants). Any advice? I need the IDs to link to clinical data.

plink plink2 bed

1 answer

I was able to answer my own question. The key is to use the "recode" function with plink. So

./plink --bfile PLINK_FILE --extract VARIANTS.txt --make-bed --out OUT --recodeAD

You can then read the ".raw" file outputted by recode in R, isolate rows where is at least one "1" for the allele columns, and you then have the IIDs and FIDs for individuals hosting your variant alleles of interest.

Log in to answer this question.