LociOiling Lv 1
Amazing, this recipe works well, and it's quick, even on a large puzzle (392 segments, for example). It's way less complex and more reliable than the stuff in print protein 3.0, which relies on distance measurements. It can also deal with a trimmed pose and open cutpoints.
I was totally baffled by how it works. Stop reading now if you want to savor the magic.
spoiler alert
The lines below give away the secret.
The recipe loops through each segment, attempting to add a band between the segment and the next segment. The band goes from atom 3 of the one segment to atom 1 of the next segment. (The recipe has special handing for the first and last segments, since they are always going to be terminals.)
The recipe in effect does makes this call to create a band between segment 20, atom 3, and segment 21, atom 1:
band.AddBetweenSegments ( 20, 21, 3, 1 )
Due to one of those Foldit quirks, this call is going to fail if 20 and 21 are in the same chain, meaning no band is added. If the two segments are not in same chain, the call is successful, and a band is added.
(You can't use band.AddBetweenSegments to go from segment i to segment i, or from i to i+1 or i-1.)
After banding, the recipe uses band.GetCount to determine how many bands there are, then uses band.GetResidueBase to get the starting segment of the band. The recipe then uses the function band.GetResidueEnd to get the ending segment of the band. The two segments are "terminals", or the ends of their respective chains.
The starting and ending segments are added to a table, which also contains the first and last segment numbers. The result is a list of all the terminals in the puzzle.
Simple and quick, and it doesn't care about protein versus DNA or RNA. The banding approach tricks Foldit into revealing the chain information that's in there somewhere, but isn't explicitly shared with users.