def get_dash_dash_state_from_string(self, state, state_str, state_id=None, loc_not_modifier=None): """ Complete Association or Intraprotein state from str. Returns State object. """ comp = state_str.split('--') compA_name = comp[0].split('_')[0] compA_domain = self.df.get_association_domain_from_str(state_str, 'A') compB_name = comp[1].split('_')[0] compB_domain = self.df.get_association_domain_from_str(state_str, 'B') if compB_name.startswith('['): state.type = 'Intraprotein' # A_[a]--[b] comp_object = Component(compA_name, compA_domain) comp_object.second_domain = re.sub('[\[\]]', '', compB_name) state.components = [comp_object] else: state.type = 'Association' # A--B if state_id: idA = state_id.split('--')[0] idB = state_id.split('--')[1] else: idA = None idB = None compA_object = Component(compA_name, compA_domain, idA) compB_object = Component(compB_name, compB_domain, idB) state.components = [compA_object, compB_object] if compA_name == compB_name: state.homodimer = True return state