Icon representing a recipe

Recipe: UnBUN_1.0

created by mwm64

Profile


Name
UnBUN_1.0
ID
103681
Shared with
Public
Parent
None
Children
None
Created on
July 07, 2020 at 00:44 AM UTC
Updated on
July 07, 2020 at 00:44 AM UTC
Description

Script that tries to make bonds to the target protein and reduce BUNS.

Best for


Code


-- unbun -- Try to get rid of BUNS by finding hydrophilic segments in the -- target protein that are near segments in the user protein -- and mutating the user protein segment to something that can -- bond with that target; keeping changes that improve our BUN -- score iterations=2 bond_radius=7 keepbands=false print("unbun: starting with iterations=" .. iterations .. " and bond_radius=" .. bond_radius ) function GetBondableAcids(acid) -- if this is a "red" acid, return the list of blue ones -- and vice versa; if its a red-blue one return both -- and if its a M, return the same... if acid == 'k' or acid == 'r' or acid == 'h' or acid == 'w' then return {'e','d','s','t','y'} end if acid == 'e' or acid== 'd' or acid =='s' or acid == 't' or acid == 'y' then return {'k','r','h','w'} end if acid == 'm' then return {'m'} end -- otherwise pretend its a red-blue, and try lots.. return {'k','r','h','w','e','d','s','t','y'} end -- first find the BUN filter so we can check for improvement -- satfilt = -1 filt = filter.GetNames () print ( #filt .. " conditions or filters" ) for ii = 1, #filt do print( "checking filter " .. ii .. ": " .. filt[ii] ) if string.match(filt[ii],".*sat") then print( "found sat filter " ) satfilt = ii end end -- pick a radius of how close two segments need to be to form -- bond... recipe.SectionStart("unbun") recipe.ReportStatus() undo.SetUndo(false) if satfilt >= 0 then nsegs = structure.GetCount() -- guess that the boundary between target and user segments is halfway boundary = math.floor( nsegs/2 ) orig_nsat_bonus = filter.GetBonus(filt[satfilt]) for tps = 1, boundary do if not structure.IsHydrophobic(tps) then -- look up amino acids to try against this protein taa = structure.GetAminoAcid(tps) bonding_acids = GetBondableAcids(taa) print("got for acid " .. taa .. " list " .. table.concat( bonding_acids,",")) recipe.SectionStart("mutate_candidate") recipe.ReportStatus() for ups = boundary, nsegs do if structure.IsMutable(ups) and structure.GetDistance(tps, ups) < bond_radius and string.len(structure.GetAminoAcid(ups)) == 1 then print("Trying to bond segment " .. ups .. " to " .. tps) -- keep max bonus and corresponding protein -- max (so far) is where we are now max_nsat_bonus = filter.GetBonus(filt[satfilt]) maxbonusacid = structure.GetAminoAcid(ups) recentbest.Save() print("got amino acid " .. maxbonusacid) selection.DeselectAll() selection.Select(ups) for bai = 1,#bonding_acids do print("A setting " .. ups .. " to " .. bonding_acids[bai]) structure.SetAminoAcid(ups, bonding_acids[bai]) -- sometimes just mutating it adds a bond, so skip shake and or wiggle if -- the score is already better... bonus = filter.GetBonus(filt[satfilt]) if bonus <= max_nsat_bonus then -- maybe if we shake it it will bond? structure.ShakeSidechainsSelected(iterations) bonus = filter.GetBonus(filt[satfilt]) end if bonus <= max_nsat_bonus then -- see if wiggling with the band will bond it... -- try to band the sidechains so wiggle will try to make the bond tcount = structure.GetAtomCount(tps) ucount = structure.GetAtomCount(ups) myband = band.AddBetweenSegments(tps, ups, tcount, ucount) band.SetGoalLength(myband,1.5) band.SetStrength(myband, 1.5) structure.WiggleAll(iterations) band.Delete(myband) bonus = filter.GetBonus(filt[satfilt]) end if bonus < max_nsat_bonus then -- tweaking this broke a BUNS bond, -- (without adding others) -- put it back and give up on this -- target segment... recentbest.Restore() break end if bonus > max_nsat_bonus then -- we have a new winner!!! maxbonusacid = bonding_acids[ bai] max_nsat_bonus = bonus recentbest.Save() print("new best: " .. bai .. " gets ".. bonus) else -- our bonus is equal, but... -- we probably broke the overall score, -- so put it back recentbest.Restore() end end recipe.ReportStatus() end end recipe.SectionEnd() end end else print( "Couldn't find sat filter, quitting" ) end undo.SetUndo(true) recipe.SectionEnd()

Comments


mwm64 Lv 1

You went in by hand, in design mode, and hooked up your protein to the target protein, in like a dozen places, and then you Wiggled, or Mutated, and it ripped out your bonds, and attached them back to the protein… This is the tool that will put the bonds back on to the target protein, and even add a few that you missed.

Hopefully this will help more folks get proteins that bond next time…