Introducing the Trim Tool!

Started by apetrides

apetrides Staff Lv 1

Hey Foldit players!

We're very excited to announce the addition of Foldit's newest feature: the Trim tool.

Trimming and Untrimming in Foldit is a very important addition that will make it much easier for players to work with much larger proteins than ever before!

In the past, it's been difficult to work with large proteins in Foldit because Foldit features (such as scoring and displaying proteins) are computationally intensive and scale with the size of a protein.

The Trim tool allows for the use of larger proteins without a sacrifice in performance by allowing users to trim a protein down to some set of selected residues.

Simply select the region you want to work with, and use the U hotkey to reduce the puzzle down to the selected region. Once you're done working with that region, hit the U hotkey again to Untrim and return to the full puzzle.

Bletchley Park Lv 1

How can one use this tool to divide up a model, work on the pieces separately and return to the whole model without losing points compared to working on the whole model to begin with ?

LociOiling Lv 1

As discussed with jeff101 in veteran chat, most recipes should work on a trimmed protein. Bands may be one exception, but they'll need a separate post.

Ignoring bands for the moment, to a recipe, the trimmed protein appears as a normal protein, starting at segment 1.

For example, if you select segments 47-165 and trim, recipes will see a protein with 119 segments. Segment 47 of the original protein will be segment 1 of the trimmed protein.

The same is true when the trimmed protein consists of separate sections of the original protein. The recipe again sees the trimmed protein as a single sequence of segment numbers starting with segment 1. uThe segments in the trimmed protein appear in the same order as in the original protein.

With a trimmed protein, there are no cutpoints or changes to atom counts to indicate where the pieces go together. Normally, atom counts are different at the beginning and end of a protein chain. This allows detecting where chains begin and end.

On puzzle 2155 at least, the atom counts for the amino acids at the beginning and end of the untrimmed protein appear to be the same as when the same amino acid appears in the middle of the chain. The atom counts also don't change when the protein is trimmed. So the usual "chain detection" logic won't work on 2155. Most recipes don't care about chains, so this little quirk shouldn't be a problem.

LociOiling Lv 1

As mentioned above, bands are one area that could be a problem for some recipes.

When you trim the protein, Foldit adds a super strong band at each end of the trimmed area. The band has strength 1000. You can't make a band this strong either manually or using a recipe.

Strong bands appear at each end of a trimmed section, except when at the beginning or end of the original protein.

A recipe can use band.GetStrength to determine the strength of these special bands. But if the recipe tries to adjust the strength, the usual rules apply.

So if a recipe tries to cut the strength of one of these strong bands in half using band.SetStrength ( bndx, 500 ), and error occurs and the recipe terminates.

Bletchley Park Lv 1

Thank you Loci for taking the time to explain the behavior of the trim tool in relation to recipes. It does not answer my question though. When I use the trim tool and reveal the complete structure again I consistently get fewer points than when I had processed the entire structure in one piece. This to me defeats the purpose of the trim tool, being able to work on pieces (and thus faster) and still have at least as many points, after I reveal the entire structure, as I would have processing it in as a whole to begin with. .

So: without losing points compared to working on the whole model to begin with

Bletchley Park Lv 1

I would also like to know, from the developers, what LUA functions are avilable for this functionality and the syntax for those functions please.

I am aware you tuck function calls into the help function but I would like to see an official place where these functions are revealed to the public so all of us can find that information at the same time.

LociOiling Lv 1

There was an office hour today with apetrides/petridecus that covered some of these issues. No transcript yet.

As far as I know, there are no functions that can tell you whether a protein has been trimmed.

The trimmed protein is in its own little universe, with no way to tell anything about the untrimmed protein.

On possible exception is a trimmed protein consisting of multiple segment ranges. A recipe might detect that some adjacent segments are unusually far apart, possibly meaning they were trimmed from a larger protein.

On the other hand, puzzle 2155b has two gaps where residues turned up missing in the experimental results. The ends of those gaps would also be unusually far apart.

Trimming doesn't change atom counts. So a recipe won't see multiple protein chains in a trimmed protein. It looks like all one protein. On 2155b, even the first and last segments don't have the normal N-terminal and C-terminal atom counts. Everything has a mid-chain atom count. This is different than in the KLHDC2 puzzle, where the trimmed protein looks like lots of little chains.

On the other question regarding scoring of a trimmed section, one suggestion was to avoid working on the ends of the trimmed protein. Deselecting them or using cutpoints were suggested as ways to avoid creating backbone issues or other problems when working on a trimmed protein.

For detecting the distance between segments, jeff101 suggests a measuring technique using bands, seen in the DistMap series of recipes:

[15:54.34] <@jeff101> somehow in the DistMap recipe, I found the distance between adjacent a-carbons.
[15:55.45] <@jeff101> maybe it took 2 bands: 1 from Ca[n] to space with length ~0, and another from Ca[n+1] to the endpoint of the other band. 

bkoep Staff Lv 1

Unfortunately, the Trim tool does not work quite so neatly. When Trim is active, there are no guard rails to prevent you from clashing with the hidden regions of the solution. If you freely optimize a Trim region (for example, by running your normal recipes), you are likely to discover new clashes and other issues when you Untrim.

I think the main benefit of the Trim tool is that it can improve Foldit responsiveness, specifically for hand-folding tasks. To illustrate, I'll consider a massive 575-residue solution where a tiny little helix is clearly mismatched from the electron density cloud:

Without the Trim tool
Even though I just want to drag that little helix and leave everything else the same, Foldit still has to recalculate the energies of all 575 residues every rendered frame (after all, moving the little helix can still have big effects on the surrounding energies). On my little laptop, Foldit suddenly slows to rendering one frame per second; the helix is now being dragged to the point where my cursor was a full second ago. This is unworkable for me; hand-folding is out the question.

With the Trim tool
The Trim tool lets me hide 500 residues, so I can focus on just the 75 residues around my little helix. Now I can drag the helix into the density, and Foldit responds in real time because it only has to recalculate 75 residue energies each frame. This is workable now, but the trade off is that I can't see how my helix dragging affects the energies of those 500 hidden residues. When I Untrim, I discover that my little helix now clashes with some sidechains that were hidden, and some H-bonds were broken.

In this case, I'm not worried about the clashes and broken H-bonds because I'm confident that my hand-folding improved the solution (the helix now fits in the density!). After Untrimming, I will probably have to Wiggle and Shake a bit to "reintegrate" my Trim region into the full solution. It took some extra effort, but I expect my hand-folding will help me reach a higher score in the end.

bkoep Staff Lv 1

The Trim tool may not combine well with recipes that focus solely on score (because the Trim score does not reflect the whole score). However, since recipes are not concerned with responsiveness, these recipes should still work okay on large proteins, and the Trim tool can be ignored. A bigger protein just means recipes may need more time to finish.

I suspect most of the Trim score losses will come from the boundary of the Trim region, where active residues contact hidden residues. If you can freeze the active residues at this boundary, you may be able to "insulate" your work while Trim is active. This might help to reduce some boundary conflicts when you Untrim.

Finally, I'll just reinforce that all of my comments are just suggestions about the Trim tool! Hand-folding responsiveness is just one angle, but there could be other uses for the Trim tool. We are looking forward to seeing what Foldit players can do, and we welcome all feedback about Foldit tools and how we can make them better!