This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Plink recode option to get genomic position?

Is there a command to pull SNPs IDs and loci out of a bfile using plink? maybe something along the lines of the --recode option?

plink snp locus

Is it not possible with plain awk? Is the bfile a binary file?

It is a binary file yes.

1 answer

Plink binary format output has 3 files:

  • bed - binary for genotypes
  • bim - plain text map file for SNPs
  • fam - plain text for samples.

2nd column of bim file is SNP id:

  1. Chromosome code (either an integer, or 'X'/'Y'/'XY'/'MT'; '0' indicates unknown) or name
  2. Variant identifier
  3. Position in morgans or centimorgans (safe to use dummy value of '0')
  4. Base-pair coordinate (1-based; limited to 231-2)
  5. Allele 1 (corresponding to clear bits in .bed; usually minor)
  6. Allele 2 (corresponding to set bits in .bed; usually major)

So we can get the second column, for example, using cut as:

cut -f2 myBim.bim > mySNPs.txt

Log in to answer this question.