Skip to content

Commit

Permalink
made change to reflect reason for failing QC
Browse files Browse the repository at this point in the history
  • Loading branch information
kristyhoran committed Aug 7, 2023
1 parent 1b7e231 commit e60e1ed
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions tbtamr/Collate.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,10 @@ def _check_quality(self, cov, perc):
if cov >= self.min_cov and perc >= self.prop_mtb:

return 'Pass QC'
else:
return 'Fail QC'
elif perc < self.prop_mtb:
return 'Failed: < 80 % _M. tuberculosis_ reads in sample'
elif cov < self.min_cov:
return 'Failed: < 40x aligned coverage to reference genome'

def _get_interpret(self, drug, mut, qual):

Expand Down Expand Up @@ -500,8 +502,8 @@ def infer(self):
# print(_dict)
_dict = self._infer_drugs(tbp_result = tbp_result,seq_id=isolate, qual = qual)
_dict = self._infer_dr_profile(res = _dict,qual = qual)
_dict['Species'] = self._species(res = tbp_result, seq_id=isolate) if qual != 'Fail QC' else qual
_dict['Phylogenetic lineage'] = self._lineage(res = tbp_result, seq_id=isolate) if qual != 'Fail QC' else qual
_dict['Species'] = self._species(res = tbp_result, seq_id=isolate) if qual == 'Pass QC' else qual
_dict['Phylogenetic lineage'] = self._lineage(res = tbp_result, seq_id=isolate) if qual == 'Pass QC' else qual
_dict['Database version'] = self._db_version(res = raw_result)
_dict['Quality'] = qual
_dict['Median genome coverage'] = med_cov
Expand Down Expand Up @@ -559,7 +561,7 @@ def _get_infer_conf(self, _dict, drug):

def _get_summary_res(self, res):

if not res['Species'] in ["Mycobacterium tuberculosis", "Fail QC"] :
if not res['Species'] in ["Mycobacterium tuberculosis", "Failed: < 40x aligned coverage to reference genome", "Failed: < 80 % _M. tuberculosis_ reads in sample"] :
return "Not reportable"
else:
return res["Predicted drug resistance"]
Expand Down

0 comments on commit e60e1ed

Please sign in to comment.