Profile
- Name
- Tvdl Show worst subscoring parts 1.1.0
- ID
- 45109
- Shared with
- Public
- Parent
- None
- Children
- Created on
- July 17, 2013 at 19:08 PM UTC
- Updated on
- July 17, 2013 at 19:08 PM UTC
- Description
You can set the subscores to select, it prints the result and selects all the worst parts. How much is printed and selected depends on the percentage you set. Updated for Density.
Best for
Code
segCnt=structure.GetCount()
scrPart={}
scrParts={'density','disulfides','backbone','sidechain','clashing','hiding','bonding','reference','pairwise'}
pct=15
version="1.1.0"
function AskSelScores()
local ask = dialog.CreateDialog("Set worst scoring selection "..version)
ask.l1=dialog.AddLabel("Specify which worst subscoretotal(s) to count")
for i=1,#scrParts do
ask[scrParts[i]]=dialog.AddCheckbox(scrParts[i],false)
end
ask.perc=dialog.AddSlider("Percent:",pct,1,100,0)
ask.OK = dialog.AddButton("OK",1) ask.Cancel = dialog.AddButton("Cancel",0)
scrPart={}
if dialog.Show(ask) > 0 then
for i=1,#scrParts do
if ask[scrParts[i]].value then scrPart[#scrPart+1]=scrParts[i] end
end
pct=ask.perc.value
Compute()
Sort()
Showresult()
end
end
segscores={}
function Compute()
for i=1,segCnt do
local sub=0
for j=1,#scrPart do
sub=sub+current.GetSegmentEnergySubscore(i,scrPart[j])
end
segscores[i]={i,sub}
end
end
function Sort()
table.sort(segscores,function(a,b) return a[2]<b[2] end)
end
function Showresult()
selection.DeselectAll()
for i=1,pct*segCnt/100 do
selection.Select(segscores[i][1])
print("Seg "..segscores[i][1].." Score "..segscores[i][2])
end
end
AskSelScores()