This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Plink --freq function

I have a set of files, with the names yripublished.bed, yripublished.bim, yripublished.fam

I got the frequencies of SNPs in these files with the following command:

/usr/local/sw/plink-1.90/plink --bfile yripublished --bed yripublished.bed --freq

This gives an output, where each SNP is defined by its rs ID. I need positions, not rs IDs. How can I accomplish that?

plink

Map file for SNPs (something like yripublished.bim) would have the positions already?

Yes I see the positions there. But I don't know how to replace the rs IDs with them.

bim file and the output of --freq file match row by row, so just use paste:

paste myfile.bim myfile.freq > myResult.txt

.bim files don’t have a header line, while the —freq output file does, so a bit more scripting would be required.

1 answer

Two ways to do this:

  1. Use a short shell script to paste in positions from the .bim file. If you do this, you need to account for the fact that .bim files don’t have header lines, while the --freq output file does.

  2. Use plink 2.0 --freq cols=+pos. plink 2.0 commands have optional output columns.

Log in to answer this question.