diff --git a/.travis.yml b/.travis.yml index 5edd71c2..e875754d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,8 @@ sudo: required language: python python: - - "3.5" - "3.6" + - "3.7" env: matrix: diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b1cba7f..60684763 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# Version 0.7.2 + +* Fixed `KeyError` issue with later versions of pandas (#115, thanks @javiertognarelli). + # Version 0.7.1 * Fix a bug so that the Sequence column in resfinder.tsv uses the isolate sequence instead of the reference sequence diff --git a/README.md b/README.md index eeb8e950..dec7b1db 100644 --- a/README.md +++ b/README.md @@ -232,6 +232,8 @@ staramr db restore-default * Git * MLST +**Note: if you wish to use Python 3.5 you will have to install BioPython <= 1.76 as later versions no longer support Python 3.5.** + # Input ## List of genes to exclude diff --git a/staramr/__init__.py b/staramr/__init__.py index f0788a87..fb9b668f 100644 --- a/staramr/__init__.py +++ b/staramr/__init__.py @@ -1 +1 @@ -__version__ = '0.7.1' +__version__ = '0.7.2' diff --git a/staramr/results/AMRDetectionSummary.py b/staramr/results/AMRDetectionSummary.py index 885d9a12..3ff6d25c 100644 --- a/staramr/results/AMRDetectionSummary.py +++ b/staramr/results/AMRDetectionSummary.py @@ -37,12 +37,12 @@ def __init__(self, files, resfinder_dataframe: DataFrame, quality_module_datafra def _compile_results(self, resistance_frame: DataFrame) -> DataFrame: df_summary = resistance_frame.sort_values(by=['Gene']).groupby(['Isolate ID']).aggregate( - lambda x: {'Gene': (self.SEPARATOR + ' ').join(x['Gene'])}) + lambda x: {'Gene': (self.SEPARATOR + ' ').join(x.get('Gene'))}) return df_summary[['Gene']] def _compile_plasmids(self, plasmid_frame: DataFrame) -> DataFrame: ds_summary = plasmid_frame.sort_values(by=['Gene']).groupby(['Isolate ID']).aggregate( - lambda x: {'Gene': (self.SEPARATOR + ' ').join(x['Gene'])}) + lambda x: {'Gene': (self.SEPARATOR + ' ').join(x.get('Gene'))}) ds_frame = ds_summary[['Gene']] diff --git a/staramr/results/AMRDetectionSummaryResistance.py b/staramr/results/AMRDetectionSummaryResistance.py index 73944347..f4a5ae3d 100644 --- a/staramr/results/AMRDetectionSummaryResistance.py +++ b/staramr/results/AMRDetectionSummaryResistance.py @@ -22,7 +22,7 @@ def __init__(self, files, resfinder_dataframe, quality_module_dataframe,pointfin super().__init__(files, resfinder_dataframe,quality_module_dataframe, pointfinder_dataframe, plasmidfinder_dataframe, mlst_dataframe) def _aggregate_gene_phenotype(self, dataframe): - flattened_phenotype_list = [y.strip() for x in dataframe['Predicted Phenotype'].tolist() for y in + flattened_phenotype_list = [y.strip() for x in dataframe.get('Predicted Phenotype').tolist() for y in x.split(self.SEPARATOR)] uniq_phenotype = OrderedDict.fromkeys(flattened_phenotype_list)