From 10522a3b338af4a2a863a1d04b83fc53c1dd9ad7 Mon Sep 17 00:00:00 2001 From: don Date: Wed, 17 Jan 2018 10:11:17 -0800 Subject: [PATCH] Switch from NOT to ! in resistance rules for #412. Change resistance level numbers to match Conan's. Make sure reported mutations have wild type. --- micall/hivdb/asi_algorithm.py | 24 +- micall/hivdb/genreport.yaml | 12 +- micall/hivdb/hcv_rules.yaml | 344 ++++++++++++++--------------- micall/tests/test_asi_algorithm.py | 10 + 4 files changed, 202 insertions(+), 188 deletions(-) diff --git a/micall/hivdb/asi_algorithm.py b/micall/hivdb/asi_algorithm.py index fa8955122..cb1fe3aa6 100644 --- a/micall/hivdb/asi_algorithm.py +++ b/micall/hivdb/asi_algorithm.py @@ -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 = [] @@ -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: @@ -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: diff --git a/micall/hivdb/genreport.yaml b/micall/hivdb/genreport.yaml index e59ec929a..7548f5bd4 100644 --- a/micall/hivdb/genreport.yaml +++ b/micall/hivdb/genreport.yaml @@ -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. diff --git a/micall/hivdb/hcv_rules.yaml b/micall/hivdb/hcv_rules.yaml index 4805c6a78..07c1f3b4c 100644 --- a/micall/hivdb/hcv_rules.yaml +++ b/micall/hivdb/hcv_rules.yaml @@ -5,21 +5,21 @@ region: NS3 rules: SCORE FROM ( 36AM => 8, 54AS => 8, 55AI => 8, 107I => 4, 155K => 8, 156ST => 8, 158I => 4, 168N => 4, 170FTV => 8, - NOT R155KR => "Effect unknown", NOT V36AMV => "Effect unknown", - NOT T54AST => "Effect unknown", NOT V55AIV => "Effect unknown", - NOT D168ND => "Effect unknown", NOT I170FTVI => "Effect unknown", - NOT V107IV => "Effect unknown", NOT A156STA => "Effect unknown", - NOT V158IV => "Effect unknown" ) + R155!KR => "Effect unknown", V36!AMV => "Effect unknown", + T54!AST => "Effect unknown", V55!AIV => "Effect unknown", + D168!ND => "Effect unknown", I170!FTVI => "Effect unknown", + V107!IV => "Effect unknown", A156!STA => "Effect unknown", + V158!IV => "Effect unknown" ) - genotype: 1B reference: HCV1B-Con1-NS3 region: NS3 rules: SCORE FROM ( 36MA => 8, 54CGSA => 8, 55A => 8, 107I => 4, 155CK => 8, 156TVS => 8, 158I => 4, 170TA => 8, 175L => 4, 170I => 0, - NOT R155CKR => "Effect unknown", NOT V36MAV => "Effect unknown", - NOT T54CGSAT => "Effect unknown", NOT V55AV => "Effect unknown", - NOT V170TAIV => "Effect unknown", NOT V107IV => "Effect unknown", - NOT A156TVSA => "Effect unknown", NOT V158IV => "Effect unknown", - NOT M175LM => "Effect unknown" ) + R155!CKR => "Effect unknown", V36!MAV => "Effect unknown", + T54!CGSAT => "Effect unknown", V55!AV => "Effect unknown", + V170!TAIV => "Effect unknown", V107!IV => "Effect unknown", + A156!TVSA => "Effect unknown", V158!IV => "Effect unknown", + M175!LM => "Effect unknown" ) - genotype: '2' reference: HCV2-JFH-1-NS3 region: NS3 @@ -52,35 +52,35 @@ region: NS5a rules: SCORE FROM ( 24RG => 4, 24N => 0, 26E => 0, 28AT => 8, 28SV => 4, 30EHKNRYDG => 8, 30T => 4, 30L => 0, 31IMV => 8, 54R => 4, 58D => 8, - 58PR => 4, 92K => 0, 93CHNS => 8, 93F => 0, NOT H54RH => "Effect unknown", - NOT Y93CHNSFY => "Effect unknown", NOT K24RGNK => "Effect unknown", - NOT A92KA => "Effect unknown", NOT K26EK => "Effect unknown", - NOT M28ATSVM => "Effect unknown", NOT H58DPRH => "Effect unknown", - NOT Q30EHKNRYDGTLQ => "Effect unknown", NOT L31IMVL => "Effect unknown" ) + 58PR => 4, 92K => 0, 93CHNS => 8, 93F => 0, H54!RH => "Effect unknown", + Y93!CHNSFY => "Effect unknown", K24!RGNK => "Effect unknown", + A92!KA => "Effect unknown", K26!EK => "Effect unknown", + M28!ATSVM => "Effect unknown", H58!DPRH => "Effect unknown", + Q30!EHKNRYDGTLQ => "Effect unknown", L31!IMVL => "Effect unknown" ) - genotype: 1B reference: HCV1B-Con1-NS5a region: NS5a rules: SCORE FROM ( 28MT => 4, 29XS => 4, 30GHPQ => 4, 31FV => 8, 31IM => 4, 32X => 8, 32L => 4, 58S => 4, 62D => 4, 92K => 4, 93H => 8, 93N => 4, - NOT P32XLP => "Effect unknown", NOT Q62DQ => "Effect unknown", - NOT Y93HNY => "Effect unknown", NOT A92KA => "Effect unknown", - NOT P58SP => "Effect unknown", NOT L28MTL => "Effect unknown", - NOT P29XSP => "Effect unknown", NOT R30GHPQR => "Effect unknown", - NOT L31FVIML => "Effect unknown" ) + P32!XLP => "Effect unknown", Q62!DQ => "Effect unknown", + Y93!HNY => "Effect unknown", A92!KA => "Effect unknown", + P58!SP => "Effect unknown", L28!MTL => "Effect unknown", + P29!XSP => "Effect unknown", R30!GHPQR => "Effect unknown", + L31!FVIML => "Effect unknown" ) - genotype: '2' reference: HCV2-JFH-1-NS5a region: NS5a rules: SCORE FROM ( 28SC => 8, 31M => 8, 92R => 8, 93H => 8, - NOT C92RC => "Effect unknown", NOT F28SCF => "Effect unknown", - NOT Y93HY => "Effect unknown", NOT L31ML => "Effect unknown" ) + C92!RC => "Effect unknown", F28!SCF => "Effect unknown", + Y93!HY => "Effect unknown", L31!ML => "Effect unknown" ) - genotype: '3' reference: HCV3-S52-NS5a region: NS5a rules: SCORE FROM ( 28T => 0, 28V => 0, 30K => 8, 30S => 4, 30TV => 0, 31FIMV => 8, 31P => 4, 62ALIRPT => 4, 93H => 8, - NOT Y93HY => "Effect unknown", NOT M28TVM => "Effect unknown", - NOT S62ALIRPTS => "Effect unknown", NOT A30KSTVA => "Effect unknown", - NOT L31FIMVPL => "Effect unknown" ) + Y93!HY => "Effect unknown", M28!TVM => "Effect unknown", + S62!ALIRPTS => "Effect unknown", A30!KSTVA => "Effect unknown", + L31!FIMVPL => "Effect unknown" ) - genotype: '4' reference: HCV4-ED43-NS5a region: NS5a @@ -106,24 +106,24 @@ rules: SCORE FROM ( 307R => 4, 314H => 8, 316Y => 8, 395G => 8, 414ITV => 8, 444K => 8, 444D => 0, 446KQ => 8, 448CH => 8, 450V => 4, 553TV => 8, 553I => 4, 554S => 8, 556GR => 8, 558R => 4, 559GINV => 4, 561H => 8, - NOT Y448CHY => "Effect unknown", NOT A450VA => "Effect unknown", - NOT A553TVIA => "Effect unknown", NOT G554SG => "Effect unknown", - NOT A395GA => "Effect unknown", NOT S556GRS => "Effect unknown", - NOT G558RG => "Effect unknown", NOT D559GINVD => "Effect unknown", - NOT Y561HY => "Effect unknown", NOT G307RG => "Effect unknown", - NOT M414ITVM => "Effect unknown", NOT C316YC => "Effect unknown", - NOT L314HL => "Effect unknown", NOT N444KDN => "Effect unknown", - NOT E446KQE => "Effect unknown" ) + Y448!CHY => "Effect unknown", A450!VA => "Effect unknown", + A553!TVIA => "Effect unknown", G554!SG => "Effect unknown", + A395!GA => "Effect unknown", S556!GRS => "Effect unknown", + G558!RG => "Effect unknown", D559!GINVD => "Effect unknown", + Y561!HY => "Effect unknown", G307!RG => "Effect unknown", + M414!ITVM => "Effect unknown", C316!YC => "Effect unknown", + L314!HL => "Effect unknown", N444!KDN => "Effect unknown", + E446!KQE => "Effect unknown" ) - genotype: 1B reference: HCV1B-Con1-NS5b region: NS5b rules: SCORE FROM ( 307R => 0, 316HNY => 8, 316W => 4, 368T => 8, 411S => 8, 414ITV => 8, 445FY => 4, 448CH => 8, 553V => 8, 556G => 8, 556R => 4, - 559G => 8, NOT S368TS => "Effect unknown", NOT Y448CHY => "Effect unknown", - NOT K307RK => "Effect unknown", NOT D559GD => "Effect unknown", - NOT A553VA => "Effect unknown", NOT N411SN => "Effect unknown", - NOT C316HNYWC => "Effect unknown", NOT C445FYC => "Effect unknown", - NOT M414ITVM => "Effect unknown", NOT S556GRS => "Effect unknown" ) + 559G => 8, S368!TS => "Effect unknown", Y448!CHY => "Effect unknown", + K307!RK => "Effect unknown", D559!GD => "Effect unknown", + A553!VA => "Effect unknown", N411!SN => "Effect unknown", + C316!HNYWC => "Effect unknown", C445!FYC => "Effect unknown", + M414!ITVM => "Effect unknown", S556!GRS => "Effect unknown" ) - genotype: '2' reference: HCV2-JFH-1-NS5b region: NS5b @@ -155,15 +155,15 @@ reference: HCV1A-H77-NS5a region: NS5a rules: SCORE FROM ( 28AGT => 8, 28V => 0, 30DEGHR => 8, 30KY => 4, 30L => 0, - 31IMFV => 8, 58D => 8, 93CHNS => 8, NOT H58DH => "Effect unknown", - NOT M28AGTVM => "Effect unknown", NOT Y93CHNSY => "Effect unknown", - NOT Q30DEGHRKYLQ => "Effect unknown", NOT L31IMFVL => "Effect unknown" ) + 31IMFV => 8, 58D => 8, 93CHNS => 8, H58!DH => "Effect unknown", + M28!AGTVM => "Effect unknown", Y93!CHNSY => "Effect unknown", + Q30!DEGHRKYLQ => "Effect unknown", L31!IMFVL => "Effect unknown" ) - genotype: 1B reference: HCV1B-Con1-NS5a region: NS5a rules: SCORE FROM ( 28M => 4, 31FMV => 8, 93H => 8, - NOT L28ML => "Effect unknown", NOT Y93HY => "Effect unknown", - NOT L31FMVL => "Effect unknown" ) + L28!ML => "Effect unknown", Y93!HY => "Effect unknown", + L31!FMVL => "Effect unknown" ) - genotype: '2' reference: HCV2-JFH-1-NS5a region: NS5a @@ -172,15 +172,15 @@ reference: HCV3-S52-NS5a region: NS5a rules: SCORE FROM ( 30DK => 8, 31FM => 8, 93H => 8, - NOT Y93HY => "Effect unknown", NOT A30DKA => "Effect unknown", - NOT L31FML => "Effect unknown" ) + Y93!HY => "Effect unknown", A30!DKA => "Effect unknown", + L31!FML => "Effect unknown" ) - genotype: '4' reference: HCV4-ED43-NS5a region: NS5a rules: SCORE FROM ( 30HF => 8, 30S => 0, 31V => 8, 31I => 4, 32L => 4, - 58D => 8, 93H => 8, NOT P32LP => "Effect unknown", - NOT P58DP => "Effect unknown", NOT Y93HY => "Effect unknown", - NOT L30HFSL => "Effect unknown", NOT M31VIM => "Effect unknown" ) + 58D => 8, 93H => 8, P32!LP => "Effect unknown", + P58!DP => "Effect unknown", Y93!HY => "Effect unknown", + L30!HFSL => "Effect unknown", M31!VIM => "Effect unknown" ) - genotype: '5' reference: HCV5-SA13-NS5a region: NS5a @@ -202,19 +202,19 @@ rules: SCORE FROM ( 36ALM => 4, 56H => 8, 56F => 4, 107I => 4, 122GT => 4, 122R => 0, 155GIKS => 4, 156GLTV => 8, 156M => 4, 156S => 0, 158A => 4, 168AEFGHIKLTVY => 8, 168CNS => 4, 170V => 4, 170T => 0, - NOT D168AEFGHIKLTVYCNSD => "Effect unknown", - NOT R155GIKSR => "Effect unknown", NOT V36ALMV => "Effect unknown", - NOT Y56HFY => "Effect unknown", NOT S122GTRS => "Effect unknown", - NOT V107IV => "Effect unknown", NOT A156GLTVMSA => "Effect unknown", - NOT I170VTI => "Effect unknown", NOT V158AV => "Effect unknown" ) + D168!AEFGHIKLTVYCNSD => "Effect unknown", + R155!GIKSR => "Effect unknown", V36!ALMV => "Effect unknown", + Y56!HFY => "Effect unknown", S122!GTRS => "Effect unknown", + V107!IV => "Effect unknown", A156!GLTVMSA => "Effect unknown", + I170!VTI => "Effect unknown", V158!AV => "Effect unknown" ) - genotype: 1B reference: HCV1B-Con1-NS3 region: NS3 rules: SCORE FROM ( 56H => 8, 56F => 4, 107I => 4, 155GTW => 8, 155K => 0, 156TV => 8, 156G => 4, 168AFGHIKLTV => 8, 168ENY => 4, - NOT Y56HFY => "Effect unknown", NOT A156TVGA => "Effect unknown", - NOT V107IV => "Effect unknown", NOT R155GTWKR => "Effect unknown", - NOT D168AFGHIKLTVENYD => "Effect unknown" ) + Y56!HFY => "Effect unknown", A156!TVGA => "Effect unknown", + V107!IV => "Effect unknown", R155!GTWKR => "Effect unknown", + D168!AFGHIKLTVENYD => "Effect unknown" ) - genotype: '2' reference: HCV2-JFH-1-NS3 region: NS3 @@ -223,19 +223,19 @@ reference: HCV3-S52-NS3 region: NS3 rules: SCORE FROM ( 77S => 8, 168QR => 8, 178R => 8, - NOT Q168QRQ => "Effect unknown", NOT Q178RQ => "Effect unknown", - NOT V170V => "Effect unknown", NOT Y56Y => "Effect unknown", - NOT S122S => "Effect unknown", NOT R155R => "Effect unknown", - NOT A156A => "Effect unknown", NOT N77SN => "Effect unknown" ) + Q168!QRQ => "Effect unknown", Q178!RQ => "Effect unknown", + V170!V => "Effect unknown", Y56!Y => "Effect unknown", + S122!S => "Effect unknown", R155!R => "Effect unknown", + A156!A => "Effect unknown", N77!SN => "Effect unknown" ) - genotype: '4' reference: HCV4-ED43-NS3 region: NS3 rules: SCORE FROM ( 107I => 4, 122G => 4, 156GMTV => 4, 158I => 4, 168AV => 8, - 168CEGNY => 4, 170I => 4, NOT D168AVCEGNYD => "Effect unknown", - NOT R155R => "Effect unknown", NOT Y56Y => "Effect unknown", - NOT T122GT => "Effect unknown", NOT V107IV => "Effect unknown", - NOT A156GMTVA => "Effect unknown", NOT V170IV => "Effect unknown", - NOT V158IV => "Effect unknown" ) + 168CEGNY => 4, 170I => 4, D168!AVCEGNYD => "Effect unknown", + R155!R => "Effect unknown", Y56!Y => "Effect unknown", + T122!GT => "Effect unknown", V107!IV => "Effect unknown", + A156!GMTVA => "Effect unknown", V170!IV => "Effect unknown", + V158!IV => "Effect unknown" ) - genotype: '5' reference: HCV5-SA13-NS3 region: NS3 @@ -256,19 +256,19 @@ region: NS5a rules: SCORE FROM ( 24RGN => 4, 28AGT => 8, 28V => 4, 30EGHKNRY => 8, 30LT => 4, 31IMV => 8, 31P => 4, 32L => 8, 38F => 8, 58D => 8, 58P => 4, - 92P => 8, 92T => 4, 93CHNS => 8, 93F => 4, NOT P32LP => "Effect unknown", - NOT S38FS => "Effect unknown", NOT K24RGNK => "Effect unknown", - NOT A92PTA => "Effect unknown", NOT H58DPH => "Effect unknown", - NOT M28AGTVM => "Effect unknown", NOT Y93CHNSFY => "Effect unknown", - NOT Q30EGHKNRYLTQ => "Effect unknown", NOT L31IMVPL => "Effect unknown" ) + 92P => 8, 92T => 4, 93CHNS => 8, 93F => 4, P32!LP => "Effect unknown", + S38!FS => "Effect unknown", K24!RGNK => "Effect unknown", + A92!PTA => "Effect unknown", H58!DPH => "Effect unknown", + M28!AGTVM => "Effect unknown", Y93!CHNSFY => "Effect unknown", + Q30!EGHKNRYLTQ => "Effect unknown", L31!IMVPL => "Effect unknown" ) - genotype: 1B reference: HCV1B-Con1-NS5a region: NS5a rules: SCORE FROM ( 28M => 4, 31IV => 8, 31M => 4, 31F => 0, 32L => 0, 58D => 8, 92K => 8, 92T => 4, 93H => 8, 93C => 4, 93S => 0, - NOT P32LP => "Effect unknown", NOT L28ML => "Effect unknown", - NOT P58DP => "Effect unknown", NOT A92KTA => "Effect unknown", - NOT Y93HCSY => "Effect unknown", NOT L31IVMFL => "Effect unknown" ) + P32!LP => "Effect unknown", L28!ML => "Effect unknown", + P58!DP => "Effect unknown", A92!KTA => "Effect unknown", + Y93!HCSY => "Effect unknown", L31!IVMFL => "Effect unknown" ) - genotype: '2' reference: HCV2-JFH-1-NS5a region: NS5a @@ -301,21 +301,21 @@ region: NS5a rules: SCORE FROM ( 24R => 4, 28TV => 8, 28A => 4, 30EKRY => 8, 30HLNT => 0, 31V => 8, 31MI => 0, 32L => 4, 54Y => 4, 58D => 8, 58PR => 4, - 93CFHLNS => 8, NOT P32LP => "Effect unknown", - NOT H54YH => "Effect unknown", NOT K24RK => "Effect unknown", - NOT H58DPRH => "Effect unknown", NOT M28TVAM => "Effect unknown", - NOT Y93CFHLNSY => "Effect unknown", NOT Q30EKRYHLNTQ => "Effect unknown", - NOT L31VMIL => "Effect unknown" ) + 93CFHLNS => 8, P32!LP => "Effect unknown", + H54!YH => "Effect unknown", K24!RK => "Effect unknown", + H58!DPRH => "Effect unknown", M28!TVAM => "Effect unknown", + Y93!CFHLNSY => "Effect unknown", Q30!EKRYHLNTQ => "Effect unknown", + L31!VMIL => "Effect unknown" ) - genotype: 1B reference: HCV1B-Con1-NS5a region: NS5a rules: SCORE FROM ( 28T => 8, 28M => 4, 29X => 8, 30GHPQ => 4, 31FV => 8, 31MT => 4, 31I => 0, 32X => 4, 54Y => 4, 58AS => 4, 92E => 4, 93HNS => 8, - NOT P32XP => "Effect unknown", NOT Q54YQ => "Effect unknown", - NOT Y93HNSY => "Effect unknown", NOT A92EA => "Effect unknown", - NOT P58ASP => "Effect unknown", NOT L28TML => "Effect unknown", - NOT P29XP => "Effect unknown", NOT R30GHPQR => "Effect unknown", - NOT L31FVMTIL => "Effect unknown" ) + P32!XP => "Effect unknown", Q54!YQ => "Effect unknown", + Y93!HNSY => "Effect unknown", A92!EA => "Effect unknown", + P58!ASP => "Effect unknown", L28!TML => "Effect unknown", + P29!XP => "Effect unknown", R30!GHPQR => "Effect unknown", + L31!FVMTIL => "Effect unknown" ) - genotype: '2' reference: HCV2-JFH-1-NS5a region: NS5a @@ -328,8 +328,8 @@ reference: HCV4-ED43-NS5a region: NS5a rules: SCORE FROM ( 28V => 8, 28S => 4, 31I => 4, 31L => 0, 58S => 4, - 58AP => 0, NOT P58SAPP => "Effect unknown", NOT L28VSL => "Effect unknown", - NOT M31ILM => "Effect unknown" ) + 58AP => 0, P58!SAPP => "Effect unknown", L28!VSL => "Effect unknown", + M31!ILM => "Effect unknown" ) - genotype: '5' reference: HCV5-SA13-NS5a region: NS5a @@ -351,22 +351,22 @@ rules: SCORE FROM ( 36AMT => 4, 36L => 0, 43L => 8, 55I => 4, 56H => 4, 80KL => 4, 80R => 0, 132V => 4, 155GKTW => 8, 155S => 4, 156T => 8, 156GVS => 4, 168AEFHILNTVY => 8, 334S => 4, 342P => 4, 357K => 4, - 406AI => 4, 449I => 4, 470S => 4, NOT T449IT => "Effect unknown", - NOT V36AMTLV => "Effect unknown", NOT E357KE => "Effect unknown", - NOT V406AIV => "Effect unknown", NOT D168AEFHILNTVYD => "Effect unknown", - NOT P470SP => "Effect unknown", NOT F43LF => "Effect unknown", - NOT P334SP => "Effect unknown", NOT Q80KLRQ => "Effect unknown", - NOT S342PS => "Effect unknown", NOT V55IV => "Effect unknown", - NOT Y56HY => "Effect unknown", NOT I132VI => "Effect unknown", - NOT R155GKTWSR => "Effect unknown", NOT A156TGVSA => "Effect unknown" ) + 406AI => 4, 449I => 4, 470S => 4, T449!IT => "Effect unknown", + V36!AMTLV => "Effect unknown", E357!KE => "Effect unknown", + V406!AIV => "Effect unknown", D168!AEFHILNTVYD => "Effect unknown", + P470!SP => "Effect unknown", F43!LF => "Effect unknown", + P334!SP => "Effect unknown", Q80!KLRQ => "Effect unknown", + S342!PS => "Effect unknown", V55!IV => "Effect unknown", + Y56!HY => "Effect unknown", I132!VI => "Effect unknown", + R155!GKTWSR => "Effect unknown", A156!TGVSA => "Effect unknown" ) - genotype: 1B reference: HCV1B-Con1-NS3 region: NS3 rules: SCORE FROM ( 56H => 4, 155K => 8, 156V => 8, 156T => 4, 156S => 0, 168AFHKTVY => 8, 168ILN => 4, 168E => 0, 357K => 4, - NOT Y56HY => "Effect unknown", NOT D168AFHKTVYILNED => "Effect unknown", - NOT R155KR => "Effect unknown", NOT A156VTSA => "Effect unknown", - NOT E357KE => "Effect unknown" ) + Y56!HY => "Effect unknown", D168!AFHKTVYILNED => "Effect unknown", + R155!KR => "Effect unknown", A156!VTSA => "Effect unknown", + E357!KE => "Effect unknown" ) - genotype: '2' reference: HCV2-JFH-1-NS3 region: NS3 @@ -379,8 +379,8 @@ reference: HCV4-ED43-NS3 region: NS3 rules: SCORE FROM ( 56H => 8, 155C => 8, 156TV => 8, 168HV => 8, - NOT Y56HY => "Effect unknown", NOT D168HVD => "Effect unknown", - NOT R155CR => "Effect unknown", NOT A156TVA => "Effect unknown" ) + Y56!HY => "Effect unknown", D168!HVD => "Effect unknown", + R155!CR => "Effect unknown", A156!TVA => "Effect unknown" ) - genotype: '5' reference: HCV5-SA13-NS3 region: NS3 @@ -401,53 +401,53 @@ region: NS5b rules: SCORE FROM ( 61G => 4, 112T => 4, 159F => 4, 237G => 4, 282T => 8, 320V => 4, 321I => 4, 321A => 4, 355H => 4, 473T => 4, - NOT A112TA => "Effect unknown", NOT L320VL => "Effect unknown", - NOT Q355HQ => "Effect unknown", NOT V321IAV => "Effect unknown", - NOT S473TS => "Effect unknown", NOT S282TS => "Effect unknown", - NOT L159FL => "Effect unknown", NOT C316C => "Effect unknown", - NOT E237GE => "Effect unknown", NOT D61GD => "Effect unknown" ) + A112!TA => "Effect unknown", L320!VL => "Effect unknown", + Q355!HQ => "Effect unknown", V321!IAV => "Effect unknown", + S473!TS => "Effect unknown", S282!TS => "Effect unknown", + L159!FL => "Effect unknown", C316!C => "Effect unknown", + E237!GE => "Effect unknown", D61!GD => "Effect unknown" ) - genotype: 1B reference: HCV1B-Con1-NS5b region: NS5b rules: SCORE FROM ( 142S => 4, 282T => 8, 321I => 4, - NOT L320L => "Effect unknown", NOT V321IV => "Effect unknown", - NOT S282TS => "Effect unknown", NOT C316C => "Effect unknown", - NOT N142SN => "Effect unknown", NOT L159L => "Effect unknown" ) + L320!L => "Effect unknown", V321!IV => "Effect unknown", + S282!TS => "Effect unknown", C316!C => "Effect unknown", + N142!SN => "Effect unknown", L159!L => "Effect unknown" ) - genotype: '2' reference: HCV2-JFH-1-NS5b region: NS5b - rules: SCORE FROM ( 282T => 8, NOT L320L => "Effect unknown", - NOT V321V => "Effect unknown", NOT S282TS => "Effect unknown", - NOT C316C => "Effect unknown", NOT L159L => "Effect unknown" ) + rules: SCORE FROM ( 282T => 8, L320!L => "Effect unknown", + V321!V => "Effect unknown", S282!TS => "Effect unknown", + C316!C => "Effect unknown", L159!L => "Effect unknown" ) - genotype: '3' reference: HCV3-S52-NS5b region: NS5b rules: SCORE FROM ( 142T => 4, 159F => 4, 237G => 4, 282T => 8, 314IFP => 4, - 321A => 4, 355H => 4, NOT L320L => "Effect unknown", - NOT V321AV => "Effect unknown", NOT Q355HQ => "Effect unknown", - NOT S282TS => "Effect unknown", NOT L159FL => "Effect unknown", - NOT C316C => "Effect unknown", NOT L314IFPL => "Effect unknown", - NOT N142TN => "Effect unknown", NOT E237GE => "Effect unknown" ) + 321A => 4, 355H => 4, L320!L => "Effect unknown", + V321!AV => "Effect unknown", Q355!HQ => "Effect unknown", + S282!TS => "Effect unknown", L159!FL => "Effect unknown", + C316!C => "Effect unknown", L314!IFPL => "Effect unknown", + N142!TN => "Effect unknown", E237!GE => "Effect unknown" ) - genotype: '4' reference: HCV4-ED43-NS5b region: NS5b rules: SCORE FROM ( 237G => 4, 282T => 8, 321I => 4, - NOT L320L => "Effect unknown", NOT V321IV => "Effect unknown", - NOT S282TS => "Effect unknown", NOT C316C => "Effect unknown", - NOT E237GE => "Effect unknown", NOT L159L => "Effect unknown" ) + L320!L => "Effect unknown", V321!IV => "Effect unknown", + S282!TS => "Effect unknown", C316!C => "Effect unknown", + E237!GE => "Effect unknown", L159!L => "Effect unknown" ) - genotype: '5' reference: HCV5-SA13-NS5b region: NS5b - rules: SCORE FROM ( 282T => 8, 289I => 4, NOT L320L => "Effect unknown", - NOT M289IM => "Effect unknown", NOT V321V => "Effect unknown", - NOT S282TS => "Effect unknown", NOT C316C => "Effect unknown", - NOT L159L => "Effect unknown" ) + rules: SCORE FROM ( 282T => 8, 289I => 4, L320!L => "Effect unknown", + M289!IM => "Effect unknown", V321!V => "Effect unknown", + S282!TS => "Effect unknown", C316!C => "Effect unknown", + L159!L => "Effect unknown" ) - genotype: '6' reference: HCV6-EUHK2-NS5b region: NS5b - rules: SCORE FROM ( 282T => 8, NOT L320L => "Effect unknown", - NOT V321V => "Effect unknown", NOT S282TS => "Effect unknown", - NOT C316C => "Effect unknown", NOT L159L => "Effect unknown" ) + rules: SCORE FROM ( 282T => 8, L320!L => "Effect unknown", + V321!V => "Effect unknown", S282!TS => "Effect unknown", + C316!C => "Effect unknown", L159!L => "Effect unknown" ) name: SOF-EPC - code: SOF-HAR genotypes: @@ -456,18 +456,18 @@ region: NS5b rules: SCORE FROM ( 61G => 4, 112T => 4, 159F => 4, 237G => 4, 282T => 8, 320V => 4, 321I => 4, 321A => 4, 355H => 4, 473T => 4, - NOT A112TA => "Effect unknown", NOT L320VL => "Effect unknown", - NOT Q355HQ => "Effect unknown", NOT V321IAV => "Effect unknown", - NOT S473TS => "Effect unknown", NOT S282TS => "Effect unknown", - NOT L159FL => "Effect unknown", NOT C316C => "Effect unknown", - NOT E237GE => "Effect unknown", NOT D61GD => "Effect unknown" ) + A112!TA => "Effect unknown", L320!VL => "Effect unknown", + Q355!HQ => "Effect unknown", V321!IAV => "Effect unknown", + S473!TS => "Effect unknown", S282!TS => "Effect unknown", + L159!FL => "Effect unknown", C316!C => "Effect unknown", + E237!GE => "Effect unknown", D61!GD => "Effect unknown" ) - genotype: 1B reference: HCV1B-Con1-NS5b region: NS5b rules: SCORE FROM ( 142S => 4, 282T => 8, 321I => 4, - NOT L320L => "Effect unknown", NOT V321IV => "Effect unknown", - NOT S282TS => "Effect unknown", NOT C316C => "Effect unknown", - NOT N142SN => "Effect unknown", NOT L159L => "Effect unknown" ) + L320!L => "Effect unknown", V321!IV => "Effect unknown", + S282!TS => "Effect unknown", C316!C => "Effect unknown", + N142!SN => "Effect unknown", L159!L => "Effect unknown" ) - genotype: '2' reference: HCV2-JFH-1-NS5b region: NS5b @@ -501,21 +501,21 @@ rules: SCORE FROM ( 36L => 4, 43LIV => 4, 54S => 4, 80KR => 8, 80GHMIL => 4, 122GR => 8, 122ANIT => 4, 155KT => 8, 155GIMQSW => 4, 156GTV => 8, 156LMS => 4, 168AEHV => 8, 168CFGIKLNSTY => 4, 170T => 8, 170V => 4, - NOT Q80KRGHMILQ => "Effect unknown", NOT R155KTGIMQSWR => "Effect unknown", - NOT V36LV => "Effect unknown", NOT T54ST => "Effect unknown", - NOT D168AEHVCFGIKLNSTYD => "Effect unknown", - NOT S122GRANITS => "Effect unknown", NOT F43LIVF => "Effect unknown", - NOT A156GTVLMSA => "Effect unknown", NOT I170TVI => "Effect unknown" ) + Q80!KRGHMILQ => "Effect unknown", R155!KTGIMQSWR => "Effect unknown", + V36!LV => "Effect unknown", T54!ST => "Effect unknown", + D168!AEHVCFGIKLNSTYD => "Effect unknown", + S122!GRANITS => "Effect unknown", F43!LIVF => "Effect unknown", + A156!GTVLMSA => "Effect unknown", I170!TVI => "Effect unknown" ) - genotype: 1B reference: HCV1B-Con1-NS3 region: NS3 rules: SCORE FROM ( 41R => 8, 43SIV => 8, 43L => 4, 80KR => 8, 80HIM => 4, 80GL => 0, 122AIRT => 8, 155KGQTW => 8, 155C => 4, 155IM => 0, 156GTV => 8, 156S => 4, 168AEFGHINQTVY => 8, 168KL => 4, 170T => 4, 170A => 0, - NOT Q80KRHIMGLQ => "Effect unknown", NOT R155KGQTWCIMR => "Effect unknown", - NOT D168AEFGHINQTVYKLD => "Effect unknown", NOT Q41RQ => "Effect unknown", - NOT S122AIRTS => "Effect unknown", NOT F43SIVLF => "Effect unknown", - NOT A156GTVSA => "Effect unknown", NOT V170TAV => "Effect unknown" ) + Q80!KRHIMGLQ => "Effect unknown", R155!KGQTWCIMR => "Effect unknown", + D168!AEFGHINQTVYKLD => "Effect unknown", Q41!RQ => "Effect unknown", + S122!AIRTS => "Effect unknown", F43!SIVLF => "Effect unknown", + A156!GTVSA => "Effect unknown", V170!TAV => "Effect unknown" ) - genotype: '2' reference: HCV2-JFH-1-NS3 region: NS3 @@ -528,7 +528,7 @@ reference: HCV4-ED43-NS3 region: NS3 rules: SCORE FROM ( 155K => 8, 156G => 8, 156M => 0, - NOT R155KR => "Effect unknown", NOT A156GMA => "Effect unknown" ) + R155!KR => "Effect unknown", A156!GMA => "Effect unknown" ) - genotype: '5' reference: HCV5-SA13-NS3 region: NS3 @@ -548,16 +548,16 @@ reference: HCV1A-H77-NS3 region: NS3 rules: SCORE FROM ( 36AGILM => 8, 54AS => 8, 132V => 4, 155GMTK => 8, - 156STV => 8, 168N => 4, NOT I132VI => "Effect unknown", - NOT T54AST => "Effect unknown", NOT D168ND => "Effect unknown", - NOT V36AGILMV => "Effect unknown", NOT R155GMTKR => "Effect unknown", - NOT A156STVA => "Effect unknown" ) + 156STV => 8, 168N => 4, I132!VI => "Effect unknown", + T54!AST => "Effect unknown", D168!ND => "Effect unknown", + V36!AGILMV => "Effect unknown", R155!GMTKR => "Effect unknown", + A156!STVA => "Effect unknown" ) - genotype: 1B reference: HCV1B-Con1-NS3 region: NS3 rules: SCORE FROM ( 36GILMA => 8, 54SA => 8, 155K => 8, 156FTVS => 8, - NOT A156FTVSA => "Effect unknown", NOT R155KR => "Effect unknown", - NOT V36GILMAV => "Effect unknown", NOT T54SAT => "Effect unknown" ) + A156!FTVSA => "Effect unknown", R155!KR => "Effect unknown", + V36!GILMAV => "Effect unknown", T54!SAT => "Effect unknown" ) - genotype: '2' reference: HCV2-JFH-1-NS3 region: NS3 @@ -590,52 +590,52 @@ region: NS5a rules: SCORE FROM ( 24RTM => 4, 28GT => 8, 28V => 4, 30EK => 8, 30HLR => 4, 31MV => 8, 31I => 4, 32L => 8, 58D => 8, 58P => 4, 92K => 4, 93CHNRSW => 8, - NOT P32LP => "Effect unknown", NOT K24RTMK => "Effect unknown", - NOT A92KA => "Effect unknown", NOT H58DPH => "Effect unknown", - NOT M28GTVM => "Effect unknown", NOT Y93CHNRSWY => "Effect unknown", - NOT Q30EKHLRQ => "Effect unknown", NOT L31MVIL => "Effect unknown" ) + P32!LP => "Effect unknown", K24!RTMK => "Effect unknown", + A92!KA => "Effect unknown", H58!DPH => "Effect unknown", + M28!GTVM => "Effect unknown", Y93!CHNRSWY => "Effect unknown", + Q30!EKHLRQ => "Effect unknown", L31!MVIL => "Effect unknown" ) - genotype: 1B reference: HCV1B-Con1-NS5a region: NS5a rules: SCORE FROM ( 24K => 0, 30S => 0, 31MVI => 4, 58RT => 0, 92K => 8, - 93CHNS => 4, NOT Q24KQ => "Effect unknown", NOT P58RTP => "Effect unknown", - NOT A92KA => "Effect unknown", NOT Y93CHNSY => "Effect unknown", - NOT R30SR => "Effect unknown", NOT L31MVIL => "Effect unknown" ) + 93CHNS => 4, Q24!KQ => "Effect unknown", P58!RTP => "Effect unknown", + A92!KA => "Effect unknown", Y93!CHNSY => "Effect unknown", + R30!SR => "Effect unknown", L31!MVIL => "Effect unknown" ) - genotype: '2' reference: HCV2-JFH-1-NS5a region: NS5a rules: SCORE FROM ( 28S => 8, 31V => 8, 31MI => 4, 31L => 0, 58A => 0, - 58S => 0, 92T => 8, 93HN => 8, NOT C92TC => "Effect unknown", - NOT P58ASP => "Effect unknown", NOT F28SF => "Effect unknown", - NOT Y93HNY => "Effect unknown", NOT L31VMILL => "Effect unknown" ) + 58S => 0, 92T => 8, 93HN => 8, C92!TC => "Effect unknown", + P58!ASP => "Effect unknown", F28!SF => "Effect unknown", + Y93!HNY => "Effect unknown", L31!VMILL => "Effect unknown" ) - genotype: '3' reference: HCV3-S52-NS5a region: NS5a rules: SCORE FROM ( 30K => 8, 30V => 4, 31M => 8, 31VP => 4, 38P => 4, - 58L => 4, 92K => 4, 93HS => 8, 93NR => 4, NOT S38PS => "Effect unknown", - NOT P58LP => "Effect unknown", NOT E92KE => "Effect unknown", - NOT Y93HSNRY => "Effect unknown", NOT A30KVA => "Effect unknown", - NOT L31MVPL => "Effect unknown" ) + 58L => 4, 92K => 4, 93HS => 8, 93NR => 4, S38!PS => "Effect unknown", + P58!LP => "Effect unknown", E92!KE => "Effect unknown", + Y93!HSNRY => "Effect unknown", A30!KVA => "Effect unknown", + L31!MVPL => "Effect unknown" ) - genotype: '4' reference: HCV4-ED43-NS5a region: NS5a rules: SCORE FROM ( 28T => 4, 30HS => 4, 31V => 4, 32L => 4, 93CHNSW => 4, - NOT P32LP => "Effect unknown", NOT L28TL => "Effect unknown", - NOT Y93CHNSWY => "Effect unknown", NOT L30HSL => "Effect unknown", - NOT M31VM => "Effect unknown" ) + P32!LP => "Effect unknown", L28!TL => "Effect unknown", + Y93!CHNSWY => "Effect unknown", L30!HSL => "Effect unknown", + M31!VM => "Effect unknown" ) - genotype: '5' reference: HCV5-SA13-NS5a region: NS5a - rules: SCORE FROM ( NOT L28L => "Effect unknown", NOT P58P => "Effect unknown", - NOT A92A => "Effect unknown", NOT T93T => "Effect unknown", - NOT Q30Q => "Effect unknown", NOT L31L => "Effect unknown" ) + rules: SCORE FROM ( L28!L => "Effect unknown", P58!P => "Effect unknown", + A92!A => "Effect unknown", T93!T => "Effect unknown", + Q30!Q => "Effect unknown", L31!L => "Effect unknown" ) - genotype: '6' reference: HCV6-EUHK2-NS5a region: NS5a - rules: SCORE FROM ( 31V => 8, 32ALQR => 8, NOT P32ALQRP => "Effect unknown", - NOT A92A => "Effect unknown", NOT T58T => "Effect unknown", - NOT F28F => "Effect unknown", NOT T93T => "Effect unknown", - NOT R30R => "Effect unknown", NOT L31VL => "Effect unknown" ) + rules: SCORE FROM ( 31V => 8, 32ALQR => 8, P32!ALQRP => "Effect unknown", + A92!A => "Effect unknown", T58!T => "Effect unknown", + F28!F => "Effect unknown", T93!T => "Effect unknown", + R30!R => "Effect unknown", L31!VL => "Effect unknown" ) - genotype: 6E reference: HCV6-EUHK2-NS5a region: NS5a diff --git a/micall/tests/test_asi_algorithm.py b/micall/tests/test_asi_algorithm.py index 9202af675..04424d619 100644 --- a/micall/tests/test_asi_algorithm.py +++ b/micall/tests/test_asi_algorithm.py @@ -130,6 +130,16 @@ def test_mutations(self): self.assertEqual(expected_mutations, result.mutations) + def test_mutations_have_wildtype(self): + aa_seq = [[amino] for amino in self.asi.stds['RT']] + self.assertEqual(['M'], aa_seq[40]) + aa_seq[40] = ['L', 'R'] + expected_mutations = {'NRTI': ['M41L'], 'NNRTI': []} + + result = self.asi.interpret(aa_seq, 'RT') + + self.assertEqual(expected_mutations, result.mutations) + def test_drug_classes(self): aa_seq = [[]] * 440 compared_attrs = ('code', 'name', 'drug_class')