Icon representing a recipe

Recipe: V2 print mutable sequence

created by pauldunn

Profile


Name
V2 print mutable sequence
ID
35844
Shared with
Public
Parent
None
Children
None
Created on
November 28, 2011 at 22:51 PM UTC
Updated on
November 28, 2011 at 22:51 PM UTC
Description

prints mutable segments numbers and amino acids

Best for


Code


-- -- prints mutable segments numbers and amino acids function print_mutable_sequence() local out,seq,seg,segs,lastseg,i segs={} seq="" for seg=1,structure.GetCount() do if structure.IsMutable(seg) then if #segs==0 then seq=structure.GetAminoAcid(seg) segs[1]=seg segs[2]=seg else if seg~=segs[#segs]+1 then seq=seq..","..structure.GetAminoAcid(seg) segs[#segs]=lastseg segs[#segs+1]=seg segs[#segs+1]=seg else seq=seq..structure.GetAminoAcid(seg) segs[#segs]=seg end end lastseg=seg end end for i=1,#segs,2 do if i==1 then out=segs[i].."-"..segs[i+1] else out=out..","..segs[i].."-"..segs[i+1] end end print(out) print(seq) end print_mutable_sequence()

Comments