Hi Jan,

One of the little extensions I have written for coot (which you can download 
from: https://www.dropbox.com/s/0b4bebwxw0p9x0e/oli_custom.py?dl=0 or at 
cootscripts.tiddlyspace.com), might be handy for this (in the script it is the 
function mutate_by_resnum).

It does not align the sequence for you, but if you have a pre-aligned sequence 
(that is, the numbering matches your structure - paste in the whole seq 
including the starting Met (which should equate to residue 1 in your 
structure)) you can paste your sequence into the little text box that pops up, 
and it will mutate every non-matching residue in the active chain (the one you 
are centered on). It will automatically strip any non-sequence residues from 
the input, and the sequence is not case-sensitive. The script for this function 
alone is appended to this email.

Hope this helps,
Oliver.

Script follows:

def mutate_by_resnum():
  def enter_seq(seq):
    seq=str(seq).upper()
    seq.replace(" ", "")
    seq_dic={}
    len_seq=len(seq)
    n=0
    nmax=len_seq+1
    aa_dic={'A':'ALA','R':'ARG','N':'ASN','D':'ASP','C':'CYS','E':'GLU',
    'Q':'GLN','G':'GLY','H':'HIS','I':'ILE','L':'LEU','K':'LYS','M':'MET',
    'F':'PHE','P':'PRO','S':'SER','T':'THR','W':'TRP','Y':'TYR','V':'VAL'}
    clean_seq=''
    while (n<len_seq):
      if ((not seq.isalpha()) and (seq[n].isalpha())):
        clean_seq=clean_seq+seq[n]
      n=n+1
    seq=clean_seq
    len_seq=len(seq)
    n=0
    while (n<len_seq):
      value=aa_dic[seq[n]]
      seq_dic[n+1]=value
      n=n+1
    mol_id=active_residue()[0]
    ch_id=active_residue()[1]
    sn=0
    last_sn=chain_n_residues(ch_id,mol_id)-1
    turn_off_backup(mol_id)
    while (sn<=last_sn):
      res=resname_from_serial_number(mol_id,ch_id,sn)
      seqnum=seqnum_from_serial_number(mol_id,ch_id,sn)
      ins_id=str(insertion_code_from_serial_number(mol_id,ch_id,sn))
      if ((res in aa_dic.values()) or (res=="MSE")) and (res!=seq_dic[seqnum]):
        mutate(mol_id,ch_id,seqnum,ins_id,seq_dic[seqnum])
        delete_residue_sidechain(mol_id,ch_id,seqnum,ins_id,0)
      sn=sn+1
    turn_on_backup(mol_id)
  generic_single_entry("Enter raw amino acid sequence (must be complete!)",
  "MLKYG","Mutate active chain to match sequence using PDB numbering", 
enter_seq)
add_simple_coot_menu_menuitem(menu,
"Mutate active chain to template sequence (numbering must match sequence!)", 
lambda func: mutate_by_resnum())

Reply via email to