Skip to content

Commit

Permalink
immediately exclude mutations with failed quality in the position war…
Browse files Browse the repository at this point in the history
…nings
  • Loading branch information
sage-wright committed Jul 19, 2024
1 parent 14e6b80 commit 14af63f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Shelby Bennett, Erin Young, Curtis Kapsak, & Kutluhan Incekara

ARG SAMTOOLS_VER="1.18"
ARG TBP_PARSER_VER="1.5.10"
ARG TBP_PARSER_VER="2.0.0"

FROM ubuntu:jammy as builder

Expand Down Expand Up @@ -42,7 +42,7 @@ ARG TBP_PARSER_VER
LABEL base.image="ubuntu:jammy"
LABEL dockerfile.version="1"
LABEL software="tbp-parser"
LABEL software.version="1.5.10"
LABEL software.version="2.0.0"
LABEL description="tbp-parser and samtools"
LABEL website="https://github.com/theiagen/tbp-parser"
LABEL license="https://github.com/theiagen/tbp-parser/blob/main/LICENSE"
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ See also [this page](https://theiagen.notion.site/tbp-parser-b02bef0cbc814b12987
We highly recommend using the following Docker image to run tbp-parser:

```markdown
docker pull us-docker.pkg.dev/general-theiagen/theiagen/tbp-parser:1.5.10
docker pull us-docker.pkg.dev/general-theiagen/theiagen/tbp-parser:2.0.0
```

The entrypoint for this Docker image is the tbp-parser help message. To run this container interactively, use the following command:

```markdown
docker run -it --entrypoint=/bin/bash us-docker.pkg.dev/general-theiagen/theiagen/tbp-parser:1.5.10
docker run -it --entrypoint=/bin/bash us-docker.pkg.dev/general-theiagen/theiagen/tbp-parser:2.0.0
# Once inside the container interactively, you can run the tbp-parser tool
python3 /tbp-parser/tbp_parser/tbp_parser.py -v
# v1.5.10
# v2.0.0
```

### Locally with Python
Expand Down
10 changes: 9 additions & 1 deletion tbp_parser/LIMS.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,10 @@ def apply_lims_rules(self, gene_dictionary, DF_LIMS, max_mdl_resistance, antimic

self.logger.debug("LIMS:Since this MDL interpretation changed, we are now potentially recalculating max_mdl_resistance (currently {})".format(max_mdl_resistance[0]))

if (len(all_responsible_mdl_interpretations) == 0):
self.logger.debug("LIMS:There are no more potential MDL interpretations; exiting loop")
break

if (max([globals.RESISTANCE_RANKING[interpretation] for gene_set in all_responsible_mdl_interpretations.values() for interpretation in gene_set]) != globals.RESISTANCE_RANKING[max_mdl_resistance[0]]) and gene in responsible_gene:
max_mdl_resistance = [annotation for annotation, rank in globals.RESISTANCE_RANKING.items() if rank == max([globals.RESISTANCE_RANKING[interpretation] for gene_set in all_responsible_mdl_interpretations.values() for interpretation in gene_set])]
self.logger.debug("LIMS:The maximum needed to be reevaluated; the potential new max_mdl_resistance is now {}".format(max_mdl_resistance[0]))
Expand Down Expand Up @@ -353,7 +357,11 @@ def create_lims_report(self):
for antimicrobial_code, gene_dictionary in globals.ANTIMICROBIAL_CODE_TO_GENES.items():
drug_name = globals.ANTIMICROBIAL_CODE_TO_DRUG_NAME[antimicrobial_code]
# get the MDL interpretations for all genes **FOR THE LIMS REPORT** associated with this drug
potential_mdl_resistances = globals.DF_LABORATORIAN[globals.DF_LABORATORIAN["antimicrobial"] == drug_name].loc[globals.DF_LABORATORIAN["tbprofiler_gene_name"].isin(gene_dictionary.keys())]["mdl_interpretation"]
potential_mdl_resistances = globals.DF_LABORATORIAN[globals.DF_LABORATORIAN["antimicrobial"] == drug_name].loc[globals.DF_LABORATORIAN["tbprofiler_gene_name"].isin(gene_dictionary.keys())]

# remove any interpretations with failed quality warnings
potential_mdl_resistances = potential_mdl_resistances.loc[~potential_mdl_resistances["warning"].str.contains("Failed quality in the mutation position")]
potential_mdl_resistances = potential_mdl_resistances["mdl_interpretation"].tolist()

# initalize list of genes responsible for the max resistance
responsible_gene = set()
Expand Down
2 changes: 1 addition & 1 deletion tbp_parser/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__VERSION__ = "v1.5.10"
__VERSION__ = "v2.0.0"

0 comments on commit 14af63f

Please sign in to comment.