add gt_alt_freqs column
MODIFY
docs/content/database_schema.rst
docs/content/database_schema.rst
@@ -67,6 +67,8 @@ gt_ref_depths BLOB | A compressed binary vector of the dept
| - Extracted from the VCF ``AD`` genotype tag.
gt_alt_depths BLOB | A compressed binary vector of the depth of alternate alleles observed for each sample
| - Extracted from the VCF ``AD`` genotype tag.
+gt_alt_freqs BLOB | A compressed binary (float) vector of the frequency of alternate alleles observed for each sample
+ | - equivalent to gt_alt_depths / (gt_alt_depths + gt_ref_depths)
gt_quals BLOB | A compressed binary vector of the genotype quality (PHRED scale) estimates for each sample
| - Extracted from the VCF ``GQ`` genotype tag.
gt_phred_ll_homref BLOB | A compressed binary vector of the phred-scaled genotype likelihood of the 0/0 genotype estimates for each sample

MODIFY
docs/content/history.rst
docs/content/history.rst
@@ -21,6 +21,7 @@ Release History
#. Update clinvar annotation.
#. Add new `gemini load` flag `--skip-pls` which can give size reductions for the database and speed Improvements
for querying and loading. If you never use `gt_phred_ll_homalt/het/homref` then you can load with this flag.
+#. Add new `gt_alt_freqs` column which is `gt_alt_dephts / (gt_ref_depths + gt_alt_depths)`.
0.19.1
======

MODIFY
gemini/database.py
gemini/database.py
@@ -135,6 +135,7 @@ def create_tables(path, effect_fields=None, pls=True):
gt_depths blob,
gt_ref_depths blob,
gt_alt_depths blob,
+ gt_alt_freqs blob,
gt_quals blob,
gt_copy_numbers blob,
%s,

MODIFY
gemini/gemini_bcolz.py
gemini/gemini_bcolz.py
@@ -58,6 +58,7 @@ gt_cols_types = (
('gt_depths', np.int32),
('gt_ref_depths', np.int32),
('gt_alt_depths', np.int32),
+ ('gt_alt_freqs', np.float32),
('gt_quals', np.float32),
('gt_copy_numbers', np.int32),
('gt_phred_ll_homref', np.int32),

MODIFY
gemini/gemini_load_chunk.py
gemini/gemini_load_chunk.py
@@ -524,6 +524,7 @@ class GeminiLoader(object):
gt_depths = var.gt_depths
gt_ref_depths = var.gt_ref_depths
gt_alt_depths = var.gt_alt_depths
+ gt_alt_freqs = var.gt_alt_freqs
gt_quals = var.gt_quals
#gt_copy_numbers = np.array(var.gt_copy_numbers, np.float32) # 1.0 2.0 2.1 -1
gt_copy_numbers = None
@@ -535,7 +536,7 @@ class GeminiLoader(object):
self._update_sample_gt_counts(gt_types)
else:
gt_bases = gt_types = gt_phases = gt_depths = gt_ref_depths = None
- gt_alt_depths = gt_quals = gt_copy_numbers = None
+ gt_alt_freqs = gt_alt_depths = gt_quals = gt_copy_numbers = None
if self.args.skip_info_string:
info = None
@@ -561,6 +562,7 @@ class GeminiLoader(object):
gt_types=pack_blob(gt_types),
gt_phases=pack_blob(gt_phases), gt_depths=pack_blob(gt_depths),
gt_ref_depths=pack_blob(gt_ref_depths), gt_alt_depths=pack_blob(gt_alt_depths),
+ gt_alt_freqs=pack_blob(gt_alt_freqs),
gt_quals=pack_blob(gt_quals), gt_copy_numbers=pack_blob(gt_copy_numbers),
call_rate=call_rate, in_dbsnp=bool(in_dbsnp),
rs_ids=rs_ids,

MODIFY
test/test-genotypes.sh
test/test-genotypes.sh
@@ -306,5 +306,21 @@ for a in gt_ref_depths gt_alt_depths gt_depths gt_types; do
done
done
+n=$(($n + 1))
+echo " genotypes.$n x..."
+echo "-1.0 -1 -1
+0.0 0 2
+0.0 0 3
+0.666666666667 2 1
+-1.0 -1 -1
+-1.0 -1 -1
+0.0 0 79
+-1.0 -1 -1
+0.142857142857 1 6
+0.0 0 4" > exp
+gemini query -q "select gt_alt_freqs.1094PC0009, gt_alt_depths.1094PC0009, gt_ref_depths.1094PC0009 from variants" test.snpeff.vcf.db \
+ > obs
+check obs exp
+rm obs exp

add gt_alt_freqs column