Skip to content

Commit

Permalink
Move Omp results into a separate resistance column
Browse files Browse the repository at this point in the history
  • Loading branch information
rrwick committed May 7, 2019
1 parent 593c57f commit 4d85733
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 19 deletions.
13 changes: 8 additions & 5 deletions kleborate/resBLAST.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ def read_class_file(res_class_file):
if 'NA' in bla_classes:
bla_classes.remove('NA')

if 'Omp' not in res_classes:
res_classes.append('Omp')

return gene_info, res_classes, bla_classes


Expand Down Expand Up @@ -360,9 +363,9 @@ def check_for_omp_gene_truncations(hits_dict, contigs, omp):
truncations.append('OmpK36-' + ('%.0f' % best_ompk36_cov) + '%')

if truncations:
if 'Bla_Carb' not in hits_dict:
hits_dict['Bla_Carb'] = []
hits_dict['Bla_Carb'] += truncations
if 'Omp' not in hits_dict:
hits_dict['Omp'] = []
hits_dict['Omp'] += truncations


def check_for_ompk36_mutations(hits_dict, contigs, omp):
Expand All @@ -381,9 +384,9 @@ def check_for_ompk36_mutations(hits_dict, contigs, omp):
coverage = 100.0 * float(hit_length) / gene_len
if coverage >= 90.0 and hsp_hit_eval <= 0.001 and identity >= 0.9:
if gene_id == 'OmpK36GD' and 'GDGDTY' in hsp_qseq:
hits_dict['Bla_Carb'].append('OmpK36GD')
hits_dict['Omp'].append('OmpK36GD')
if gene_id == 'OmpK36TD' and 'GDTDTY' in hsp_qseq:
hits_dict['Bla_Carb'].append('OmpK36TD')
hits_dict['Omp'].append('OmpK36TD')


def get_strain_name(full_path):
Expand Down
2 changes: 1 addition & 1 deletion test/test_res_mgrb_pmrb.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def test_mgrb_missing_non_kp_complex(self):
"""
results = get_resistance_results(self.data_dir, 'test/sequences/test_res_mgrb_pmrb_4.fasta',
self.args, self.res_headers, False)
self.assertFalse('MgrB-' in results['Col'])
self.assertTrue('MgrB-' not in results['Col'])

def test_pmrb_early_stop_SRR2098701(self):
results = get_resistance_results(self.data_dir, 'test/sequences/SRR2098701.fasta',
Expand Down
22 changes: 11 additions & 11 deletions test/test_res_omp.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,43 +36,43 @@ def setUp(self):
def test_both_genes_intact(self):
results = get_resistance_results(self.data_dir, 'test/sequences/test_res_omp_1.fasta',
self.args, self.res_headers, True)
self.assertEqual(results['Bla_Carb'], '-')
self.assertEqual(results['Omp'], '-')

def test_ompk35_frameshift(self):
"""
A frameshift in OmpK35 should cause an early stop and lead to a carbapenem resistance call.
"""
results = get_resistance_results(self.data_dir, 'test/sequences/test_res_omp_2.fasta',
self.args, self.res_headers, True)
self.assertTrue('OmpK35-' in results['Bla_Carb'])
self.assertTrue('OmpK35-' in results['Omp'])

def test_ompk35_early_stop(self):
"""
This tests an early stop mutation (without a frameshift) in OmpK35.
"""
results = get_resistance_results(self.data_dir, 'test/sequences/test_res_omp_3.fasta',
self.args, self.res_headers, True)
self.assertTrue('OmpK35-' in results['Bla_Carb'])
self.assertTrue('OmpK35-' in results['Omp'])

def test_ompk36_missing(self):
results = get_resistance_results(self.data_dir, 'test/sequences/test_res_omp_4.fasta',
self.args, self.res_headers, True)
self.assertTrue('OmpK36-' in results['Bla_Carb'])
self.assertTrue('OmpK36-' in results['Omp'])

def test_ompk36gd(self):
results = get_resistance_results(self.data_dir, 'test/sequences/test_res_omp_5.fasta',
self.args, self.res_headers, True)
self.assertTrue('OmpK36GD' in results['Bla_Carb'])
self.assertTrue('OmpK36GD' in results['Omp'])

def test_ompk36td(self):
results = get_resistance_results(self.data_dir, 'test/sequences/test_res_omp_6.fasta',
self.args, self.res_headers, True)
self.assertTrue('OmpK36TD' in results['Omp'])

def test_ompk36td_non_kp_complex(self):
"""
Setting the Kp complex variable to False should turn off the OmpK tests.
"""
results = get_resistance_results(self.data_dir, 'test/sequences/test_res_omp_6.fasta',
self.args, self.res_headers, False)
self.assertFalse('OmpK36TD' in results['Bla_Carb'])

def test_ompk36td_non_kp_complex(self):
results = get_resistance_results(self.data_dir, 'test/sequences/test_res_omp_6.fasta',
self.args, self.res_headers, True)
self.assertTrue('OmpK36TD' in results['Bla_Carb'])
self.assertTrue('OmpK36TD' not in results['Omp'])
4 changes: 2 additions & 2 deletions test/test_res_qrdr.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,5 @@ def test_gyra_and_parc_non_kp_complex(self):
"""
results = get_resistance_results(self.data_dir, 'test/sequences/test_res_qrdr_4.fasta',
self.args, self.res_headers, False)
self.assertFalse('GyrA-83C' in results['Flq'])
self.assertFalse('ParC-84D' in results['Flq'])
self.assertTrue('GyrA-83C' not in results['Flq'])
self.assertTrue('ParC-84D' not in results['Flq'])

0 comments on commit 4d85733

Please sign in to comment.