Icon representing a recipe

Recipe: Band All Contacts Adaptive v2.3

created by LociOiling

Profile


Name
Band All Contacts Adaptive v2.3
ID
102063
Shared with
Public
Parent
Band All Contacts Adaptive v2.2
Children
Created on
May 18, 2016 at 20:57 PM UTC
Updated on
May 18, 2016 at 20:57 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. V2.3 adds options to set band strength based on contact weight and only band beta carbons of hydrophobes merged from Madde's v2.2m. Options to not band structure to itself and not band parallel to structure adapted from Spvincent's Helix Rebuild and Local Quake.

Best for


Code


--[[ Band All Contacts Adaptive original recipe "Band All Contacts Adaptive Strength", by Susume, 2014/07/28 Places a band wherever there is a green dot on the contact map. Dialog allows you to set different length and strength for unmade vs. made contacts. Use length multiplier greater than 1.0 for "push" bands. revision history ---------------- Band All Contacts v0.1 - 2014/06/13 - Susume Band All Contacts v0.2 - 2014/06/13 - Susume Band All Contacts 2 Strengths - 2014/07/18 - Susume Band All Contacts Adaptive Strength - 2014/07/28 - Susume Band All Contacts Adaptive v2.0 - 2014/08/24 - Susume v2.1 - 2014/09/21 - Susume + 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 - 2015/07/16 - Susume + Added sliders to choose minimum contact weights to be banded. + Default minimum weight of 0 means all predicted contacts will be banded. v2.2m - 2015/08/07 - Madde + Added option to set band strengths according to contact weights + Added option to band hydrophobics only to beta carbons v2.3 2016/05/17 - LociOiling + Merged v2.2m + Added prune options from Band Pruner v0.2 - 2015/7/19 - Susume + Aerated code, restructured a bit + Splice in some Contact Cement stuff (Loci, Bruno Kestemont) + Added structure and parallel band logic based on Helix Rebuild and Local Quake by spvincent + Threw in the print to a textbox thing from Print Protein 2.0 ]]-- Recipe = "Band All Contacts Adaptive" Version = "2.3" ReVersion = Recipe .. " " .. Version --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 MadeWrength = false UnmadeWrength = false MadePhobicsBeta = false UnmadePhobicsBeta = false -- Band Pruner LongerThan = true ShorterThan = false MaxLength = 0 MinLength = 0 -- -- exclusions -- noBandSelf = false -- don't band a structure to itself DISALLOW_LL = false -- disallow bands parallel to helix MAXANGLE = 30 --maximum deviation from perpendicular -- -- constants -- BETA_CARBON = 5 TERMINAL_BETA = 6 CENTER_CARBON = 2 --this is the default atom for bands to attach to GLYCINE = "g" -- -- custom list of hydrophobics -- phobes = { a = { "alanine", }, c = { "cysteine", }, f = { "phenylalanine", }, i = { "isoleucine", }, l = { "leucine", }, m = { "methionine", }, p = { "proline", }, v = { "valine", }, w = { "tryptophan", }, y = { "tyrosine", }, } -- -- miscellaneous loose screws -- bweight = 0 -- number of contacts skipped due to weight cutoff bshort = 0 -- number of short contacts skipped blong = 0 -- number of long contacts skipped bunk = 0 -- number of bands skipped due to failed band.AddBetweenSegments bsame = 0 -- number of bands skipped due to "don't band structure to self" bpara = 0 -- number of bands skipped due to "disallow parallel to structure" bcount = 0 -- number of bands made VERBOSE = false REPORT = false segStart = 1 segEnd = structure.GetCount() -- -- globals from Contact Cement -- tContacts = 0 tHeat = 0 minHeat = 0.5 maxHeat = 0.9 meanHeat = 0.7 mediHeat = 0.7 madeTotal = 0 madePct = 0 unmadeTotal = 0 unmadePct = 0 minMadeDist = 99999 maxMadeDist = 0 minUnmadeDist = 99999 maxUnmadeDist = 0 tMadeDist = 0 tUnmadeDist = 0 variableHeat = false singleEnd = false -- -- structure table indexes -- STRUTYPE = 1 -- structList [ 1 ] = type STRUSEG1 = 2 -- structList [ 2 ] = start segment STRUSEG2 = 3 -- structList [ 3 ] = end segment STRUSLCT = 4 -- structList [ 4 ] = structure selected STRUCONT = 5 -- structList [ 5 ] = # of contacts -- -- contact map table indexes -- MAPSEG1 = 1 -- contact [ 1 ] = seg1 MAPSEG2 = 2 -- contact [ 2 ] = seg2 MAPHEAT = 3 -- contact [ 3 ] = heat MAPSS1 = 4 -- contact [ 4 ] = ss seg1 MAPSS2 = 5 -- contact [ 5 ] = ss seg2 MAPDIST = 6 -- contact [ 6 ] = dist MAPCONT = 7 -- contact [ 7 ] = in contact MAPBAND = 8 -- contact [ 8 ] = contact banded MAPBLEN = 9 -- contact [ 9 ] = band goal length MAPBSTR = 10 -- contact [ 10 ] = band strength MAPATM1 = 11 -- contact [ 11 ] = band atom segment 1 MAPATM2 = 12 -- contact [ 12 ] = band atom segment 2 -- -- report -- delim = "\t" -- tab delimiter -- -- begin functions lifted from Contact Cement -- function r3 ( i ) return i - i % 0.001 end function GetStructs () local within_struct = false local structList = {} local structStart = 0 local structLast = 0 local structType = "?" -- not a valid structure type for ii = 1, segEnd do local currType = structure.GetSecondaryStructure ( ii ) if ( currType ~= structType ) then if ( within_struct == true ) then -- end of a struct within_struct = false structList [ #structList + 1 ] = { structType, structStart, structLast, false, 0 } end end if ( within_struct == false ) then -- start of a new struct within_struct = true structStart = ii structType = currType end structLast = ii end if ( within_struct == true ) then structList [ #structList + 1 ] = { structType, structStart, structLast, false, 0 } end return structList end function findContactStruct ( structList, segment ) for ii = 1, #structList do if segment >= structList [ ii ] [ STRUSEG1 ] and segment <= structList [ ii ] [ STRUSEG2 ] then return ii end end return nil end function SortByIndex ( tab, indx ) local ii local jj for ii = 1, #tab - 1 do for jj = ii + 1, #tab do local h1 = tab [ ii ] [ indx ] local h2 = tab [ jj ] [ indx ] if h2 > h1 then tab [ ii ], tab [ jj ] = tab [ jj ], tab [ ii ] end end end return tab end function GetOnlyContacts() tHeat = 0 local contacts = {} for ii = segStart, segEnd - 1 do for jj = ii + 1, segEnd do if ( ii ~= jj ) then local heat = contactmap.GetHeat ( ii, jj ) if ( heat > 0 ) then local con = contactmap.IsContact ( ii, jj ) if con then madeTotal = madeTotal + 1 else unmadeTotal = unmadeTotal + 1 end local ss1 = structure.GetSecondaryStructure ( ii ) local ss2 = structure.GetSecondaryStructure ( jj ) local dist = structure.GetDistance ( ii, jj ) local contact = { ii, jj, heat, ss1, ss2, dist, con, false, 0, 0, } contacts [ #contacts + 1 ] = contact tHeat = tHeat + heat end end end end return contacts end function GetContacts( ) local ii local jj local contacts = GetOnlyContacts() if ( #contacts > 0 ) then print ( #contacts .. " predicted contacts found" ) madePct = r3 ( ( madeTotal / #contacts ) * 100 ) print ( madeTotal .. " made contacts (" .. madePct .. "%)" ) SortByIndex ( contacts, MAPHEAT ) minHeat = 9999999 maxHeat = 0 for ii = 1, #contacts do if contacts [ ii ] [ MAPHEAT ] > maxHeat then maxHeat = contacts [ ii ] [ MAPHEAT ] end if contacts [ ii ] [ MAPHEAT ] < minHeat then minHeat = contacts [ ii ] [ MAPHEAT ] end if contacts [ ii ] [ MAPCONT ] then tMadeDist = tMadeDist + contacts [ ii ] [ MAPDIST ] if contacts [ ii ] [ MAPDIST ] > maxMadeDist then maxMadeDist = contacts [ ii ] [ MAPDIST ] end if contacts [ ii ] [ MAPDIST ] < minMadeDist then minMadeDist = contacts [ ii ] [ MAPDIST ] end else tUnmadeDist = tUnmadeDist + contacts [ ii ] [ MAPDIST ] if contacts [ ii ] [ MAPDIST ] > maxUnmadeDist then maxUnmadeDist = contacts [ ii ] [ MAPDIST ] end if contacts [ ii ] [ MAPDIST ] < minUnmadeDist then minUnmadeDist = contacts [ ii ] [ MAPDIST ] end end end if madeTotal > 0 then print ( "minimum made contact distance = " .. r3 ( minMadeDist ) ) print ( "maximum made contact distance = " .. r3 ( maxMadeDist ) ) print ( "mean made contact distance = " .. r3 ( tMadeDist / madeTotal ) ) end if unmadeTotal > 0 then print ( "minimum unmade contact distance = " .. r3 ( minUnmadeDist ) ) print ( "maximum unmade contact distance = " .. r3 ( maxUnmadeDist ) ) print ( "mean unmade contact distance = " .. r3 ( tUnmadeDist / ( unmadeTotal ) ) ) end if minHeat == maxHeat then print ( "all contacts have heat = " .. r3 ( minHeat ) ) else print ( "minimum contact heat = " .. r3 ( minHeat ) ) print ( "maximum contact heat = " .. r3 ( maxHeat ) ) meanHeat = tHeat / #contacts print ( "mean contact heat = " .. r3 ( meanHeat ) ) ii = math.floor ( #contacts / 2 ) mediHeat = contacts [ ii ] [ MAPHEAT ] if #contacts % 2 == 0 then -- even number of entries ii = ii + 1 mediHeat = ( mediHeat + contacts [ ii ] [ MAPHEAT ] ) / 2 -- corrected BK 04/06/2014 end print ( "median contact heat = " .. r3 ( mediHeat ) ) end else print ( "no predicted contacts found" ) end return contacts end -- -- end functions lifted from Contact Cement -- -- -- begin functions lifted and adapted from Spvincent's Helix Rebuild and Local Quake -- -- -- BandAngleCheck - checks whether band is perpendicular to structure -- -- returns true is band is within +/- perpendicular to structure it's in -- -- adapted from spvincent's Local Quake -- function BandAngleCheck ( band_a , band_b, structList, maxangle ) -- Tests the putative band to see, -- should band_a lie on one of the structure, -- whether the band is reasonably perpendicular to the structure. for ii = 1, #structList do -- -- ignore loops, check for beginning and ending segment in helix or loop -- if structList [ ii ] [ STRUTYPE ] ~= "L" and ( ( band_a >= structList [ ii ] [ STRUSEG1 ] ) and ( band_a <= structList [ ii ] [ STRUSEG2 ] ) ) then -- Compute an approximate angle with the helix based on the cosine rule local kindx local a, b, c if ( ( band_a - structList [ ii ] [ STRUSEG1 ] ) > ( structList [ ii ] [ STRUSEG2 ] - band_a ) ) then -- The point lies closest to the helix end. -- Compare against the start of the helix. kindx = STRUSEG1 else -- The point lies closest to the helix start. -- Compare against the end of the helix. kindx = STRUSEG2 end a = structure.GetDistance ( band_a , structList [ ii ] [ kindx ] ) b = structure.GetDistance ( band_a , band_b ) c = structure.GetDistance ( structList [ ii ] [ kindx ], band_b ) local cos_angle = ( a * a + b * b - c * c ) / ( 2 * a * b ) -- We're looking for an angle of about 90 degrees -- give or take a few: other angles will be rejected local angle = math.deg ( math.acos ( cos_angle ) ) if ( ( angle < 90 - maxangle ) or ( angle > 90 + maxangle ) ) then if VERBOSE then print ( "BandAngleCheck: FAILED band " .. band_a .. " to " .. band_b .. ", angle = " .. r3 ( angle ) ) end return false else if VERBOSE then print ( "BandAngleCheck: OK band " .. band_a .. " to " .. band_b .. ", angle = " .. r3 ( angle ) ) end return true end end end return true end -- -- end functions lifted and adapted from Spvincent's Helix Rebuild and Local Quake -- function GetParams() dlg = dialog.CreateDialog ( ReVersion ) 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 ( "Dist. 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, Strength slider acts as multiplier)" ) dlg.MadeBeta = dialog.AddCheckbox ( "Band beta carbons", MadeBeta ) dlg.MadePhobicsBeta = dialog.AddCheckbox ( "Band beta carbons (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 ( "Dist. 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, Strength slider acts as multiplier)" ) dlg.UnmadeBeta = dialog.AddCheckbox ( "Band beta carbons", UnmadeBeta ) dlg.UnmadePhobicsBeta = dialog.AddCheckbox ( "Band beta carbons (phobics only)", UnmadePhobicsBeta ) dlg.l3a = dialog.AddLabel ( "-------- Exclusions --------" ) dlg.LongerThan = dialog.AddCheckbox ( "Skip distances longer than", LongerThan ) dlg.MaxLength = dialog.AddSlider ( "Max Length:", MaxLength, MinLength, MaxLength, 2 ) dlg.ShorterThan = dialog.AddCheckbox ( "Skip distances shorter than", ShorterThan ) dlg.MinLength = dialog.AddSlider ( "Min Length:", MinLength, MinLength, MaxLength, 2 ) dlg.noBandSelf = dialog.AddCheckbox ( "Don\'t band structure to itself", noBandSelf ) dlg.DISALLOW_LL = dialog.AddCheckbox ( "Don\'t band parallel to structure", DISALLOW_LL ) dlg.spc001 = dialog.AddLabel ( "" ) dlg.REPORT = dialog.AddCheckbox ( "Print contact report", REPORT ) 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 LongerThan = dlg.LongerThan.value MaxLength = dlg.MaxLength.value ShorterThan = dlg.ShorterThan.value MinLength = dlg.MinLength.value noBandSelf = dlg.noBandSelf.value DISALLOW_LL = dlg.DISALLOW_LL.value REPORT = dlg.REPORT.value return true else print ( "Dialog cancelled" ) return false end end function GetAtom ( seg, UseBeta, UsePhobicsBeta ) local atom if UsePhobicsBeta then local aa = structure.GetAminoAcid ( seg ) if seg == segEnd then atom = TERMINAL_BETA elseif phobes [ aa ] ~= nil then atom = BETA_CARBON else atom = CENTER_CARBON end else if UseBeta == false or structure.GetAminoAcid ( seg ) == GLYCINE then atom = CENTER_CARBON elseif ii == segEnd then atom = TERMINAL_BETA else atom = BETA_CARBON end end return atom end function MakeBands ( contactmap, structList ) for ii = 1, #contactmap do local seg1 = contactmap [ ii ] [ MAPSEG1 ] local seg2 = contactmap [ ii ] [ MAPSEG2 ] local weight = contactmap [ ii ] [ MAPHEAT ] local made = contactmap [ ii ] [ MAPCONT ] local atom1 = CENTER_CARBON local atom2 = CENTER_CARBON local banded = false local bandIt = false local blen = 0 local bstr = 0 local UseBeta = false local UsePhobicsBeta = false if ( made and weight > MadeWeight ) or ( not made and weight > UnmadeWeight ) then bandIt = true if made then UseBeta = MadeBeta UsePhobicsBeta = MadePhobicsBeta else UseBeta = UnmadeBeta UsePhobicsBeta = UnmadePhobicsBeta end else bandIt = false bweight = bweight + 1 end if bandIt and noBandSelf then local s1 = findContactStruct ( structList, contactmap [ ii ] [ MAPSEG1 ] ) local s2 = findContactStruct ( structList, contactmap [ ii ] [ MAPSEG2 ] ) if s1 == s2 then bandIt = false bsame = bsame + 1 end end if bandIt and DISALLOW_LL then if not BandAngleCheck ( seg1, seg2, structList, MAXANGLE ) then bandIt = false bpara = bpara + 1 end end if bandIt then atom1 = GetAtom ( seg1, UseBeta, UsePhobicsBeta ) atom2 = GetAtom ( seg2, UseBeta, UsePhobicsBeta ) local bnd = band.AddBetweenSegments ( seg1, seg2, atom1, atom2 ) if bnd ~= nil and bnd ~= 0 then local bcur = band.GetLength ( bnd ) if LongerThan and bcur > MaxLength then blong = blong + 1 elseif ShorterThan and bcur < MinLength then bshort = bshort + 1 else banded = true if made then blen = MadeMult * band.GetLength ( bnd ) bstr = MadeStrength if MadeWrength then bstr = MadeStrength * weight else bstr = MadeStrength end else blen = UnmadeMult * band.GetLength ( bnd ) if UnmadeWrength then bstr = UnmadeStrength * weight else bstr = UnmadeStrength end end end else bunk = bunk + 1 -- band.AddBetweenSegments failed print ( "ERROR: band.AddBetweenSegments ( " .. seg1 .. ", " .. seg2 .. ", " .. atom1 .. ", " .. atom2 .. " ) failed" ) end if banded then band.SetGoalLength ( bnd, blen ) band.SetStrength ( bnd, bstr ) contactmap [ ii ] [ MAPBAND ] = true contactmap [ ii ] [ MAPBLEN ] = blen contactmap [ ii ] [ MAPBSTR ] = bstr contactmap [ ii ] [ MAPATM1 ] = atom1 contactmap [ ii ] [ MAPATM2 ] = atom2 bcount = bcount + 1 else band.Delete ( bnd ) end end end end function PrintContacts ( contacts ) local tReport = "" local headStr = "seg1" .. delim .. "seg2" .. delim .. "weight" .. delim .. "ss1" .. delim .. "ss2" .. delim .. "distance" .. delim .. "contact" .. delim .. "banded" .. delim .. "goallen" .. delim .. "strength" .. delim .. "atom1" .. delim .. "atom2" .. delim print ( "--" ) print ( "\"contact map\"" ) print ( headStr ) tReport = tReport .. "\"contact map\"\n" .. headStr .. "\n" for ii = 1, #contacts do local kontact = "" for jj = 1, #contacts [ ii ] do kontact = kontact .. tostring ( contacts [ ii ] [ jj ] ) .. delim end print ( kontact ) tReport = tReport .. kontact .. "\n" end return tReport end function ShowReport ( tReport ) local ask = dialog.CreateDialog ( ReVersion .. " copy-and-paste" ) ask.l15 = dialog.AddLabel ( "Click inside the text box, then" ) ask.l16 = dialog.AddLabel ( "use ctrl+a (command+a on Mac) to select all," ) ask.l20 = dialog.AddLabel ( "and control+c or command+c to copy, then" ) ask.l30 = dialog.AddLabel ( "paste into spreadsheet" ) ask.rep = dialog.AddTextbox ( "contact map:", tReport ) ask.OK = dialog.AddButton ( "OK", 1 ) dialog.Show ( ask ) end function NoContacts () local ask = dialog.CreateDialog ( ReVersion .. " no contacts" ) ask.l15 = dialog.AddLabel ( "No contacts found." ) ask.l16 = dialog.AddLabel ( "This recipe is for contact map puzzles." ) ask.OK = dialog.AddButton ( "OK", 1 ) dialog.Show ( ask ) end function Cleanup ( error ) -- -- optionally, do not loop if cleanup causes an error -- (any loop here is automatically terminated after a few iterations, however) -- if CLEANUPENTRY ~= nil then return end CLEANUPENTRY = true print ( "---" ) local reason local start, stop, line, msg if error == nil then reason = "complete" else -- -- model 120 - civilized error reporting, -- thanks to Bruno K. and Jean-Bob -- start, stop, line, msg = error:find ( ":(%d+):%s()" ) if msg ~= nil then error = error:sub ( msg, #error ) end if error:find ( "Cancelled" ) ~= nil then reason = "cancelled" else reason = "error" end end -- -- model 100 - print recipe name, puzzle, track, time, score, and gain -- print ( ReVersion .. " " .. reason ) print ( "Puzzle: " .. puzzle.GetName () ) print ( "Track: " .. ui.GetTrackName () ) if reason == "error" then print ( "Unexpected error detected" ) print ( "Error line: " .. line ) print ( "Error: \"" .. error .. "\"" ) end -- -- model 130 - reset clash importance, clear selections, restore structures, etc. -- local skips = 0 print ( "total contacts = " .. tContacts ) if bweight > 0 then print ( "contacts skipped due to minimum weight = " .. bweight ) skips = skips + bweight end if bsame > 0 then print ( "contacts skipped due \'band self\' = " .. bsame ) skips = skips + bsame end if bpara > 0 then print ( "contacts skipped due to \'don\'t band parallel\' = " .. bpara ) skips = skips + bpara end if bunk > 0 then print ( "bands failed due to unknown error = " .. bunk ) skips = skips + bunk end if bshort > 0 then print ( "contacts skipped due to minimum distance = " .. bshort ) skips = skips + bshort end if blong > 0 then print ( "contacts skipped due to maximum distance = " .. blong ) skips = skips + blong end if skips > 0 then print ( "total contacts skipped = " .. skips ) end print ( "contact bands created = " .. bcount ) print ( "total bands = " .. band.GetCount() ) end function Main () print ( ReVersion ) print ( "Puzzle: " .. puzzle.GetName () ) print ( "Track: " .. ui.GetTrackName () ) print ( "Contact map statistics:" ) local structList = GetStructs () local contacts = GetContacts () tContacts = #contacts if tContacts == 0 then NoContacts () Cleanup () end MinLength = math.min ( minMadeDist, minUnmadeDist ) MaxLength = math.max ( maxMadeDist, maxUnmadeDist ) if GetParams () then print ( "options:" ) --print ( "Made Contacts: band current distance * " .. MadeMult .. ", strength " .. MadeStrength ) 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: band current distance * " .. UnmadeMult .. ", strength " .. UnmadeStrength ) 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 if LongerThan then print ( "max band distance = " .. MaxLength ) end if ShorterThan then print ( "minimum band distance = " .. MinLength ) end if noBandSelf then print ( "don\'t band structures to themselves" ) end if DISALLOW_LL then print ( "don't allow bands parallel to a structure" ) end print ( "--" ) MakeBands ( contacts, structList ) if REPORT then local tReport = PrintContacts ( contacts ) ShowReport ( tReport ) end end Cleanup () end xpcall ( Main, Cleanup )

Comments


LociOiling Lv 1

Version 2.3 of Band All Contacts Adaptive merges Susume's Band Pruner v0.2 and Madde's BACA v2.2m with Susume's BACA v2.2. Some functions from Contact Cement 3.0 and Local Quake 5.0 (NC) are also included.

The main dialog has been streamlined a bit to hopefully make it usable on smaller screens.

For both made and unmade contacts, the sliders and checkboxes specify which contacts should be banded, and how they should be banded.

The "Min. Weight" slider specifies the minimum contact weight (or heat) for banding.

The "Dist. Multiplier" slider is used to set the goal length of the bands. The goal length is the bands initial length times the distance multiplier setting. A distance multiplier over 1.0 makes "push" bands.

The "Strength" slider sets the strength of the bands. If the "set strengths according to weights" option is checked, the value of the strength slider is multiplied by the contact's weight to get the band strength.

The "band beta carbons" and "band beta carbons (phobics only)" options band the beta carbon (generally atom 5) instead of the default alpha carbon (atom 2). The beta carbon is the first "elbow" of the sidechain, except for glycine, which has only a hydrogen there. (Poor glycine.) Banding beta carbons may allow things to pivot more easily.

The new "exclusions" section further restricts which contacts get banded. The exclusions apply to both made and unmade contacts.

The two "skip distances" options are taken from Band Pruner v0.2. The corresponding sliders let you set minimum and maximum distances for banding.

The exclusions section also includes two new options. The logic behind these options was adapted from spvincent's Helix Rebuild and Local Quake recipes. These options both depend on a secondary structure that is not all loop.

The "don't band structure to itself" option eliminates bands on the same secondary structure. For example, is segments 2 through 18 form a helix, the recipe won't band any contacts in this range if the option is checked. This option applies to helix, sheet, and loops.

The option "don't band parallel to structure" applies to helixes and sheets, and eliminates bands that are more than +/- 30 degrees from perpendicular to a structure.

Version 2.3 uses the contact scanning logic from Contact Cement to build a table of contact information. The recipe now reports contact statistics to the scriptlog. Lua fans will enjoy the new table-based hydrophobe check. Banding is done based on the contact table.

The "Print contact report" option dumps the contact table information to the scriptlog and a dialog window. The text box in the dialog window can be copied and pasted into a spreadsheet, as in Print Protein 2.0. Thanks to Herobrine's Army to the idea.

The spreadsheet includes banding information, such as whether the contact was banded, the goal length and strength of the band, and the atoms banded. This information is included mainly for debugging purposes.

The "distance" column in the table is the result of structure.GetDistance for the segments in question. Previous testing has shown that this value is the same as length returned for a band.AddBetweenSegments band using the default atoms (which bands alpha carbons). If the beta carbon banding options are used, the length of the initial band will be slightly different.

Thanks for Susume, Madde, spvincent, Bruno Kestemont, and Herobrine's Army for ideas and code. The initial suggestion to merge BACA and Band Pruner came from retiredmichael. Things kind of got out of hand after that.

Bruno Kestemont Lv 1

Thanks Loci.
A suggestion: when an unmade contact is shorter than 7, I think it would be better to set band length bigger than current length (not even smaller as default).

Bruno Kestemont Lv 1

Optional set default goal length to minimum 4 for unmade contacts. Current 0 has the risk of crushing too much after contact is achieved (which would give a bonus for unrealistic contacts).