def test_res_07(self): results = get_resistance_results(self.data_dir, 'test/test_res_alleles/07.fasta', self.args, self.res_headers, True) self.assertEqual(results['Tet_acquired'], '-') self.assertEqual(results['Bla_acquired'], 'ABC-2*') self.assertEqual(results['Bla_ESBL_acquired'], '-') self.assertEqual(results['spurious_resistance_hits'], '-')
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/test_res_omp/test_res_omp_2.fasta', self.args, self.res_headers, True) self.assertTrue('OmpK35-' in results['Omp_mutations'])
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/test_res_omp/test_res_omp_6.fasta', self.args, self.res_headers, False) self.assertTrue('OmpK36TD' not in results['Omp_mutations'])
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/test_res_omp/test_res_omp_3.fasta', self.args, self.res_headers, True) self.assertTrue('OmpK35-' in results['Omp_mutations'])
def test_res_05(self): """ Same as test_res_04, but with the hit on the other strand. """ results = get_resistance_results(self.data_dir, 'test/test_res_aac/05.fasta', self.args, self.res_headers, True) self.assertEqual(results['AGly_acquired'], 'Aac6Ib-cr^')
def test_gyra_and_parc_non_kp_complex(self): """ Setting the Kp complex variable to False should turn off the QRDR tests. """ results = get_resistance_results( self.data_dir, 'test/test_res_qrdr/test_res_qrdr_4.fasta', self.args, self.res_headers, False) self.assertTrue('GyrA-83C' not in results['Flq_mutations']) self.assertTrue('ParC-84D' not in results['Flq_mutations'])
def test_mgrb_missing_non_kp_complex(self): """ Setting the Kp complex variable to False should turn off the MgrB/PmrB tests. """ results = get_resistance_results( self.data_dir, 'test/test_res_mgrb_pmrb/test_res_mgrb_pmrb_4.fasta', self.args, self.res_headers, False) self.assertTrue('MgrB-' not in results['Col_mutations'])
def test_shv_06(self): """ This test has SHV-29 plus an inhibition mutation. """ results = get_resistance_results(self.data_dir, 'test/test_shv/06.fasta', self.args, self.res_headers, True) self.assertEqual(results['Bla_ESBL_inhR_acquired'], 'SHV-29* +234Y') self.assertEqual(results['SHV_mutations'], '234Y;238A;35Q')
def test_shv_05(self): """ This test has an exact match for SHV-29. """ results = get_resistance_results(self.data_dir, 'test/test_shv/05.fasta', self.args, self.res_headers, True) self.assertEqual(results['Bla_ESBL_acquired'], 'SHV-29') self.assertEqual(results['SHV_mutations'], '238A;35Q')
def test_pmrb_frameshift(self): """ A frameshift in pmrB should cause an early stop and lead to a colisitin resistance call. """ results = get_resistance_results( self.data_dir, 'test/test_res_mgrb_pmrb/test_res_mgrb_pmrb_2.fasta', self.args, self.res_headers, True) self.assertTrue('PmrB-' in results['Col_mutations'])
def test_pmrb_early_stop(self): """ This tests an early stop mutation (without a frameshift) in pmrB. """ results = get_resistance_results( self.data_dir, 'test/test_res_mgrb_pmrb/test_res_mgrb_pmrb_3.fasta', self.args, self.res_headers, True) self.assertTrue('PmrB-' in results['Col_mutations'])
def test_shv_03(self): """ Same as test 2, but the gene is on the reverse strand. """ results = get_resistance_results(self.data_dir, 'test/test_shv/03.fasta', self.args, self.res_headers, True) self.assertEqual(results['Bla_ESBL_acquired'], 'SHV-1* +238Y') self.assertEqual(results['SHV_mutations'], '238Y')
def test_shv_01(self): """ This test has an exact match for SHV-1. """ results = get_resistance_results(self.data_dir, 'test/test_shv/01.fasta', self.args, self.res_headers, True) self.assertEqual(results['Bla_chr'], 'SHV-1') self.assertEqual(results['SHV_mutations'], '-')
def test_shv_08(self): """ This test has SHV-1 with a synonymous mutation in the omega loop (so not reported). """ results = get_resistance_results(self.data_dir, 'test/test_shv/08.fasta', self.args, self.res_headers, True) self.assertEqual(results['Bla_chr'], 'SHV-1^') self.assertEqual(results['SHV_mutations'], '-')
def test_res_04(self): """ This is a tricky one (and the one which first highlighted the problem). The best bit-score match is for a partial hit to Ant3''Ih-Aac6-IId, but the correct answer is Aac6Ib-cr, which has a full coverage hit. """ results = get_resistance_results(self.data_dir, 'test/test_res_aac/04.fasta', self.args, self.res_headers, True) self.assertEqual(results['AGly_acquired'], 'Aac6Ib-cr^')
def test_shv_04(self): """ This test has a match for SHV-1 with a mutation at site 50 (G -> Y). This doesn't change resistance and so won't be reported. """ results = get_resistance_results(self.data_dir, 'test/test_shv/04.fasta', self.args, self.res_headers, True) self.assertEqual(results['Bla_chr'], 'SHV-1*') self.assertEqual(results['SHV_mutations'], '-')
def test_shv_09(self): """ This test has SHV-1 with a nonsynonymous mutation in the omega loop (so it is reported). """ results = get_resistance_results(self.data_dir, 'test/test_shv/09.fasta', self.args, self.res_headers, True) self.assertEqual(results['Bla_ESBL_acquired'], 'SHV-1* +174R') self.assertEqual(results['SHV_mutations'], '174R;omega-loop=RWETELNEALRGDARD')
def test_shv_07(self): """ This test has SHV-1 with position 238 deleted. Since it's not in the omega loop, this isn't reported and doesn't have an effect. """ results = get_resistance_results(self.data_dir, 'test/test_shv/07.fasta', self.args, self.res_headers, True) self.assertEqual(results['Bla_chr'], 'SHV-1*') self.assertEqual(results['SHV_mutations'], '-')
def test_res_09(self): results = get_resistance_results(self.data_dir, 'test/test_res_alleles/09.fasta', self.args, self.res_headers, True) self.assertEqual(results['Tet_acquired'], '-') self.assertTrue(results['Bla_acquired'] == 'ABC-1^' or results['Bla_acquired'] == 'ABC-2^') self.assertTrue(results['Bla_ESBL_acquired'] == 'ABC-3^' or results['Bla_ESBL_acquired'] == 'ABC-4^') self.assertEqual(results['spurious_resistance_hits'], '-')
def test_shv_02(self): """ This test has a match for SHV-1 with a mutation at site 238 (G -> Y). This changes the class to ESBL, so the mutation is included in the """ results = get_resistance_results(self.data_dir, 'test/test_shv/02.fasta', self.args, self.res_headers, True) self.assertEqual(results['Bla_ESBL_acquired'], 'SHV-1* +238Y') self.assertEqual(results['SHV_mutations'], '238Y')
def test_res_11(self): """ This test has the ABC-1 gene but with a stop codon in the middle. """ results = get_resistance_results(self.data_dir, 'test/test_res_alleles/11.fasta', self.args, self.res_headers, True) self.assertEqual(results['Tet_acquired'], '-') self.assertEqual(results['Bla_acquired'], '-') self.assertEqual(results['Bla_ESBL_acquired'], '-') self.assertEqual(results['truncated_resistance_hits'], 'ABC-1*-50%')
def test_res_12(self): """ This test has the ABC-1 gene but missing the first (start) codon. """ results = get_resistance_results(self.data_dir, 'test/test_res_alleles/12.fasta', self.args, self.res_headers, True) self.assertEqual(results['Tet_acquired'], '-') self.assertEqual(results['Bla_acquired'], '-') self.assertEqual(results['Bla_ESBL_acquired'], '-') self.assertEqual(results['truncated_resistance_hits'], 'ABC-1?-0%')
def test_res_13(self): """ This test has the ABC-1 gene but at only 50% coverage, so it goes to spurious hits. """ results = get_resistance_results(self.data_dir, 'test/test_res_alleles/13.fasta', self.args, self.res_headers, True) self.assertEqual(results['Tet_acquired'], '-') self.assertEqual(results['Bla_acquired'], '-') self.assertEqual(results['Bla_ESBL_acquired'], '-') self.assertEqual(results['spurious_resistance_hits'], 'ABC-1?-50%')
def get_all_results(self, contigs): results = {'strain': get_strain_name(contigs)} results.update(get_species_results(contigs, self.data_dir)) kp_complex = is_kp_complex(results) results.update(get_contig_stat_results(contigs, is_kp_complex)) results.update( get_chromosome_mlst_results(self.data_dir, contigs, kp_complex, self.args)) results.update(get_ybt_mlst_results(self.data_dir, contigs, self.args)) results.update(get_clb_mlst_results(self.data_dir, contigs, self.args)) results.update(get_iuc_mlst_results(self.data_dir, contigs, self.args)) results.update(get_iro_mlst_results(self.data_dir, contigs, self.args)) results.update(get_rmp_mlst_results(self.data_dir, contigs, self.args)) results.update(get_rmpa2_results(self.data_dir, contigs, self.args)) results.update( get_wzi_and_k_locus_results(self.data_dir, contigs, self.args)) results.update( get_resistance_results(self.data_dir, contigs, self.args, self.res_headers, kp_complex)) results.update(get_summary_results(results, self.res_headers)) return results
def test_tem(self): results = get_resistance_results(self.data_dir, 'test/test_res_tem/tem.fasta', self.args, self.res_headers, True) self.assertEqual(results['Bla_ESBL_acquired'], '-') self.assertEqual(results['Bla_acquired'], 'TEM-1D^')
def test_gyra_and_parc(self): results = get_resistance_results( self.data_dir, 'test/test_res_qrdr/test_res_qrdr_4.fasta', self.args, self.res_headers, True) self.assertTrue('GyrA-83C' in results['Flq_mutations']) self.assertTrue('ParC-84D' in results['Flq_mutations'])
def test_no_mutations(self): results = get_resistance_results( self.data_dir, 'test/test_res_qrdr/test_res_qrdr_1.fasta', self.args, self.res_headers, True) self.assertEqual(results['Flq_mutations'], '-')
def test_ompk36td(self): results = get_resistance_results( self.data_dir, 'test/test_res_omp/test_res_omp_6.fasta', self.args, self.res_headers, True) self.assertTrue('OmpK36TD' in results['Omp_mutations'])
def test_res_03(self): results = get_resistance_results(self.data_dir, 'test/test_res_aac/03.fasta', self.args, self.res_headers, True) self.assertEqual(results['AGly_acquired'], 'Aac6-31*')
def test_both_genes_intact(self): results = get_resistance_results( self.data_dir, 'test/test_res_omp/test_res_omp_1.fasta', self.args, self.res_headers, True) self.assertEqual(results['Omp_mutations'], '-')