-- F.Damberger 14.Dec.2004 -- Short description -- renames spins with name "A" to have new name "B" -- e.g. after creating a new project from a BMRB file, you can rename the amide protons -- which have the label "H" in the BMRB format to have the label "HN" which is the -- standard label for CARA template Start1.1.cara -- WARNING: -- The script does not check whether another spin exists with the same label as the NewLabel -- define temporary table for script t = {} -- Get Input from user --1. Get ProjectName local ProjectNames = {} i = 0 for a,b in pairs(cara:getProjects()) do i = i + 1 ProjectNames[ i ] = b:getName() end t.ProjectName=dlg.getSymbol("Select Project","", unpack( ProjectNames ) ) t.P = cara:getProject( t.ProjectName ) --2. Get OldLabel t.OldLabel = dlg.getText("Enter Old Spin Label", "Enter Old Label","H") --3. Get NewLabel t.NewLabel = dlg.getText("Enter New Spin Label", "Enter New Label","HN") -- Start to change labels t.SpinsTable = t.P:getSpins() local SpinsChanged = 0 local SpinsChecked = 0 for id,spin in pairs (t.SpinsTable) do SpinsChecked = SpinsChecked + 1 -- print("label is "..spin:getLabel() ) if spin:getLabel() == t.OldLabel then t.P:setLabel(spin,t.NewLabel) SpinsChanged = SpinsChanged + 1 end end print("checked "..SpinsChecked.." spins") print("changed "..SpinsChanged.." spins") print("RenameSpins is done") t = nil