Profile
- Name
- Band All Contacts Adaptive v2.2
- ID
- 101238
- Shared with
- Public
- Parent
- Band All Contacts Adaptive v2.1
- Children
- Created on
- July 17, 2015 at 03:28 AM UTC
- Updated on
- July 17, 2015 at 03:28 AM UTC
- Description
Places a band wherever there is a green dot on the contact map with weight greater than a chosen minimum; min weight of 0 bands all contacts. Dialog lets you set band length and strength based on whether the contact is currently made or not. Option to band beta carbons: contact distance in foldit is between beta carbons (the first joint in the sidechain); this can help rotate the segments to make more contacts.
Best for
Code
-- Places a band wherever there is a green dot on the contact map.
-- Dialog allows you to set different minimum contact weight, band length and strength for
-- unmade vs. made contacts.
-- Use length multiplier greater than 1.0 for "push" bands.
-- v2.1 Added option to band to beta carbons instead of the default central carbons
-- Beta carbons are the first joint in the sidechains and can help twist the
-- backbone where needed to make more contacts.
-- v2.2 Added sliders to choose minimum contact weights to be banded.
-- Default minimum weight of 0 means all predicted contacts will be banded.
------------------------
--defaults for dialog box
MinWeight = 0
MaxWeight = 4
MadeWeight = 0
UnmadeWeight = 0
MadeMult = .9
UnmadeMult = .75
MinMult = .1
MaxMult = 3
MadeStrength = 0.5
UnmadeStrength = 1.5
MinStrength = .1
MaxStrength = 5
MadeBeta = false
UnmadeBeta = false
------------------------
BETA_CARBON = 5
TERMINAL_BETA = 6
CENTER_CARBON = 2 --this is the default atom for bands to attach to
GLYCINE = "g"
SCRIPT = "Band All Contacts Adaptive"
VERSION = "2.2"
bcount = 0
EndSegment = structure.GetCount()
function GetParams()
dlg = dialog.CreateDialog(SCRIPT.." "..VERSION)
dlg.l1a = dialog.AddLabel("-------- Bands on Made Contacts --------")
dlg.l1b = dialog.AddLabel("Band if contact weight greater than")
dlg.MadeWeight = dialog.AddSlider("Min Weight:",MadeWeight,MinWeight,MaxWeight,1)
dlg.l1c = dialog.AddLabel("Multiply current distance by")
dlg.MadeMult = dialog.AddSlider("Multiplier:",MadeMult,MinMult,MaxMult,2)
dlg.MadeStrength = dialog.AddSlider("Strength:",MadeStrength,MinStrength,MaxStrength,1)
dlg.MadeBeta = dialog.AddCheckbox("Band beta carbons instead of center",MadeBeta)
dlg.l2a = dialog.AddLabel("-------- Bands on Unmade Contacts --------")
dlg.l2b = dialog.AddLabel("Band if contact weight greater than")
dlg.UnmadeWeight = dialog.AddSlider("Min Weight:",UnmadeWeight,MinWeight,MaxWeight,1)
dlg.l2c = dialog.AddLabel("Multiply current distance by")
dlg.UnmadeMult = dialog.AddSlider("Multiplier:",UnmadeMult,MinMult,MaxMult,2)
dlg.UnmadeStrength = dialog.AddSlider("Strength:",UnmadeStrength,MinStrength,MaxStrength,1)
dlg.UnmadeBeta = dialog.AddCheckbox("Band beta carbons instead of center",UnmadeBeta)
dlg.ok = dialog.AddButton("OK", 1)
dlg.cancel = dialog.AddButton("Cancel", 0)
if dialog.Show(dlg) > 0 then
MadeWeight = dlg.MadeWeight.value
MadeMult = dlg.MadeMult.value
MadeStrength = dlg.MadeStrength.value
MadeBeta = dlg.MadeBeta.value
UnmadeWeight = dlg.UnmadeWeight.value
UnmadeMult = dlg.UnmadeMult.value
UnmadeStrength = dlg.UnmadeStrength.value
UnmadeBeta = dlg.UnmadeBeta.value
print("Made Contacts:")
print(" band if weight > "..MadeWeight)
print(" current distance * "..MadeMult)
print(" strength "..MadeStrength)
if MadeBeta then
print(" band to beta carbons")
else print(" normal band position")
end
print("Unmade Contacts:")
print(" band if weight > "..UnmadeWeight)
print(" current distance * "..UnmadeMult)
print(" strength "..UnmadeStrength)
if UnmadeBeta then
print(" band to beta carbons")
else print(" normal band position")
end
return true
else
print("Dialog cancelled")
return false
end
end
function MakeBands()
for i = 1, EndSegment-2 do
for j = i+2, EndSegment do
Weight = contactmap.GetHeat(i, j)
ContactMade = contactmap.IsContact(i,j)
if (ContactMade and Weight>MadeWeight) or (ContactMade==false and Weight>UnmadeWeight) then
if ContactMade then
UseBeta = MadeBeta
else
UseBeta = UnmadeBeta
end
if UseBeta==false or structure.GetAminoAcid(i)==GLYCINE then
Atom1 = CENTER_CARBON
elseif i==EndSegment then
Atom1 = TERMINAL_BETA
else
Atom1 = BETA_CARBON
end
if UseBeta==false or structure.GetAminoAcid(j)==GLYCINE then
Atom2 = CENTER_CARBON
elseif j==EndSegment then
Atom2 = TERMINAL_BETA
else
Atom2 = BETA_CARBON
end
b = band.AddBetweenSegments(i,j,Atom1,Atom2)
bcount = bcount + 1
if ContactMade then
band.SetGoalLength(b, MadeMult * band.GetLength(b))
band.SetStrength(b, MadeStrength)
else
band.SetGoalLength(b, UnmadeMult * band.GetLength(b))
band.SetStrength(b, UnmadeStrength)
end
end
end
end
end
-------------------
function Cleanup()
print(bcount.." contact bands placed")
print(band.GetCount().." total bands")
end
function Main()
if GetParams() then
MakeBands()
end
Cleanup()
end
xpcall(Main, Cleanup)