allow specifying gene selection in comp-het tool
closes
updates
MODIFY
docs/content/history.rst
docs/content/history.rst
@@ -8,8 +8,8 @@ Release History
0.20.1
======
-#. Allow `--gt-filter` to specify the gt_type, e.g. `(gt_quals).(=HET).(<20).(all)`
-
+#. Allow `--gt-filter` to specify the gt_type, e.g. `(gt_quals).(=HET).(<20).(all)` (thanks Jessica for suggesting)
+#. Add `--gene-where` argument to `comp_hets` tool to dictate how variants are restricted to genes. (thanks Jessica for suggesting)
0.20.0
======

MODIFY
docs/content/tools.rst
docs/content/tools.rst
@@ -273,6 +273,14 @@ We may also specify the families of interest:
$ gemini comp_hets --families 1 my.db
$ gemini comp_hets --families 1,7 my.db
+----------
+gene-where
+----------
+
+The default selection of genes is by the clause: `"is_exonic = 1 or impact_severity != 'LOW'"`
+This can be specified to limit to a different subset, e.g. `"gene != ''`
+
+
===========================================================================
``mendelian_error``: Identify non-mendelian transmission.
===========================================================================

MODIFY
gemini/gemini_main.py
gemini/gemini_main.py
@@ -690,6 +690,10 @@ def main():
help='Identify compound heterozygotes')
add_inheritance_args(parser_comp_hets, gt_ll=True, lenient=False)
+ parser_comp_hets.add_argument('--gene-where', dest="where",
+ default="is_exonic = 1 or impact_severity != 'LOW'",
+ help="""SQL clause to limit variants to genes. a reasonable alternative could be "gene != ''" """)
+
parser_comp_hets.add_argument('--pattern-only',
action='store_true',
help='find compound hets by inheritance pattern, without regard to affection',

MODIFY
gemini/gim.py
gemini/gim.py
@@ -376,14 +376,14 @@ class CompoundHet(GeminiInheritanceModel):
custom_columns = self._add_necessary_columns(str(args.columns))
query = "SELECT " + custom_columns + \
" FROM variants " + \
- " WHERE (is_exonic = 1 or impact_severity != 'LOW') "
+ " WHERE (%s) " % args.where
else:
# report the kitchen sink
query = "SELECT *" + \
", gts, gt_types, gt_phases, gt_depths, \
gt_ref_depths, gt_alt_depths, gt_quals" + \
" FROM variants " + \
- " WHERE (is_exonic = 1 or impact_severity != 'LOW') "
+ " WHERE (%s) " % args.where
if args.filter: query += " AND " + args.filter
# we need to order results by gene so that we can sweep through the results
return query + " ORDER BY chrom, gene"

MODIFY
test/test-comphet.sh
test/test-comphet.sh
@@ -232,3 +232,20 @@ gemini comp_hets \
test.comp_het.singleton.db > obs
check obs exp
rm obs exp
+
+
+# CHANGE: no longer include dad_4 in output since he is unaffected.
+echo " comp_het.t18...\c"
+echo "chrom start end gene ref alt impact variant_id family_id family_members family_genotypes samples family_count comp_het_id priority
+chr1 16976 16977 DDX11L1 G A downstream_gene_variant 1 3 child_3(child_3;affected;male),dad_3(dad_3;unaffected;male),mom_3(mom_3;unaffected;female) G/A,G/A,G/A child_3 1 2_1_4 2
+chr1 17562 17563 DDX11L1 G A downstream_gene_variant 4 3 child_3(child_3;affected;male),dad_3(dad_3;unaffected;male),mom_3(mom_3;unaffected;female) G/A,G/G,G/G child_3 1 2_1_4 2
+chr1 17562 17563 DDX11L1 G A downstream_gene_variant 4 3 child_3(child_3;affected;male),dad_3(dad_3;unaffected;male),mom_3(mom_3;unaffected;female) G/A,G/G,G/G child_3 1 3_4_8 2
+chr1 17745 17746 DDX11L1 A G downstream_gene_variant 8 3 child_3(child_3;affected;male),dad_3(dad_3;unaffected;male),mom_3(mom_3;unaffected;female) A/G,A/G,A/G child_3 1 3_4_8 2" > exp
+gemini comp_hets \
+ --column "chrom,start,end,gene,ref,alt,impact" \
+ --max-priority 2 \
+ --families 3 \
+ --gene-where 'gene != ""' \
+ test.comp_het.db > obs
+check obs exp
+rm obs exp

allow specifying gene selection in comp-het tool

closes #837
updates #806