Example #1
0
 def _from_json(cls, json_dict):
     mod_type = json_dict.get('mod_type')
     if not mod_type:
         logger.error('ModCondition missing mod_type.')
         return None
     if mod_type not in modtype_to_modclass.keys():
         logger.warning('Unknown modification type: %s' % mod_type)
     residue = json_dict.get('residue')
     position = json_dict.get('position')
     is_modified = json_dict.get('is_modified')
     if is_modified is None:
         logger.warning('ModCondition missing is_modified, defaulting '
                        'to True')
         is_modified = True
     mc = ModCondition(mod_type, residue, position, is_modified)
     return mc
Example #2
0
 def _from_json(cls, json_dict):
     mod_type = json_dict.get('mod_type')
     if not mod_type:
         logger.error('ModCondition missing mod_type.')
         return None
     if mod_type not in modtype_to_modclass.keys():
         logger.warning('Unknown modification type: %s' % mod_type)
     residue = json_dict.get('residue')
     position = json_dict.get('position')
     is_modified = json_dict.get('is_modified')
     if is_modified is None:
         logger.warning('ModCondition missing is_modified, defaulting '
                        'to True')
         is_modified = True
     mc = ModCondition(mod_type, residue, position, is_modified)
     assert(unicode_strs(mc))
     return mc