This notebook is to test the inheritance machinery in gemini. Families are drawn in an image where
genotype status is labelled in the image.
See this issue for discussion along with this gist
In [1]:
import gemini.tests
from gemini.tests.test_inheritance import TestFamily, family
Sample = family.Sample
HOM_REF, HET, UNKNOWN, HOM_ALT = range(4)
In [2]:
fam = TestFamily("""
#family_id sample_id paternal_id maternal_id sex phenotype
1 dad 0 0 1 1
1 mom grandpa grandma 2 1
1 kid dad mom 1 2
1 kid2 dad mom 1 1
1 grandma 0 0 2 1
1 grandpa 0 0 1 1""")
fam.gt_types = [HET, HET, HOM_ALT, HET, HET, HET]
fam.gt_depths = [20, 20, 20, 20, 20, 20]
fam.draw(tests=("auto_rec", ))
In [3]:
# if we set anyone else to HOM_ALT, it's no longer auto_rec unless only-affected is False:
# set grandpa to HOM_ALT
fam.gt_types[5] = HOM_ALT
fam.draw(tests=("auto_rec"))
In [4]:
# set grandpa back to het
fam.gt_types[5] = HET
# can require a greater read depth (note we set all samples to have depth 20 above)
fam.auto_rec(min_depth=12), fam.auto_rec(min_depth=22)
Out[4]:
In [5]:
# if we set someone else to affected... the sibling. it can never be auto_rec:
fam.subjects[3].affected = True
fam.draw(tests=("auto_rec",))
In [6]:
fam.gt_types = [HET, HET, HOM_ALT, HET, HOM_REF, HOM_REF]
fam.draw(tests=("auto_dom"))
# parents arent affected...
In [7]:
fam.de_novo(strict=False) # even though mom is a de-novo?
Out[7]:
In [8]:
for s in fam.subjects: s.affected = True
fam.draw(tests=("auto_dom"))
In [9]:
fam.subjects[5].affected = fam.subjects[4].affected = False
fam.draw()
# still not auto_dom because affected is homalt
In [10]:
fam.gt_types[2] = HET
fam.draw(tests=("auto_dom",))
In [11]:
# TODO: check this
ffd = family.Family([Sample("mom", True, "female"), Sample("dad", False, "male"),
Sample("kid", True, "male")], "fam")
ffd.subjects[2].mom = ffd.subjects[0]
ffd.subjects[2].dad = ffd.subjects[1]
ffd = TestFamily(ffd)
ffd.gt_types = [HET, HOM_ALT, HET]
# dad is homalt, so only works under only_affected=False
ffd.draw(tests=("auto_dom",))
ffd.gt_types = [HET, HOM_REF, HET]
ffd.draw(tests=("auto_dom",))
In [12]:
fam3 = TestFamily("""
#family_id sample_id paternal_id maternal_id sex phenotype
1 dad 0 0 1 2
1 mom grandpa grandma 2 -9
1 kid dad mom 1 2
""")
fam3.gt_types = [HET, HET, HET]
fam3.gt_depths = [20, 20, 20]
fam3.draw(tests=("auto_dom",))
In [13]:
# not a de_novo because parents have it.
fam3.draw(tests=("de_novo",))
In [14]:
# should never be de_novo, because mom has it
fam3.gt_types = [HOM_REF, HOM_ALT, HET]
fam3.subjects[0].affected = False
fam3.subjects[1].affected = False
fam3.subjects[2].affected = True
fam3.draw(tests=("de_novo",))
In [15]:
# should never be auto_dom (at least not this generation. since it's de_novo).
fam3.gt_types = [HOM_REF, HOM_REF, HET]
fam3.draw(tests=("auto_dom",))
In [16]:
ff = family.Family([Sample("mom", False, "female"), Sample("dad", False, "male"),
Sample("kid", True, "male")], "fam")
ff.subjects[2].mom = ff.subjects[0]
ff.subjects[2].dad = ff.subjects[1]
ff = TestFamily(ff)
ff.gt_types = [HOM_ALT, HOM_ALT, HET]
ff.draw(tests=("de_novo",))
In [17]:
# unaffected sibling is a HET.
ff = family.Family([Sample("mom", False, "female"), Sample("dad", False, "male"),
Sample("kid", True, "male"), Sample("kid2", False, "male")], "fam")
ff.subjects[2].mom = ff.subjects[0]
ff.subjects[2].dad = ff.subjects[1]
ff.subjects[3].mom = ff.subjects[0]
ff.subjects[3].dad = ff.subjects[1]
ff = TestFamily(ff)
ff.gt_types = [HOM_ALT, HOM_ALT, HET, HET]
ff.draw(tests=("de_novo",))
In [ ]: