Ejemplo n.º 1
0
    def testDetailedSummary_noFinders(self):
        amr_detection_summary = AMRDetectionSummaryResistance(
            self.resfinder_table1_files,
            self.resfinder_table_empty.set_index('Isolate ID'),
            self.quality_module_table_file_1,
            self.pointfinder_table_empty.set_index('Isolate ID'),
            self.plasmidfinder_table_empty.set_index('Isolate ID'))

        detailed_summary = amr_detection_summary.create_detailed_summary()

        self.assertEqual(2, len(detailed_summary.index),
                         'Invalid number of rows, expected 2')
        self.assertEqual('file1', detailed_summary.index[0],
                         'File name not equal')
        self.assertEqual('file1', detailed_summary.index[1],
                         'File name not equal')

        self.assertEqual('Plasmid', detailed_summary['Data Type'].iloc[0],
                         'Incorrect Data Type')
        self.assertEqual('Resistance', detailed_summary['Data Type'].iloc[1],
                         'Incorrect Data Type')

        self.assertEqual('None', detailed_summary['Gene'].iloc[0],
                         'Genes not equal')
        self.assertEqual('None', detailed_summary['Gene'].iloc[1],
                         'Genes not equal')

        self.assertEqual('', detailed_summary['Predicted Phenotype'].iloc[0],
                         'Predicted Phenotype not equal')
        self.assertEqual('Sensitive',
                         detailed_summary['Predicted Phenotype'].iloc[1],
                         'Predicted Phenotype not equal')
Ejemplo n.º 2
0
    def testDetailedSummary_noPoint(self):
        plasmid_table = self.plasmidfinder_table1
        plasmid_table['Isolate ID'] = 'file1'
        plasmid_table = plasmid_table.set_index('Isolate ID')

        amr_detection_summary = AMRDetectionSummaryResistance(
            self.resfinder_table1_files,
            self.resfinder_table1.set_index('Isolate ID'),
            self.quality_module_table_file_1,
            plasmidfinder_dataframe=plasmid_table)

        detailed_summary = amr_detection_summary.create_detailed_summary()

        self.assertEqual(2, len(detailed_summary.index),
                         'Invalid number of rows, expected 2')
        self.assertEqual('file1', detailed_summary.index[0],
                         'File name not equal')
        self.assertEqual('file1', detailed_summary.index[1],
                         'File name not equal')

        self.assertEqual('Plasmid', detailed_summary['Data Type'].iloc[0],
                         'Incorrect Data Type')
        self.assertEqual('Resistance', detailed_summary['Data Type'].iloc[1],
                         'Incorrect Data Type')

        self.assertEqual('IncFIB(S)', detailed_summary['Gene'].iloc[0],
                         'Genes not equal')
        self.assertEqual('blaIMP-42', detailed_summary['Gene'].iloc[1],
                         'Genes not equal')

        self.assertEqual('', detailed_summary['Predicted Phenotype'].iloc[0],
                         'Predicted Phenotype not equal')
        self.assertEqual('', detailed_summary['Predicted Phenotype'].iloc[1],
                         'Predicted Phenotype not equal')
 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:
     amr_detection_summary = AMRDetectionSummaryResistance(files, resfinder_dataframe,quality_module_dataframe,
                                                           pointfinder_dataframe, plasmidfinder_dataframe, mlst_dataframe)
     return amr_detection_summary.create_detailed_summary(self._include_negative_results)
Ejemplo n.º 4
0
    def testDetailedSummary_multiFiles(self):
        amr_detection_summary = AMRDetectionSummaryResistance(
            self.detailed_summary_multi_files,
            self.resfinder_table_mult_file.set_index('Isolate ID'),
            self.quality_module_table_file_1_and_2_and_4_and_5,
            self.pointfinder_table_multiple_gene.set_index('Isolate ID'),
            self.plasmidfinder_table_mult_file.set_index('Isolate ID'))

        detailed_summary = amr_detection_summary.create_detailed_summary()

        self.assertEqual(12, len(detailed_summary.index),
                         'Invalid number of rows, expected 12')
        self.assertEqual('file1', detailed_summary.index[0],
                         'File name not equal')
        self.assertEqual('file1', detailed_summary.index[4],
                         'File name not equal')

        self.assertEqual('file2', detailed_summary.index[5],
                         'File name not equal')
        self.assertEqual('file2', detailed_summary.index[6],
                         'File name not equal')

        self.assertEqual('file4', detailed_summary.index[7],
                         'File name not equal')
        self.assertEqual('file4', detailed_summary.index[9],
                         'File name not equal')

        self.assertEqual('file5', detailed_summary.index[10],
                         'File name not equal')
        self.assertEqual('file5', detailed_summary.index[11],
                         'File name not equal')

        self.assertEqual('Plasmid', detailed_summary['Data Type'].iloc[0],
                         'Incorrect Data Type')
        self.assertEqual('Resistance', detailed_summary['Data Type'].iloc[1],
                         'Incorrect Data Type')

        self.assertEqual('Plasmid', detailed_summary['Data Type'].iloc[5],
                         'Incorrect Data Type')
        self.assertEqual('Resistance', detailed_summary['Data Type'].iloc[6],
                         'Incorrect Data Type')

        self.assertEqual('Plasmid', detailed_summary['Data Type'].iloc[8],
                         'Incorrect Data Type')
        self.assertEqual('Resistance', detailed_summary['Data Type'].iloc[9],
                         'Incorrect Data Type')

        self.assertEqual('Plasmid', detailed_summary['Data Type'].iloc[10],
                         'Incorrect Data Type')
        self.assertEqual('Resistance', detailed_summary['Data Type'].iloc[11],
                         'Incorrect Data Type')

        self.assertEqual('None', detailed_summary['Gene'].iloc[0],
                         'Genes not equal')
        self.assertEqual('blaIMP-42', detailed_summary['Gene'].iloc[1],
                         'Genes not equal')

        self.assertEqual('None', detailed_summary['Gene'].iloc[5],
                         'Genes not equal')
        self.assertEqual('blaIMP-42', detailed_summary['Gene'].iloc[6],
                         'Genes not equal')

        self.assertEqual('IncFIB(S)', detailed_summary['Gene'].iloc[7],
                         'Genes not equal')
        self.assertEqual('None', detailed_summary['Gene'].iloc[9],
                         'Genes not equal')

        self.assertEqual('IncFIB(K)', detailed_summary['Gene'].iloc[10],
                         'Genes not equal')
        self.assertEqual('None', detailed_summary['Gene'].iloc[11],
                         'Genes not equal')

        self.assertEqual('Sensitive',
                         detailed_summary['Predicted Phenotype'].iloc[9],
                         'Predicted Phenotype not equal')
        self.assertEqual('Sensitive',
                         detailed_summary['Predicted Phenotype'].iloc[11],
                         'Predicted Phenotype not equal')