def testPop(self): cmd.fragment("ala") cmd.select("src", "ala") # iterate across the 10 atoms in ala cnt = 0 while cmd.pop("tmp", "src"): cnt += 1 self.assertEquals(cnt, 10)
def testPop(self): cmd.fragment("ala") cmd.select("src", "ala") # iterate across the 10 atoms in ala cnt = 0 while cmd.pop("tmp","src"): cnt+=1 self.assertEquals(cnt,10)
def seq(state, selection="name ca or resn hoh or resn lig"): print "Generating seqs." cmd.select("prot", selection) while cmd.pop("_tmp", "prot"): cmd.iterate("_tmp", "stored.x=(resn,resv)") #print stored.x[0], stored.x[1] # Special case 1: Waters. if stored.x[0] == 'HOH': filename = 'seq-x%s-%s.pdb' % (stored.x[1], state) # Special case 2: Substrate. elif stored.x[0] == 'LIG': filename = 'seq-x%s-%s.pdb' % (stored.x[1], state) # Other: protein back-bone. else: filename = 'seq-%s%d-%s.pdb' \ % (one_letter[stored.x[0]].lower(), stored.x[1], state) cmd.save(filename, "byres _tmp") cmd.delete('_tmp prot')
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)