Skip to content

Commit

Permalink
ADD use all parents for gene to drug mapping
Browse files Browse the repository at this point in the history
confers_resistance_to() now gets drugs for the whole AMR gene family. This is done by navigating up ARO tree and getting drugs for parent terms of input genes. For example, OXA-19 previously only returned cephalosporin and penam, but now will also return oxacillin (from AMR gene family).
  • Loading branch information
Vedanth-Ramji committed Jun 23, 2024
1 parent d8ae8b0 commit be22611
Show file tree
Hide file tree
Showing 11 changed files with 548 additions and 530 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased

### Update drug categorization
- confers_resistance_to() now gets drugs for the whole AMR gene family. For example, OXA-19 previously only returned cephalosporin and penam, but now will also return oxacillin (from AMR gene family).

### Manual curation
- argannot_curation: (Tet)tetH:EF460464:6286-7839:1554 was incorrectly annotated as ARO:3004797 which is a beta-lactamase due to a loose RGI hit. This was manually curated to ARO:3000175.

Expand Down
25 changes: 17 additions & 8 deletions argnorm/drug_categorization.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,36 @@

def confers_resistance_to(aro_num: str) -> List[str]:
'''
Description: Returns a list of the drugs/antibiotics to which a gene confers resistance to.
Description: Returns a list of the drugs/antibiotics to which a gene and its parents confers resistance to.
Parameters:
aro_num (str): ARO number. Needs to be in the form 'ARO:number'.
Returns:
target (list[str]):
A list with ARO number of the drugs/antibiotics to which the input gene confers resistance to.
A list with ARO number of the drugs/antibiotics to which the input gene and its parents confers resistance to.
'''

antibiotic_molecule_node = [ARO['ARO:1000003'], ARO['ARO:1000001']]
# some gene superclasses can map to drugs which are immediate children of 'antibiotic molecule'
# only use these if no other drugs can be found, as this information will be present in
# drugs to drug classes
backup_drugs = []
target = set()

for term in ARO[aro_num].superclasses():
for drug in term.relationships.get(confers_resistance_to_drug_class_rel, []):
target.add(drug.id)
if list(ARO[drug.id].superclasses())[1:] == antibiotic_molecule_node:
backup_drugs.append(drug.id)
else:
target.add(drug.id)

for drug in term.relationships.get(confers_resistance_to_antibiotic_rel, []):
target.add(drug.id)
if list(ARO[drug.id].superclasses())[1:] == antibiotic_molecule_node:
backup_drugs.append(drug.id)
else:
target.add(drug.id)

if target:
break
if not target:
target.update(backup_drugs)

return sorted(target)

Expand Down
228 changes: 114 additions & 114 deletions outputs/hamronized/abricate.argannot.tsv

Large diffs are not rendered by default.

98 changes: 49 additions & 49 deletions outputs/hamronized/abricate.megares.tsv

Large diffs are not rendered by default.

54 changes: 27 additions & 27 deletions outputs/hamronized/abricate.ncbi.tsv

Large diffs are not rendered by default.

314 changes: 157 additions & 157 deletions outputs/hamronized/abricate.resfinder.tsv

Large diffs are not rendered by default.

228 changes: 114 additions & 114 deletions outputs/hamronized/abricate.resfinderfg.tsv

Large diffs are not rendered by default.

44 changes: 22 additions & 22 deletions outputs/hamronized/args-oap.sarg.reads.tsv

Large diffs are not rendered by default.

44 changes: 22 additions & 22 deletions outputs/raw/args-oap.sarg.reads.tsv

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions outputs/raw/deeparg.deeparg.orfs.tsv

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions tests/test_arg_category.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,19 @@ def test_confers_resistance_to():
test_cases = [
"ARO:3003938",
"ARO:3000014",
"ARO:3003725"
"ARO:3003725",
"ARO:3000230",
"ARO:3005046",
"ARO:3001414"
]

expected_output = [
["ARO:3000008", "ARO:0000032", "ARO:0000044"],
["ARO:3000008", "ARO:0000004", "ARO:3003706", "ARO:0000032", "ARO:3000637"],
["ARO:3000081"]
["ARO:3000081"],
["ARO:3007382", "ARO:0000052", "ARO:0000007", "ARO:0000035", "ARO:0000049"],
["ARO:0000015", "ARO:3000008"],
['ARO:0000032', 'ARO:0000056', 'ARO:3000008']
]

for t,e in zip(test_cases, expected_output):
Expand Down

0 comments on commit be22611

Please sign in to comment.