Skip to content

AttributeError in _assign_drug_from_amrfp #28

@mikensubuga

Description

@mikensubuga

Thanks for creating this great resource!

A minor issue during the genome summary report generation phase. The interpreted genotype report is written successfully, but the summary report is never generated.

Command
amrrules --input amrfinder_results.tsv --output-prefix s_aureus --organism 's__Staphylococcus aureus'

Error

Matching markers to rules...
Traceback (most recent call last):
  File ".../bin/amrrules", line 6, in <module>
    sys.exit(main())
  File ".../amrrules/cli.py", line 62, in main
    rules_engine.run(args)
  File ".../amrrules/rules_engine.py", line 135, in run
    geno_obj = Genotype.from_result_row(g, card_amrfp=card_amrfp_conversion, amrfp_subclass=subclass, no_rule_interp=args.no_rule_interpretation)
  File ".../amrrules/genotype_parser.py", line 371, in from_result_row
    new_obj._assign_drug_from_amrfp(card_amrfp)
  File ".../amrrules/genotype_parser.py", line 400, in _assign_drug_from_amrfp
    self.drug = card_amrfp_conversion.get(self.amrfp_subclass).get('drug', '-')
AttributeError: 'NoneType' object has no attribute 'get'

I think the root cause is that AMRFinderPlus outputs FUSIDIC_ACID (with underscore) as the Subclass value for fusA point mutations (e.g. fusA_L461S, fusA_P404L, fusA_G451V). However, amrfp_to_card_drugs_classes.txt only contains FUSIDIC ACID (with a space), so card_amrfp_conversion.get('FUSIDIC_ACID') returns None, and the subsequent .get('drug', '-') call on None raises the AttributeError.

Thanks again for the resource!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions