//$MENU window=comparison;popup=Sequence;Insertafter=find sequence pattern;name=Map protein alignment on DNA sequences string experlist,expername,transexpername,aminoseq,key,st,st1,st2,align; integer i,x,tl,frame; DIALOG dlg; if not(CmpIsPresent) then CmpAttach; if not(CmpIsPresent) then { Message("There is currently no comparison available"); stop; } for i=1 to DbGetExperCount do if DbGetExperClass(i)="SEQ" then if find(DbGetExperName(i),"_TRANSL",1)=0 then if DbGetExperNr(DbGetExperName(i)+"_TRANSL")>0 then experlist=experlist+DbGetExperName(i)+" "; expername=experlist;expername=splitstring(expername," "); DlgAddText(dlg,"Sequence to back translate",15,15,200,15); DlgAddList(dlg,experlist,expername,15,40,140,120,"LIST"); x=DlgShow(dlg,"Back translation",280,195); if x=0 then stop; transexpername=expername+"_TRANSL"; setbusy("Back translation"); for tl=1 to CmpGetEntryCount do { if tl/10=floor(tl/10) then setbusy("Back translation - "+str(tl,0,0)); key=CmpGetEntryKey(tl); st=DbGetField(key,"TranslationFrames"); frame=1; while st<>"" do { st1=splitstring(st,":="); st2=splitstring(st,"|"); if st1=expername then frame=val(st2); } aminoseq=CmpSeqGet(transexpername,tl); align=""; for i=1 to frame-1 do align=align+"X"; for i=1 to length(aminoseq) do { if substring(aminoseq,i,i)<>" " then align=align+"XXX"; else align=align+" "; } CmpSeqSetAlign(expername,tl,align); } setbusy("");