Skip to content

Commit

Permalink
Switch from NOT to ! in resistance rules for #412.
Browse files Browse the repository at this point in the history
Change resistance level numbers to match Conan's.
Make sure reported mutations have wild type.
  • Loading branch information
donkirkby committed Jan 17, 2018
1 parent f01aa36 commit 10522a3
Show file tree
Hide file tree
Showing 4 changed files with 202 additions and 188 deletions.
24 changes: 14 additions & 10 deletions micall/hivdb/asi_algorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,14 +179,14 @@ def load_xml(self, file):
self.mutation_comments.append([gene_name, rules])

def load_yaml(self, rules_config, genotype):
self.level_def = {'-2': 'Resistance Interpretation Not Available',
'-1': 'Not Indicated',
self.level_def = {'-1': 'Resistance Interpretation Not Available',
'0': 'Sequence does not meet quality-control standards',
'1': 'Likely Susceptible',
'2': 'Mutations Detected; Effect Unknown',
'3': 'Resistance Possible',
'4': 'Resistance Likely'}
self.global_range = [('-INF', '3', '1'), ('4', '7', '3'), ('8', 'INF', '4')]
'2': 'Not Indicated',
'3': 'Mutations Detected; Effect Unknown',
'4': 'Resistance Possible',
'5': 'Resistance Likely'}
self.global_range = [('-INF', '3', '1'), ('4', '7', '4'), ('8', 'INF', '5')]
for drug in rules_config:
drug_code = drug['code']
drug_rules = []
Expand Down Expand Up @@ -311,7 +311,11 @@ def interpret(self, aaseq, region):

score = float(rule_result.score)
flags = rule_result.flags
m = rule_result.residues
# rule_result.residues doesn't always have wild types.
m = {mutation
for mutation_set in mutations
for mutation in mutation_set
if mutation in rule_result.residues}
raw_mutations[drug_class] |= m

for action, comment in actions:
Expand All @@ -332,11 +336,11 @@ def interpret(self, aaseq, region):
scorerange = self.global_range
if score == 0:
if 'Not available' in flags:
drug_result.level = -2
elif 'Not indicated' in flags:
drug_result.level = -1
elif 'Effect unknown' in flags:
elif 'Not indicated' in flags:
drug_result.level = 2
elif 'Effect unknown' in flags:
drug_result.level = 3
else:
# use score range to determine level
for low_score, high_score, level in scorerange:
Expand Down
12 changes: 6 additions & 6 deletions micall/hivdb/genreport.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,13 @@
known_regions: [NS3, NS5a, NS5b]
resistance_level_colours:
# these are 'name, bg_colour, fg_colour
-2: ['Resistance Interpretation Not Available', 0xFFFFFF, 0x000000]
-1: ['Not Indicated', 0xFFFFFF, 0x000000]
-1: ['Resistance Interpretation Not Available', 0xFFFFFF, 0x000000]
0: ['Sequence does not meet quality-control standards', 0xFFFFFF, 0x000000]
1: ['Likely Susceptible', 0xDEFBDE, 0x000000]
2: ['Mutations Detected; Effect Unknown', 0xF8DE7E, 0x000000]
3: ['Resistance Possible', 0xF8DE7E, 0x000000]
4: ['Resistance Likely', 0xDD0000, 0xFFFFFF]
1: ['Likely Susceptible', 0xDEFBDE, 0x000000]
2: ['Not Indicated', 0xFFFFFF, 0x000000]
3: ['Mutations Detected; Effect Unknown', 0xF8DE7E, 0x000000]
4: ['Resistance Possible', 0xF8DE7E, 0x000000]
5: ['Resistance Likely', 0xDD0000, 0xFFFFFF]

disclaimer_text: >
Mutations in NS3, NS5A and NS5B were detected by deep sequencing of HCV.
Expand Down
Loading

0 comments on commit 10522a3

Please sign in to comment.