Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes staramr so it works for newer pandas #126

Merged
merged 4 commits into from
Oct 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
sudo: required
language: python
python:
- "3.5"
- "3.6"
- "3.7"

env:
matrix:
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion staramr/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.7.1'
__version__ = '0.7.2'
4 changes: 2 additions & 2 deletions staramr/results/AMRDetectionSummary.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']]

Expand Down
2 changes: 1 addition & 1 deletion staramr/results/AMRDetectionSummaryResistance.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down