def testPointfinderSingleMultipleGeneSame(self): df = pd.DataFrame([ [ 'file1', 'gyrA', 'codon', 67, 'GCC -> CCC (A -> P)', 99.96, 100.0, '2637/2637' ], [ 'file1', 'gyrA', 'codon', 67, 'GCC -> CCC (A -> P)', 99.96, 100.0, '2637/2637' ], ], columns=self.columns_pointfinder) files = ['file1'] amr_detection_summary = AMRDetectionSummary( files, self.resfinder_table_empty, self.quality_module_table_single_file, df, self.plasmidfinder_table_empty) summary = amr_detection_summary.create_summary() self.assertEqual(1, len(summary.index), 'Invalid number of rows in results') self.assertEqual('file1', summary.index[0], 'File name not equal') self.assertEqual('gyrA, gyrA', summary['Genotype'].iloc[0], 'Genes not equal')
def testResfinderSingleGene(self): amr_detection_summary = AMRDetectionSummary(self.resfinder_table1_files, self.resfinder_table1) summary = amr_detection_summary.create_summary() self.assertEqual(1, len(summary.index), 'Invalid number of rows in results') self.assertEqual('file1', summary.index[0], 'File name not equal') self.assertEqual('blaIMP-42', summary['Genotype'].iloc[0], 'Genes not equal')
def testPointfinderSingleMultipleGene(self): amr_detection_summary = AMRDetectionSummary(self.pointfinder_table_multiple_gene_files, self.resfinder_table_empty, self.pointfinder_table_multiple_gene) summary = amr_detection_summary.create_summary() self.assertEqual(1, len(summary.index), 'Invalid number of rows in results') self.assertEqual('file1', summary.index[0], 'File name not equal') self.assertEqual('gyrA, gyrAB', summary['Genotype'].iloc[0], 'Genes not equal')
def testResfinderMultipleSameGeneSameResistance(self): amr_detection_summary = AMRDetectionSummary(self.resfinder_table_mult_same_gene_same_resistance_files, self.resfinder_table_mult_same_gene_same_resistance) summary = amr_detection_summary.create_summary() self.assertEqual(1, len(summary.index), 'Invalid number of rows in results') self.assertEqual('file1', summary.index[0], 'File name not equal') self.assertEqual('blaIMP-42, blaIMP-42', summary['Genotype'].iloc[0], 'Genes not equal')
def testResfinderSingleGeneWithNegativesIncluded(self): files = ['file1', 'file2'] amr_detection_summary = AMRDetectionSummary(files, self.resfinder_table1) summary = amr_detection_summary.create_summary(True) self.assertEqual(2, len(summary.index), 'Invalid number of rows in results') self.assertEqual('file1', summary.index[0], 'File name not equal') self.assertEqual('blaIMP-42', summary['Genotype'].iloc[0], 'Genes not equal') self.assertEqual('file2', summary.index[1], 'Negative file not included') self.assertEqual('None', summary['Genotype'].iloc[1], 'Negative gene not valid')
def testResfinderMultipleFile(self): amr_detection_summary = AMRDetectionSummary(self.resfinder_table_mult_file_files, self.resfinder_table_mult_file) summary = amr_detection_summary.create_summary() self.assertEqual(2, len(summary.index), 'Invalid number of rows in results') self.assertEqual('file1', summary.index[0], 'File name not equal') self.assertEqual('blaIMP-42, newGene', summary['Genotype'].iloc[0], 'Genes not equal') self.assertEqual('file2', summary.index[1], 'File name not equal') self.assertEqual('blaIMP-42', summary['Genotype'].iloc[1], 'Genes not equal')
def testPlasmidfinderSingleGene(self): amr_detection_summary = AMRDetectionSummary( self.plasmidfinder_table1_files, self.resfinder_table_empty, self.quality_module_table_file_4, self.plasmidfinder_table1) summary = amr_detection_summary.create_summary() self.assertEqual(1, len(summary.index), 'Invalid number of rows in results') self.assertEqual('file4', summary.index[0], 'File name not equal') self.assertEqual('IncFIB(S)', summary['Genotype'].iloc[0], 'Genes not equal')
def testPlasmidfinderMultipleSameGeneSameResistance(self): amr_detection_summary = AMRDetectionSummary( self.plasmidfinder_table_mult_same_gene_same_resistance_files, self.resfinder_table_empty, self.quality_module_table_file_4, self.plasmidfinder_table_mult_same_gene_same_resistance) summary = amr_detection_summary.create_summary() self.assertEqual(1, len(summary.index), 'Invalid number of rows in results') self.assertEqual('file4', summary.index[0], 'File name not equal') self.assertEqual('IncFIB(S), IncFII(S)', summary['Genotype'].iloc[0], 'Genes not equal')
def testPointfinderResfinderSingleGene(self): files = ['file1'] amr_detection_summary = AMRDetectionSummary( files, self.resfinder_table1, self.quality_module_table_single_file, self.pointfinder_table, self.plasmidfinder_table_empty) summary = amr_detection_summary.create_summary() self.assertEqual(1, len(summary.index), 'Invalid number of rows in results') self.assertEqual('file1', summary.index[0], 'File name not equal') self.assertEqual('blaIMP-42, gyrA', summary['Genotype'].iloc[0], 'Genes not equal')
def testResfinderMultipleGeneResistance(self): amr_detection_summary = AMRDetectionSummary( self.resfinder_table_mult_resistance_files, self.resfinder_table_mult_resistance, self.quality_module_table_single_file, self.plasmidfinder_table_empty) summary = amr_detection_summary.create_summary() self.assertEqual(1, len(summary.index), 'Invalid number of rows in results') self.assertEqual('file1', summary.index[0], 'File name not equal') self.assertEqual('blaIMP-42, newGene', summary['Genotype'].iloc[0], 'Genes not equal')
def testPlasmidfinderSingleGeneWithNegativesIncluded(self): files = ['file4', 'file5'] amr_detection_summary = AMRDetectionSummary( files, self.resfinder_table_empty, self.quality_module_table_file_4_and_5, self.plasmidfinder_table1) summary = amr_detection_summary.create_summary(True) self.assertEqual(2, len(summary.index), 'Invalid number of rows in results') self.assertEqual('file4', summary.index[0], 'File name not equal') self.assertEqual('IncFIB(S)', summary['Genotype'].iloc[0], 'Genes not equal') self.assertEqual('file5', summary.index[1], 'Negative file not included') self.assertEqual('None', summary['Genotype'].iloc[1], 'Negative gene not valid')
def testResfinderSingleGeneWithTwoNegativesIncludedDifferentOrder(self): files = ['file2', 'file1', 'file3'] amr_detection_summary = AMRDetectionSummary( files, self.resfinder_table1, self.quality_module_table_three_files, self.plasmidfinder_table_empty) summary = amr_detection_summary.create_summary(True) self.assertEqual(3, len(summary.index), 'Invalid number of rows in results') self.assertEqual('file1', summary.index[0], 'File name not equal') self.assertEqual('blaIMP-42', summary['Genotype'].iloc[0], 'Genes not equal') self.assertEqual('file2', summary.index[1], 'Negative file not included') self.assertEqual('None', summary['Genotype'].iloc[1], 'Negative gene not valid') self.assertEqual('file3', summary.index[2], 'Negative file not included') self.assertEqual('None', summary['Genotype'].iloc[2], 'Negative gene not valid')
def _create_detailed_amr_summary(self, files: List[str], resfinder_dataframe: DataFrame,quality_module_dataframe: DataFrame, pointfinder_dataframe: Optional[BlastResultsParserPointfinder], plasmidfinder_dataframe: DataFrame, mlst_dataframe: DataFrame) -> DataFrame: amr_detection_summary = AMRDetectionSummary(files, resfinder_dataframe,quality_module_dataframe, pointfinder_dataframe, plasmidfinder_dataframe, mlst_dataframe) return amr_detection_summary.create_detailed_summary(self._include_negative_results)
def _create_amr_summary(self, files, resfinder_dataframe, pointfinder_dataframe): amr_detection_summary = AMRDetectionSummary(files, resfinder_dataframe, pointfinder_dataframe) return amr_detection_summary.create_summary(self._include_negative_results)