Skip to content

rlichtenwalter/pg_imputed_genotype

Repository files navigation

pg_imputed_genotype

an efficient, packed probability tuple suitable for imputed genotypes

Description

The general functionality of this type is to support a probability-triple stored in 4 bytes. Each probability is recorded in 10-bits as a positive integer ranging from 0 to 1000. Operators for I/O have been carefully selected based on benchmarking on recent x86_64 hardware. The storage of a probability triple with 10-bits of precision per probability makes this type ideal for storing imputed genotype data in PostgreSQL arrays.

Installation

curl -s -S -L https://github.com/rlichtenwalter/pg_imputed_genotype/archive/master.zip > pg_imputed_genotype.zip
unzip pg_imputed_genotype.zip
(cd pg_imputed_genotype-master && make PG_CONFIG=<optional custom pg_config path>)
(cd pg_imputed_genotype-master && make PG_CONFIG=<optional custom pg_config path> install)
(cd ~postgres && sudo -u postgres psql -c 'CREATE EXTENSION pg_imputed_genotype;')

Usage

testuser=# SELECT '{0.5,0.5,0.0}'::imputed_genotype;
 imputed_genotype
------------------
 {0.500,0.500,0}
(1 row)

testuser=# SELECT '{0.5,0.5,0.1}'::imputed_genotype; ERROR: imputed_genotype probabilities must sum to <= 1.0: "{0.5,0.5,0.1}" LINE 1: SELECT '{0.5,0.5,0.1}'::imputed_genotype; ^

testuser=# SELECT '{0.2,0.5,0.1}'::imputed_genotype; imputed_genotype --------------------- {0.200,0.500,0.100} (1 row)

About

an efficient, packed probability tuple suited for imputed genotypes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors