Create selections matching motifs, using python regular expression syntax.
This is very similar to the FindSeq script.
The Code
<source lang="python">
- Create named selections using regular expressions for the protein sequence
import pymol
import re
cmd = pymol.cmd
aa = { 'ASP' : 'D' , 'GLU' : 'E' , 'GLN' : 'Q' , 'ASN' : 'N' , 'SER' : 'S' ,
'THR' : 'T' , 'CYS' : 'C' , 'HIS' : 'H' , 'ARG' : 'R' , 'LYS' : 'K' ,
'MET' : 'M' , 'ALA' : 'A' , 'ILE' : 'I' , 'LEU' : 'L' , 'VAL' : 'V' ,
'GLY' : 'G' , 'PRO' : 'P' , 'TRP' : 'W' , 'PHE' : 'F' , 'TYR' : 'Y' ,
'SCY' : 'U' , 'ASX' : 'B' , 'GLX' : 'Z' , 'XXX' : 'X'}
- made this before the sequence view option, probably another way to do it now
def seqoneint(model):
pymol.stored.seq = []
cmd.iterate("%s and name ca"%model,"stored.seq.append(resn)")
seq = ""
for x in pymol.stored.seq:
if aa.has_key(x):
res = aa[x]
seq = seq+res
else:
seq = seq + '-'
return seq
def grepsel(selection="(all)",stretch="",pr ..→