Is it possible to compile plink2 as a library?

65 views
Skip to first unread message

Kaiyin Zhong

unread,
Jan 13, 2015, 1:26:17 PM1/13/15
to plink...@googlegroups.com
I haven't looked into plink2 source, but I imagine there must be quite some linear algebra / statistics routines implemented for the compact binary .bed format, since the genotype number for each SNP is stored in 2 bits, while the minimum size for short and int is 16 bits, therefore the usual LA/stats libraries will not apply.

So my question is, is it possible to compile plink as a library, so that developers can take advantage of these numerical implementation and use the .bed format for new applications without reinventing the wheel?

Christopher Chang

unread,
Jan 13, 2015, 2:28:48 PM1/13/15
to plink...@googlegroups.com
This isn't directly supported.  However, for many purposes, the following will work:

1. Copy plink_common.c/plink_common.h and SFMT.c/SFMT.h into your source file directory.
2. Replace the '#include "zlib-1.2.8/zlib.h"' line in plink_common.h with '#include <zlib.h>'.
3. Add '#include "plink_common.h"' on top of any file using plink_common functions.

(Apologies in advance for any namespace conflicts caused by plink_common #defines.)


On Tuesday, January 13, 2015 at 10:26:17 AM UTC-8, Kaiyin Zhong wrote:

Kaiyin Zhong

unread,
Jan 13, 2015, 4:29:51 PM1/13/15
to plink...@googlegroups.com
Great, thanks.

Are there plans to support plink2 usage as a library? If nice documentation is also provided, this could potentially reach a wide audience, even developers in languages other than c/c++, like clojure, python, R, etc. This also will give rise to possibilities of combining plink's high performance with an awesome REPL, making genetic data analysis much more enjoyable... and perhaps making you a demi-god. :-) 

Anyways, your hard work is much appreciated. The speed of plink2 is just amazing.
Reply all
Reply to author
Forward
0 new messages