One-directional bands (like bumpers) for Contact Map puzzles

Case number:845813-996372
Topic:Game: Tools
Opened by:jeff101
Status:Open
Type:Suggestion
Opened on:Saturday, November 30, 2013 - 18:07
Last modified:Wednesday, August 7, 2019 - 17:28

When last I checked (with recipe http://fold.it/portal/recipe/46844 DoBandsObeyHookesLaw1), Foldit bands obeyed Hooke's Law for springs: F = -k x, where k is a spring constant, x is the distance the band has been stretched from its equilibrium value, and F is the force exerted by the band. The - sign is there to tell the direction of the force F (the force is always opposite to the direction the band is stretched or compressed from equilibrium, forcing the inter-atom distance back towards equilibrium). These bands behave like springs attached at both ends to the protein.

Would it be possible to add a new class of bands that act like springs attached at just one end to the protein? One kind would behave like bumpers on cars. If the band gets compressed below its equilibrium distance, the band behaves like normal and obeys Hooke's Law, forcing the distance back toward equilibrium. Nevertheless, if the band is stretched beyond its equilibrium distance, the band exerts no force on the protein.

Another kind of band would obey Hooke's Law when stretched beyond its equilibrium distance, but exerts no force when compressed below its equilbrium distance.

These new kinds of bands would help with Contact Map puzzles (see http://foldit.wikia.com/wiki/Contact_map for example). With two of these bands, one could set the minimum and maximum distances between two atoms on the protein. As long as the atoms stay between these minimum and maximum distances, the bands behave as if they are not present, but once the atoms move out of the desired minimum to maximum range, the atoms will feel Hooke's Law forces like from normal bands, forcing the distance between the atoms back into the desired minimum to maximum range.

(Sat, 11/30/2013 - 18:07  |  10 comments)


Joined: 09/21/2011
Groups: Void Crushers
jeff101's picture
User offline. Last seen 9 hours 12 min ago. Offline
Joined: 04/20/2012
Groups: Go Science

The type of band described above as:

"Another kind of band would obey Hooke's Law when stretched beyond its equilibrium distance, but exerts no force when compressed below its equilbrium distance."

could be built with a spring and two unstretchable strings. It could look like this:

atom1-----string-----/////spring/////-----string-----atom2

For short distances between atoms 1 and 2, the strings would be slack, the spring would be unstretched, and this would exert no force between atoms 1 and 2. For distances long enough to fully-extend the strings, the spring would start to stretch, and this would exert a force that attracts atoms 1 and 2 toward each other.

spmm's picture
User offline. Last seen 32 weeks 1 day ago. Offline
Joined: 08/05/2010
Groups: Void Crushers

Also this original post by Timo which collates the variety of requests for bands:
http://fold.it/portal/node/992891

jeff101's picture
User offline. Last seen 9 hours 12 min ago. Offline
Joined: 04/20/2012
Groups: Go Science

One-directional bands would be helpful in puzzles like
"1127: Revisiting Puzzle 87: Zinc Binding Protein"
(http://fold.it/portal/node/2001066)
that have multiple cysteines (here 4)
but are modeled as in a reduced environment,
where no disulfide bonds are expected to form.

In such puzzles, one could put bumper-like bands
between each possible pair of cysteine residues
so they will stay far enough apart
that they will not form any disulfide bonds.

brow42's picture
User offline. Last seen 3 weeks 3 days ago. Offline
Joined: 09/19/2011
Groups: None

Sorry I didn't mean to -1 you.

I think this is doable in rosetta. It may take some work on the part of jflat or maybe someone more into rosetta internals though. It will also have some of the same issues as threshold filters (but mitigated by being part of wiggle, where the filters are not).

Your very interesting script http://fold.it/portal/recipe/46844 showed that F=s^2 (x-x0), which implies the rosetta energy due to stretched band is E = (1/2) [s (x-xo)]^2 (*). Can this be changed to a one-sided function easily (essentially with E = 0 and dE/dx = 0 for x < x0)? It all depends on how rosetta works. jflat has said bands are implemented as a constraint, which is slightly different than an explicit energy term, though in this case they work out to be the same thing.

(*) A surprising consequence of this is that 1 band of str 2 is much stronger than 2 bands of str 1.

jeff101's picture
User offline. Last seen 9 hours 12 min ago. Offline
Joined: 04/20/2012
Groups: Go Science

You could try to up-vote the post below about
letting users change their votes on posts
http://fold.it/portal/node/992701

jeff101's picture
User offline. Last seen 9 hours 12 min ago. Offline
Joined: 04/20/2012
Groups: Go Science
When looking at some Rosetta documentation I found the page below:

https://www.rosettacommons.org/docs/latest/rosetta_basics/file_types/constraint-file

It says that Rosetta can constrain distances.
atom_pair_constraint constrains the distance between Atom1 & Atom2, 
which sounds like a band between these atoms.
coordinate_constraint sounds like a band from an atom to space.

Under Function Types it lists the following:

HARMONIC x0 sd 
gives f(x)=((x-xo)/sd)^2, a harmonic potential, 
like for springs obeying Hooke's Law.
Here, if f(x) = ((x-xo)/sd)^2 = U = k(x-xo)^2/2, 
then 1/sd^2 = k/2, sd^2 = 2/k, sd=sqrt(2/k), and
k = 2/sd^2 = the Hooke's Law spring constant for the spring.

BOUNDED lb ub sd rswitch tag
looks like it could be used for 1-way bands. 
For 1-way bands that keep things > the distance xo apart,
use lb=xo and ub=infinity.
This would give f(x)=0 for xo <= x <= infinity
and f(x)=((x-xo)/sd)^2 for x < xo.
For 1-way bands that keep things < the distance xo apart,
use a HARMONIC band with f(x)=((x-xo)/sd)^2
but subtract from it a BOUNDED band 
with lb=xo and ub=infinity. 
This would give f(x)=0 for x < xo
and f(x)=((x-xo)/sd)^2 for xo <= x <= infinity.

To combine function types, I think one could use
SUMFUNC (adds multiple functions together) and
SCALARWEIGHTEDFUNC (lets one multiply a function
by a scalar called weight, which I assume could 
be set to -1).

Sample Files gives the sample formats below:
AtomPair SG 5 V1 32 HARMONIC 0.0 0.2
AtomPair SG 8 V2 32 HARMONIC 0.0 0.2
AtomPair NE2 13 V3 32 HARMONIC 0.0 0.2
AtomPair SG 18 V4 32 HARMONIC 0.0 0.2
AtomPair H  6 HA 134 BOUNDED  1.80 5.25 0.50 NOE ;dist 5.000 1.800
AtomPair HA 7 HA 132 HARMONIC 1.2 0.2

Maybe a normal band with target length 1.2 would be like:
AtomPair HA 7 HA 132 HARMONIC 1.2 0.2
while a 1-way band to keep the distance > 1.2 would be like:
AtomPair HA 7 HA 132 BOUNDED 1.2 Inf 0.2 0.50 TAG
and a 1-way band to keep the distance < 1.2 would be like:
AtomPair HA 7 HA 132 SUMFUNC 2 HARMONIC 1.2 0.2 SCALARWEIGHTEDFUNC -1 BOUNDED 1.2 Inf 0.2 0.50 TAG

Since Foldit seems to be based on Rosetta, I hope someone on the Foldit Team 
can use code like the above to implement one-way bands in Foldit.
jeff101's picture
User offline. Last seen 9 hours 12 min ago. Offline
Joined: 04/20/2012
Groups: Go Science
While it would be better if one-way bands were a 
built-in Foldit feature, coders can approximate 
them as follows:

When you make a one-way band, decide what type it 
is and then add a string called btype to the Note 
for its band # bnum:

band.SetNote(bnum,(band.GetNote(bnum)..' '..btype))

For bands that keep their present lengths below 
their goal lengths, use for btype something like 
'max', 'maxlen', 'lopass', 'keeplo', or 'keepbelow'.

For bands that keep their present lengths above 
their goal lengths, use for btype something like 
'min', 'minlen', 'hipass', 'keephi', or 'keepabove'.

Other recipes can then decide what kind of band it
is using:

-- below finds bkind for band j 
-- by reading band.GetNote(j).
function getbkind(bnum) 
local bkind,bnote
bnote=band.GetNote(bnum) 
   -- above gets string bnote for band # bnum.
bkind=0 -- default: holds for normal, 2-way bands.
if string.find(bnote,"keepbelow")~=nil then
   -- bnote contains 'keepbelow'.
   if string.find(bnote,"keepabove")~=nil then 
      -- bnote has both 'keepbelow' & 'keepabove'.
      -- This shouldn't happen & shows an error. 
   else -- bnote contains 'keepbelow' only.
      bkind=1 -- a 1-way band that is 
      -- enabled when its length > goal length and
      -- disabled when its length <= goal length.
   end -- if string
elseif string.find(bnote,"keepabove")~=nil then 
   -- bnote contains 'keepabove' only.
   bkind=2 -- a 1-way band that is 
      -- enabled when its length < goal length and
      -- disabled when its length >= goal length.
end -- if string
return bkind
end -- getbkind()

If band.SetNote and band.GetNote don't exist yet, 
one can store bkind (a 0, 1, or 2) from above as one 
of the digits after the decimal point in the band's 
strength or goal length. Other recipes can then read 
bkind from the band's strength or goal length. For 
more details on storing information in & reading 
information from a band's strength or goal length, 
see https://fold.it/portal/node/2002640

Then, within a recipe made to enforce 1-way bands, 
put code like below near the start of the recipe:

-- below records the initial state of each band:
nbands=band.GetCount() -- initial # of bands.
oldbenabled={} -- will be a list of nbands booleans.
bgl={} -- will be a list of nbands band goal lengths.
bstr={} -- will be a list of nbands band strengths.
bnote={} -- will be a list of nbands band notes.
bkind={} -- will be a list of nbands integers 
   -- that equal 0, 1, or 2.
for j=1,nbands do
   oldbenabled[j]=band.IsEnabled(j) -- reads a boolean.
   bgl[j]=band.GetGoalLength(j) -- reads a real #.
   bstr[j]=band.GetStrength(j) -- reads a real #.
   bnote[j]=band.GetNote(j) -- reads a string.
   bkind[j]=getbkind(j,bnote[j],bgl[j],bstr[j]) 
      -- find bkind[j] (a 0, 1, or 2) by reading 
      -- bnote[j] or a special digit from bgl[j] 
      -- or bstr[j].
end -- for j

Then, periodically within the recipe, do as follows:

-- below enforces 1-way bands:
for j=1,nbands do
   if oldbenabled[j] then -- only do below for 
      -- bands that began the recipe as enabled.
      if bkind[j]==1 then -- a 1-way band 
         -- that keeps its length <= goal length.
         if band.GetLength(j) <= bgl[j] then
            band.Disable(j) -- band not needed.
         else -- length > goal length.
            band.Enable(j) -- band is needed.
         end -- if band
      elseif bkind[j]==2 then -- a 1-way band 
         -- that keeps its length >= goal length.
         if band.GetLength(j) >= bgl[j] then
            band.Disable(j) -- band not needed.
         else -- length < goal length.
            band.Enable(j) -- band is needed.
         end -- if band
      end -- if bkind
   end -- if oldbenabled
end -- for j

Finally, right before the recipe ends, do as below 
to enable or disable the bands like they were at the 
start of the recipe:

-- below restores each band to its initial state
for j=1,nbands do
   if oldbenabled[j] then -- band j began as enabled.
      band.Enable(j) -- re-enable band j.
   else -- band j began as disabled.
      band.Disable(j) -- re-disable band j.
   end -- if oldbenabled
end -- for j

Please note that I haven't tested any of this code.
You may need to change it to make it work correctly.
jeff101's picture
User offline. Last seen 9 hours 12 min ago. Offline
Joined: 04/20/2012
Groups: Go Science
The recipe BandOntoSphere1.0 (https://fold.it/portal/recipe/102961)
can make bands with the same target length and band strength from 
many alpha-carbons on the protein to a point in space (marked by
a hub band) where we want to center a sphere. With normal bands, 
the target length sets the approximate radius of the sphere, and 
the band strength decides how thick the sphere will be. Using a 
large band strength will make a thin spherical shell of protein.
Using a weaker band strength will make a thicker spherical shell. 
Either way, the protein density in and around the sphere will be 
rather non-uniform, depending on the distance from the center of 
the sphere as well as the bands' strength and target length. 

If Foldit had one-way bands, we could use them in a new version of 
BandOntoSphere to make spheres with more uniform density. Below are 
two cartoons showing spheres made with each type of one-way band. 
The black regions show where the protein would go. The green sphere 
uses one-way bands that keep the protein inside the sphere. The red 
sphere uses one-way bands that keep the protein outside the sphere.
gb.pngrb.png
With two spheres instead, we could get patterns like below:
(a)g-rb.png(b)g-gb.png
(c)r-rb.png(d)rrb.png
(e)ggb.png(f)rgb.png
Here, (a) gives a spherical protein with a hole in it, (b) gives 
a small spherical protein, (c) keeps the protein outside a large 
sphere, (d) keeps the protein outside a bi-lobed shape, (e) gives 
a discus-shaped protein, and (f) gives a dented spherical protein.

Note that some two-sphere patterns are ambiguous, like green inside 
red below. Here, if the green sphere's bands dominate, the protein 
ends inside the green sphere. Similarly, if the red sphere's bands
dominate, the protein ends outside the red sphere.
r-gbi.pngr-gbo.png
Nevertheless, if the green and red sphere's bands are similar in 
strength, the protein ends in the gray region between the spheres, 
as below, with the protein density at each point depending on how 
far that point is from each sphere.
r-gg.png
Finally, with 6 red spheres (one for each face of a cube, two are 
not shown) and one green sphere, as below, we could get a roughly 
cube-shaped protein:
box1.png
jeff101's picture
User offline. Last seen 9 hours 12 min ago. Offline
Joined: 04/20/2012
Groups: Go Science
I think enabled one-way bands should be colored 
differently (green or red) from normal enabled 
Foldit bands (purple). A one-way band that applies 
a force only when its present length is greater 
than its target length could be green. A one-way 
band that applies a force only when its present 
length is smaller than its target length could
be red. Thus, the green bands would only apply 
nonzero inward (attractive) forces, and the red 
bands would only apply nonzero outward (repulsive) 
forces. The one-way bands could be very thin (but 
still green or red) when they are not applying 
forces and the normal thickness when they are 
applying nonzero forces. Both normal and one-way 
bands could be gray when they are disabled.
Sitemap

Developed by: UW Center for Game Science, UW Institute for Protein Design, Northeastern University, Vanderbilt University Meiler Lab, UC Davis
Supported by: DARPA, NSF, NIH, HHMI, Amazon, Microsoft, Adobe, RosettaCommons