@@ -76,21 +76,30 @@ def calculate_contig(self, contig: str) -> MIContigResult:
76
76
ms = mv .samples [self ._mother_id or 0 ]
77
77
fs = fv .samples [self ._father_id or 0 ]
78
78
79
- cs_reps = tuple (sorted (zip (cs ["AL" ], cs ["ALLR" ]), key = lambda x : x [0 ]))
80
- ms_reps = tuple (sorted (zip (ms ["AL" ], ms ["ALLR" ]), key = lambda x : x [0 ]))
81
- fs_reps = tuple (sorted (zip (fs ["AL" ], fs ["ALLR" ]), key = lambda x : x [0 ]))
82
-
83
- c_gt , c_gt_95_ci = _unzip_gt (cs_reps , len (motif ))
84
- m_gt , m_gt_95_ci = _unzip_gt (ms_reps , len (motif ))
85
- f_gt , f_gt_95_ci = _unzip_gt (fs_reps , len (motif ))
86
-
87
- if c_gt [0 ] is None or m_gt [0 ] is None or f_gt [0 ] is None :
79
+ if None in cs ["GT" ] or None in ms ["GT" ] or None in fs ["GT" ]:
88
80
# None call in VCF, skip this call
89
81
continue
90
82
91
- c_seq_gt = tuple (sorted ((cv .alleles [g ] for g in cs ["GT" ]), key = len )) if None not in cs ["GT" ] else None
92
- m_seq_gt = tuple (sorted ((mv .alleles [g ] for g in ms ["GT" ]), key = len )) if None not in ms ["GT" ] else None
93
- f_seq_gt = tuple (sorted ((fv .alleles [g ] for g in fs ["GT" ]), key = len )) if None not in fs ["GT" ] else None
83
+ c_gt = tuple (sorted (int (m .split ("_" )[0 ]) for m in cs ["MC" ]))
84
+ m_gt = tuple (sorted (int (m .split ("_" )[0 ]) for m in ms ["MC" ]))
85
+ f_gt = tuple (sorted (int (m .split ("_" )[0 ]) for m in fs ["MC" ]))
86
+
87
+ # Uncomment to use allele length as motif copies:
88
+
89
+ # cs_reps = tuple(sorted(zip(cs["AL"], cs["ALLR"]), key=lambda x: x[0]))
90
+ # ms_reps = tuple(sorted(zip(ms["AL"], ms["ALLR"]), key=lambda x: x[0]))
91
+ # fs_reps = tuple(sorted(zip(fs["AL"], fs["ALLR"]), key=lambda x: x[0]))
92
+ #
93
+ # c_gt, c_gt_95_ci = _unzip_gt(cs_reps, len(motif))
94
+ # m_gt, m_gt_95_ci = _unzip_gt(ms_reps, len(motif))
95
+ # f_gt, f_gt_95_ci = _unzip_gt(fs_reps, len(motif))
96
+
97
+ # noinspection PyTypeChecker
98
+ c_seq_gt : tuple [str ] | tuple [str , str ] = tuple (sorted ((cv .alleles [g ] for g in cs ["GT" ]), key = len ))
99
+ # noinspection PyTypeChecker
100
+ m_seq_gt : tuple [str ] | tuple [str , str ] = tuple (sorted ((mv .alleles [g ] for g in ms ["GT" ]), key = len ))
101
+ # noinspection PyTypeChecker
102
+ f_seq_gt : tuple [str ] | tuple [str , str ] = tuple (sorted ((fv .alleles [g ] for g in fs ["GT" ]), key = len ))
94
103
95
104
cr .append (MILocusData (
96
105
contig = contig ,
@@ -99,7 +108,8 @@ def calculate_contig(self, contig: str) -> MIContigResult:
99
108
motif = motif ,
100
109
101
110
child_gt = c_gt , mother_gt = m_gt , father_gt = f_gt ,
102
- child_gt_95_ci = c_gt_95_ci , mother_gt_95_ci = m_gt_95_ci , father_gt_95_ci = f_gt_95_ci ,
111
+ # Uncomment to use allele length as motif copies 95% CI:
112
+ # child_gt_95_ci=c_gt_95_ci, mother_gt_95_ci=m_gt_95_ci, father_gt_95_ci=f_gt_95_ci,
103
113
child_seq_gt = c_seq_gt , mother_seq_gt = m_seq_gt , father_seq_gt = f_seq_gt ,
104
114
))
105
115
0 commit comments