Icon representing a recipe

Recipe: Band All Contacts Adaptive v2.2m

created by Madde

Profile


Name
Band All Contacts Adaptive v2.2m
ID
101303
Shared with
Public
Parent
Band All Contacts Adaptive v2.2
Children
None
Created on
August 11, 2015 at 18:00 PM UTC
Updated on
August 11, 2015 at 18:00 PM 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. ---------------------------------------------- Original script by Susume, v2.2m by Madde
Added option to set band strengths according to contact weights. Added option to band only hydrophobics to beta carbons.

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. -- Original script by Susume, v2.2m by Madde -- v2.2m Added option to set band strengths according to contact weights. -- (if checked then Strength slider will function as multiplier) -- Added option to band only hydrophobics to beta carbons. ------------------------ --defaults for dialog box MinWeight = 0 MaxWeight = 4 MadeWeight = 0 UnmadeWeight = 0 MadeMult = .9 UnmadeMult = .75 MinMult = .1 MaxMult = 3 MadeStrength = 1.0 UnmadeStrength = 1.0 MinStrength = .1 MaxStrength = 5 MadeBeta = false UnmadeBeta = false MadeWrength = false UnmadeWrength = false MadePhobicsBeta = false UnmadePhobicsBeta = false ------------------------ BETA_CARBON = 5 TERMINAL_BETA = 6 CENTER_CARBON = 2 --this is the default atom for bands to attach to GLYCINE = "g" AA = "z" SCRIPT = "Band All Contacts Adaptive" VERSION = "2.2m" 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.MadeWrength = dialog.AddCheckbox("Set strengths according to weights",MadeWrength) dlg.l1d = dialog.AddLabel("(if checked then Strength slider will act as multiplier)") dlg.MadeBeta = dialog.AddCheckbox("Band beta carbons instead of center (all AAs)",MadeBeta) dlg.MadePhobicsBeta = dialog.AddCheckbox("Band beta carbons instead of center (phobics only)",MadePhobicsBeta) 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.UnmadeWrength = dialog.AddCheckbox("Set strengths according to weights",UnmadeWrength) dlg.l2d = dialog.AddLabel("(if checked then Strength slider will act as multiplier)") dlg.UnmadeBeta = dialog.AddCheckbox("Band beta carbons instead of center (all AAs)",UnmadeBeta) dlg.UnmadePhobicsBeta = dialog.AddCheckbox("Band beta carbons instead of center (phobics only)",UnmadePhobicsBeta) 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 MadeWrength = dlg.MadeWrength.value MadeBeta = dlg.MadeBeta.value MadePhobicsBeta = dlg.MadePhobicsBeta.value UnmadeWeight = dlg.UnmadeWeight.value UnmadeMult = dlg.UnmadeMult.value UnmadeStrength = dlg.UnmadeStrength.value UnmadeWrength = dlg.UnmadeWrength.value UnmadeBeta = dlg.UnmadeBeta.value UnmadePhobicsBeta = dlg.UnmadePhobicsBeta.value print("Made Contacts:") print(" band if weight > "..MadeWeight) print(" current distance * "..MadeMult) if MadeWrength then print(" strength according to weight * "..MadeStrength) else print(" strength "..MadeStrength) end if MadePhobicsBeta then print(" band to beta carbons (hydrophobics only)") elseif 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) if UnmadeWrength then print(" strength according to weight * "..UnmadeStrength) else print(" strength "..UnmadeStrength) end if UnmadePhobicsBeta then print(" band to beta carbons (hydrophobics only)") elseif 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 UsePhobicsBeta = MadePhobicsBeta else UseBeta = UnmadeBeta UsePhobicsBeta = UnmadePhobicsBeta end if UsePhobicsBeta then AA = structure.GetAminoAcid(i) if i==EndSegment then Atom1 = TERMINAL_BETA elseif AA=="a" or AA=="c" or AA=="f" or AA=="i" or AA=="l" or AA=="m" or AA=="p" or AA=="v" or AA=="w" or AA=="y" then Atom1 = BETA_CARBON else Atom1 = CENTER_CARBON end else if UseBeta==false or structure.GetAminoAcid(i)==GLYCINE then Atom1 = CENTER_CARBON elseif i==EndSegment then Atom1 = TERMINAL_BETA else Atom1 = BETA_CARBON end end if UsePhobicsBeta then AA = structure.GetAminoAcid(j) if j==EndSegment then Atom2 = TERMINAL_BETA elseif AA=="a" or AA=="c" or AA=="f" or AA=="i" or AA=="l" or AA=="m" or AA=="p" or AA=="v" or AA=="w" or AA=="y" then Atom2 = BETA_CARBON else Atom2 = CENTER_CARBON end else if UseBeta==false or structure.GetAminoAcid(j)==GLYCINE then Atom2 = CENTER_CARBON elseif j==EndSegment then Atom2 = TERMINAL_BETA else Atom2 = BETA_CARBON end end b = band.AddBetweenSegments(i,j,Atom1,Atom2) bcount = bcount + 1 if ContactMade then band.SetGoalLength(b, MadeMult * band.GetLength(b)) if MadeWrength then band.SetStrength(b, MadeStrength * Weight) else band.SetStrength(b, MadeStrength) end else band.SetGoalLength(b, UnmadeMult * band.GetLength(b)) if UnmadeWrength then band.SetStrength(b, UnmadeStrength * Weight) else band.SetStrength(b, UnmadeStrength) end 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)

Comments


Madde Lv 1

If you check "Set strengths according to weighs" then the "Strength" slider will function as a multiplier. So when it's on its default 1.0 a band for a contact with weight 0.522 will be set to strength 0.52, on 0.5 the strength would be 0.26, on 0.1 it'd be 0.05 etc.