def test_load_ped_file_multiple_sibs(self): """ check that we correctly parse a ped file with multiple siblings """ # add an extra sibling self.tempfile.write("fam_ID sib dad mom F 2 /path/to/sib_vcf.gz\n") self.tempfile.flush() # load all the components from the file mothers, fathers, children, affected, sex, vcfs = load_ped_file(self.path) # check that they all match self.assertEqual(mothers, {"mom": "0", "proband": "mom", "dad": "0", "sib": "mom"}) self.assertEqual(fathers, {"mom": "0", "proband": "dad", "dad": "0", "sib": "dad"}) self.assertEqual(children, {"proband": "fam_ID", "sib": "fam_ID"}) self.assertEqual(affected, {"mom": "1", "proband": "2", "dad": "1", "sib": "2"}) self.assertEqual(sex, {"mom": "F", "proband": "F", "dad": "M", "sib": "F"}) self.assertEqual( vcfs, { "mom": "/path/to/mom_vcf.gz", "proband": "/path/to/proband_vcf.gz", "dad": "/path/to/dad_vcf.gz", "sib": "/path/to/sib_vcf.gz", }, )
def test_load_ped_file_multiple_families(self): """ check that we correctly parse a ped file with multiple families """ # add an extra family, with multiple sibs self.tempfile.write("fam_ID2 proband2 dad2 mom2 F 2 /path/to/proband2_vcf.gz\n") self.tempfile.write("fam_ID2 dad2 0 0 M 1 /path/to/dad2_vcf.gz\n") self.tempfile.write("fam_ID2 mom2 0 0 F 1 /path/to/mom2_vcf.gz\n") self.tempfile.write("fam_ID2 sib dad2 mom2 F 2 /path/to/sib_vcf.gz\n") self.tempfile.flush() # load all the components from the file mothers, fathers, children, affected, sex, vcfs = load_ped_file(self.path) # check that they all match self.assertEqual(mothers, {'mom': '0', 'proband': 'mom', 'dad': '0', 'mom2': '0', 'proband2': 'mom2', 'dad2': '0', 'sib': 'mom2'}) self.assertEqual(fathers, {'mom': '0', 'proband': 'dad', 'dad': '0', 'mom2': '0', 'proband2': 'dad2', 'dad2': '0', 'sib': 'dad2'}) self.assertEqual(children, {'proband': 'fam_ID', "proband2": "fam_ID2", "sib": "fam_ID2"}) self.assertEqual(affected, {'mom': '1', 'proband': '2', 'dad': '1', 'mom2': '1', 'proband2': '2', 'dad2': '1', 'sib': '2'}) self.assertEqual(sex, {'mom': 'F', 'proband': 'F', 'dad': 'M', 'mom2': 'F', 'proband2': 'F', 'dad2': 'M', 'sib': 'F'}) self.assertEqual(vcfs, {'mom': '/path/to/mom_vcf.gz', 'proband': '/path/to/proband_vcf.gz', 'dad': '/path/to/dad_vcf.gz', 'proband2': '/path/to/proband2_vcf.gz', 'dad2': '/path/to/dad2_vcf.gz', 'mom2': '/path/to/mom2_vcf.gz', 'sib': '/path/to/sib_vcf.gz'})
def test_load_ped_file_single_family(self): """ check that we correctly parse a ped file with a single trio """ # load all the components from the file mothers, fathers, children, affected, sex, vcfs = load_ped_file(self.path) # check that they all match self.assertEqual(mothers, {"mom": "0", "proband": "mom", "dad": "0"}) self.assertEqual(fathers, {"mom": "0", "proband": "dad", "dad": "0"}) self.assertEqual(children, {"proband": "fam_ID"}) self.assertEqual(affected, {"mom": "1", "proband": "2", "dad": "1"}) self.assertEqual(sex, {"mom": "F", "proband": "F", "dad": "M"}) self.assertEqual( vcfs, {"mom": "/path/to/mom_vcf.gz", "proband": "/path/to/proband_vcf.gz", "dad": "/path/to/dad_vcf.gz"} )
def test_load_ped_file_single_family(self): """ check that we correctly parse a ped file with a single trio """ # load all the components from the file mothers, fathers, children, affected, sex, vcfs = load_ped_file(self.path) # check that they all match self.assertEqual(mothers, {'mom': '0', 'proband': 'mom', 'dad': '0'}) self.assertEqual(fathers, {'mom': '0', 'proband': 'dad', 'dad': '0'}) self.assertEqual(children, {'proband': 'fam_ID'}) self.assertEqual(affected, {'mom': '1', 'proband': '2', 'dad': '1'}) self.assertEqual(sex, {'mom': 'F', 'proband': 'F', 'dad': 'M'}) self.assertEqual(vcfs, {'mom': '/path/to/mom_vcf.gz', \ 'proband': '/path/to/proband_vcf.gz', \ 'dad': '/path/to/dad_vcf.gz'})