def test_attach(self): cmd.pseudoatom() cmd.edit('first all') cmd.attach('C', 1, 1) self.assertEqual(2, cmd.count_atoms()) cmd.attach('C', 1, 1) self.assertEqual(3, cmd.count_atoms()) self.assertEqual(['C01', 'C02', 'PS1'], sorted(get_atom_names()))
def missing_c_termini(selection="(all)", quiet=0, _self=cmd): cmd = _self # assumes that hydogens are not present! sele_list = [] ch = Champ() model = cmd.get_model(selection) model_pat = ch.insert_model(model) assn_pat = ch.insert_pattern_string("[N+0+1]C[C;D2]<0>(=O)") ch.pattern_clear_tags(model_pat) if ch.match_1v1_n(assn_pat, model_pat, 10000, 2) > 0: result = ch.pattern_get_ext_indices_with_tags(model_pat) for atom_tag in result[0]: # just iterate over atom tags if len(atom_tag[1]) == 1: # one and only one match if atom_tag[1][0] == 0: sele_list.append(atom_tag[0]) cmd.select_list(tmp_sele1, selection, sele_list, mode='index') while cmd.pop(tmp_sele2, tmp_sele1) > 0: # complete the carboxy terminus cmd.edit(tmp_sele2) cmd.attach("O", 1, 1, "OXT", quiet=1) cmd.unpick() cmd.delete(tmp_sele1)
def missing_c_termini(selection="(all)",quiet=0,_self=cmd): cmd=_self # assumes that hydogens are not present! sele_list = [] ch=Champ() model = cmd.get_model(selection) model_pat = ch.insert_model(model) assn_pat = ch.insert_pattern_string("[N+0+1]C[C;D2]<0>(=O)") ch.pattern_clear_tags(model_pat) if ch.match_1v1_n(assn_pat,model_pat,10000,2)>0: result = ch.pattern_get_ext_indices_with_tags(model_pat) for atom_tag in result[0]: # just iterate over atom tags if len(atom_tag[1])==1: # one and only one match if atom_tag[1][0]==0: sele_list.append(atom_tag[0]) cmd.select_list(tmp_sele1,selection,sele_list, mode='index') while cmd.pop(tmp_sele2,tmp_sele1)>0: # complete the carboxy terminus cmd.edit(tmp_sele2) cmd.attach("O",1,1,"OXT",quiet=1) cmd.unpick() cmd.delete(tmp_sele1)
def test_attach(self): cmd.pseudoatom() cmd.edit('first all') cmd.attach('C', 1, 1) self.assertEqual(2, cmd.count_atoms())