Off by one error in get_aa() function

Case number:845813-988292
Topic:Game: Tools
Opened by:Tlaloc
Opened on:Thursday, August 19, 2010 - 20:54
Last modified:Tuesday, August 23, 2011 - 19:57

If you try to use get_aa() to retrieve the last segment of some proteins, it gives an error.

The following code in a lua script doesn't work on the current TNT protein:


However, this does work:

print(get_aa(get_segment_count() - 1))

However, both calls works on the current Platypus Venom puzzle. It may have something to do with TNT is a design puzzle.

(Thu, 08/19/2010 - 20:54  |  9 comments)

beta_helix's picture
User offline. Last seen 4 hours 7 min ago. Offline
Joined: 05/09/2008
Groups: None

Thanks for catching this, it's probably something different with design puzzles.

Joined: 03/20/2010

I noticed also that the score reported by the our replacement score function, which adds the get_segment_ score() for each segment, then adds 8000 - also computes wrong on the design puzzle, returning a value a few thousand points too high. I thought it may have something to do with the fact that the ligand is a separate non-attached element, even though it has a sequential segment number... - just an observation, maybe it is helpful...?

vakobo's picture
User offline. Last seen 1 year 31 weeks ago. Offline
Joined: 06/05/2008
Groups: Russian team

I think this is because the last segment is ligand in TNT Design Puzzle.

Joined: 09/18/2009
Groups: SETI.Germany

dimension9 and Vakobo seem to be right.
I guess, that the whole ligand is declared as only one single sidechain, but consists of more parts, so the score are calculated strangely and setting the sidechain shape of this "segment" is impossible.

Splitting the ligand into more segments would help.
This would also allow manipulating it better.

Joined: 09/18/2009
Groups: SETI.Germany

It would be useful to have a global variable, to check if a puzzle is a ligand puzzle, so we could compensate the error and adapt scripts for this special situation.

puzzle_ligand() could give back "true" if this a ligand puzzle.

For most operations then, working not with get_segment_count() but get_segment_count()-1 could help preventing crashes.

Furthermore, a global variable, to respond if a puzzle is mutable would help.

puzzle_mutable() could answer "true" if there is minimum one segment which can be mutated.

Joined: 09/18/2009
Groups: SETI.Germany

get_aa(get_segment_count(()), which is get_aa(248) on TNT doesn't work because this segment is the ligand.

As the ligand is no sidechain, but a more complex structure, it doesn't have a sidechain letter.

But to my opinion, the get_aa()-function should return a value even in this case to keep scripts running.
Even if the letter you get is none of the regular sidechain letters, or just nothing like "", but it should not give a "bad argument" error when executing get_aa().

Joined: 09/18/2009
Groups: SETI.Germany

However, selecting the ligand by select_index(248) does work.

Joined: 09/18/2009
Groups: SETI.Germany

Created a function which can cope with this:

Joined: 06/17/2010
Status: Open » Closed

We can detect ligand in lua to avoid script crash. Closing.


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, Boehringer Ingelheim, RosettaCommons