Class: ViralSeq::DRMs
- Inherits:
-
Object
- Object
- ViralSeq::DRMs
- Defined in:
- lib/viral_seq/sdrm.rb
Class Method Summary collapse
-
.sdrm_hash(options) ⇒ Hash
function to retrieve sdrm positions as a hash.
-
.sdrm_json(options) ⇒ Array
function to export SDRM positions as json object.
Class Method Details
.sdrm_hash(options) ⇒ Hash
function to retrieve sdrm positions as a hash
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/viral_seq/sdrm.rb', line 8 def sdrm_hash() sdrm = {} case when :hcv_ns5a sdrm[28] = ['M',['T']] sdrm[30] = ['L',['H','K','R','Q','A','S','D']] sdrm[31] = ['L',['M','V','F']] sdrm[32] = ['P',['L']] sdrm[44] = ['K',['R']] sdrm[58] = ['H',['D','P','S']] sdrm[64] = ['T',['A','S']] sdrm[77] = ['P',['A','S']] sdrm[78] = ['R',['K']] sdrm[79] = ['T',['A']] sdrm[83] = ['T',['M']] sdrm[85] = ['S',['N','H','Y']] sdrm[92] = ['A',['P','T','K','E']] sdrm[93] = ['Y',['C','F','H','N']] sdrm[107] = ['K',['T','S']] sdrm[121] = ['I',['V']] sdrm[135] = ['T',['A']] when :nrti sdrm[41] = ['M',['L']] sdrm[65] = ['K',['R']] sdrm[67] = ['D',['N','G','E']] sdrm[69] = ['T',['D']] sdrm[70] = ['K',['R','E']] sdrm[74] = ['L',['V','I']] sdrm[75] = ['V',['M','T','A','S']] sdrm[77] = ['F',['L']] sdrm[115] = ['Y',['F']] sdrm[116] = ['F',['Y']] sdrm[151] = ['Q',['M']] sdrm[184] = ['M',['V','I']] sdrm[210] = ['L',['W']] sdrm[215] = ["T",["Y","F","I","C","D","V","E"]] sdrm[219] = ["K",["Q","E","N","R"]] when :nnrti sdrm[100] = ['L',['I']] sdrm[101] = ['K',['E','P']] sdrm[103] = ['K',['N','S']] sdrm[106] = ['V',['M','A']] sdrm[179] = ['V',['F','D']] sdrm[181] = ['Y',['C','I','V']] sdrm[188] = ['Y',['L','H','C']] sdrm[190] = ['G',['A','S','E']] sdrm[225] = ['P',['H']] sdrm[230] = ['M',['L']] when :hiv_pr sdrm[23] = ['L',['I']] sdrm[24] = ['L',['I']] sdrm[30] = ['D',['N']] sdrm[32] = ['V',['I']] sdrm[46] = ['M',['I','L']] sdrm[47] = ['I',['V','A']] sdrm[48] = ['G',['V','M']] sdrm[50] = ['I',['V','L']] sdrm[53] = ['F',['L']] sdrm[54] = ['I',['V','L','M','T','A','S']] sdrm[73] = ['G',['S','T','C','A']] sdrm[76] = ['L',['V']] sdrm[82] = ['V',['A','T','S','F','L','C','M']] sdrm[83] = ['N',['D']] sdrm[84] = ['I',['V','A','C']] sdrm[88] = ['N',['D','S']] sdrm[90] = ['L',['M']] when :hiv_in sdrm[66] = ['T',['A','I','K']] sdrm[74] = ['L',['M']] sdrm[92] = ['E',['Q']] sdrm[95] = ['Q',['K']] sdrm[97] = ['T',['A']] sdrm[121] = ['F',['Y']] sdrm[140] = ['G',['A','S','C']] sdrm[143] = ["Y",["C","H","R"]] sdrm[147] = ['S',['G']] sdrm[148] = ['Q',['H','K','R']] sdrm[155] = ['N',['S','H']] else raise "Input option `#{}` for ViralSeq::Sequence.sdrm not supported" end return sdrm end |
.sdrm_json(options) ⇒ Array
function to export SDRM positions as json object
95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/viral_seq/sdrm.rb', line 95 def sdrm_json() sdrm = ViralSeq::DRMs.sdrm_hash() json_array = [] sdrm.each do |pos, muts| mutation = {} mutation[:position] = pos mutation[:wildtypeCodon] = muts[0] mutation[:mutationCodons] = muts[1] json_array << mutation end return json_array end |