phac-nml / staramr

Scans genome contigs against the ResFinder, PlasmidFinder, and PointFinder databases.
Apache License 2.0
120 stars 26 forks source link

Error: multiple matches for gene=gyrA #174

Closed stanikae closed 1 year ago

stanikae commented 1 year ago

Hi,

Getting following error when running staramr on one of my E coli assemblies: staramr.exceptions.GenotypePhenotypeMatchException.GenotypePhenotypeMatchException: Error, multiple matches for gene=gyrA, codon_mutation=CodonMutationPosition(_database_amr_gene_start=1, _nucleotide_position_amr_gene=259, _codon_start=87, _database_amr_gene_codon=GAC, _input_genome_codon=AAC)

See full error message below:

--- Logging error ---
Traceback (most recent call last):
  File "~/lib/python3.6/site-packages/staramr/blast/results/BlastResultsParser.py", line 67, in parse_results
    self._handle_blast_hit(file, database_name, blast_out, results, hit_seq_records)
  File "~/lib/python3.6/site-packages/staramr/blast/results/BlastResultsParser.py", line 109, in _handle_blast_hit
    blast_results = self._get_result_rows(hit, database_name)
  File "~/lib/python3.6/site-packages/staramr/blast/results/pointfinder/BlastResultsParserPointfinder.py", line 79, in _get_result_rows
    database_resistance_mutations = self._blast_database.get_resistance_codons(gene, database_mutations)
  File "~/lib/python3.6/site-packages/staramr/blast/pointfinder/PointfinderBlastDatabase.py", line 54, in get_resistance_codons
    return self._pointfinder_info.get_resistance_codons(gene, codon_mutations)
  File "~/lib/python3.6/site-packages/staramr/blast/pointfinder/PointfinderDatabaseInfo.py", line 107, in get_resistance_codons
    match = self._get_resistance_codon_match(gene, codon_mutation)
  File "~/lib/python3.6/site-packages/staramr/blast/pointfinder/PointfinderDatabaseInfo.py", line 76, in _get_resistance_codon_match
    raise GenotypePhenotypeMatchException("Error, multiple matches for gene=" + str(gene) + ", codon_mutation=" + str(codon_mutation))
staramr.exceptions.GenotypePhenotypeMatchException.GenotypePhenotypeMatchException: Error, multiple matches for gene=gyrA, codon_mutation=CodonMutationPosition(_database_amr_gene_start=1, _nucleotide_position_amr_gene=259, _codon_start=87, _database_amr_gene_codon=GAC, _input_genome_codon=AAC)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "~/lib/python3.6/logging/__init__.py", line 994, in emit
    msg = self.format(record)
  File "~/lib/python3.6/logging/__init__.py", line 840, in format
    return fmt.format(record)
  File "~/lib/python3.6/logging/__init__.py", line 577, in format
    record.message = record.getMessage()
  File "~/lib/python3.6/logging/__init__.py", line 338, in getMessage
    msg = msg % self.args
TypeError: not all arguments converted during string formatting
Call stack:
  File "~/bin/staramr", line 68, in <module>
    args.run_command(args)
  File "~/lib/python3.6/site-packages/staramr/subcommand/Search.py", line 488, in run
    unacceptable_num_contigs= args.unacceptable_num_contigs)
  File "~/lib/python3.6/site-packages/staramr/subcommand/Search.py", line 290, in _generate_results
    report_all_blast, ignore_invalid_files, mlst_scheme)
  File "~/lib/python3.6/site-packages/staramr/detection/AMRDetection.py", line 195, in run_amr_detection
    plength_threshold_pointfinder, report_all)
  File "~/lib/python3.6/site-packages/staramr/detection/AMRDetectionResistance.py", line 56, in _create_pointfinder_dataframe
    return pointfinder_parser.parse_results()
  File "~/lib/python3.6/site-packages/staramr/blast/results/BlastResultsParser.py", line 69, in parse_results
    logger.error(f"Error with results from file [{file}]", e)
Message: 'Error with results from file [11008_assembly_assembly.fasta]'
Arguments: (GenotypePhenotypeMatchException('Error, multiple matches for gene=gyrA, codon_mutation=CodonMutationPosition(_database_amr_gene_start=1, _nucleotide_position_amr_gene=259, _codon_start=87, _database_amr_gene_codon=GAC, _input_genome_codon=AAC)',),)
2023-04-23 11:40:00 ERROR: Error, multiple matches for gene=gyrA, codon_mutation=CodonMutationPosition(_database_amr_gene_start=1, _nucleotide_position_amr_gene=259, _codon_start=87, _database_amr_gene_codon=GAC, _input_genome_codon=AAC)
Traceback (most recent call last):
 File "~/bin/staramr", line 68, in <module>
    args.run_command(args)
  File "~/lib/python3.6/site-packages/staramr/subcommand/Search.py", line 488, in run
    unacceptable_num_contigs= args.unacceptable_num_contigs)
  File "~/lib/python3.6/site-packages/staramr/subcommand/Search.py", line 290, in _generate_results
    report_all_blast, ignore_invalid_files, mlst_scheme)
  File "~/lib/python3.6/site-packages/staramr/detection/AMRDetection.py", line 195, in run_amr_detection
    plength_threshold_pointfinder, report_all)
  File "~/lib/python3.6/site-packages/staramr/detection/AMRDetectionResistance.py", line 56, in _create_pointfinder_dataframe
    return pointfinder_parser.parse_results()
  File "~/lib/python3.6/site-packages/staramr/blast/results/BlastResultsParser.py", line 70, in parse_results
    raise e
  File "~/lib/python3.6/site-packages/staramr/blast/results/BlastResultsParser.py", line 67, in parse_results
    self._handle_blast_hit(file, database_name, blast_out, results, hit_seq_records)
  File "~/lib/python3.6/site-packages/staramr/blast/results/BlastResultsParser.py", line 109, in _handle_blast_hit
    blast_results = self._get_result_rows(hit, database_name)
  File "~/lib/python3.6/site-packages/staramr/blast/results/pointfinder/BlastResultsParserPointfinder.py", line 79, in _get_result_rows
    database_resistance_mutations = self._blast_database.get_resistance_codons(gene, database_mutations)
  File "~/lib/python3.6/site-packages/staramr/blast/pointfinder/PointfinderBlastDatabase.py", line 54, in get_resistance_codons
    return self._pointfinder_info.get_resistance_codons(gene, codon_mutations)
  File "~/lib/python3.6/site-packages/staramr/blast/pointfinder/PointfinderDatabaseInfo.py", line 107, in get_resistance_codons
    match = self._get_resistance_codon_match(gene, codon_mutation)
  File "~/lib/python3.6/site-packages/staramr/blast/pointfinder/PointfinderDatabaseInfo.py", line 76, in _get_resistance_codon_match
    raise GenotypePhenotypeMatchException("Error, multiple matches for gene=" + str(gene) + ", codon_mutation=" + str(codon_mutation))
staramr.exceptions.GenotypePhenotypeMatchException.GenotypePhenotypeMatchException: Error, multiple matches for gene=gyrA, codon_mutation=CodonMutationPosition(_database_amr_gene_start=1, _nucleotide_position_amr_gene=259, _codon_start=87, _database_amr_gene_codon=GAC, _input_genome_codon=AAC)
apetkau commented 1 year ago

Thank you for reporting. We will try to find a fix for you.

emarinier commented 1 year ago

Noting that this particular exception appears to exist in StarAMR version 0.8.0, but not in 0.9.0 and onwards.

apetkau commented 1 year ago

This issue is fixed in the latest version of staramr. Test added in #192 to verify