Icon representing a recipe

Recipe: seg_tot_not_tot v1.0

created by brgreening

Profile


Name
seg_tot_not_tot v1.0
ID
49744
Shared with
Public
Parent
seg_tot_not_tot
Children
None
Created on
August 05, 2014 at 04:26 AM UTC
Updated on
August 05, 2014 at 04:26 AM UTC
Description

This shows that the sum of the segment energies is not equal to the energy for the whole protein. It checks the segment energy and the total of the segment sub-energies too.

Best for


Code


--[[ seg_tot_not_tot v1.0 Segment total energy is not equal to the total energy. This shows that the sum of the segment energies + 8000.00 is not equal to the score for the whole protein. pvc78 suggested that we should check that sum of the segment energy subscores is equal to the segment energy score. LociOiling wrote code for getting segment subscore values. https://fold.it/portal/node/998138 Susumi's comment about scores The game starts each puzzle with a flat number of points for free, just to make the game more fun. In most puzzles this flat bonus is 8000 points; this allows us to try for scores in the 8000-12000 range, which are simply more fun to play for than scores in the 0-4000 range. In 933b it appears they increased this flat bonus to compensate for the filter loss and ensure that our scores would be higher than in 933. This prevents problems with evolvers having to make up the difference when a replacement puzzle scores lower than its original. ]]-- -- code for reading segment subscore by LociOilling starts here psn_table = {} -- Puzzle Subscore Names ps_table = {} -- Puzzle Subscores psn_table = puzzle.GetPuzzleSubscoreNames() for ix = 1, #psn_table do print( psn_table[ix] ) ps_table[ ix ] = 0.0 end --[[ aa_ltr_tab = { 'a', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'y' } aa_abrv_tab = { 'Ala', 'Cys', 'Asp', 'Glu', 'Phe', 'Gly', 'His', 'Ile', 'Lys', 'Leu', 'Met', 'Asn', 'Pro', 'Gln', 'Arg', 'Ser', 'Thr', 'Val', 'Trp', 'Tyr' } --]] aa_table = {} aa_table['a'] = { 'Ala' } aa_table['c'] = { 'Cys' } aa_table['d'] = { 'Asp' } aa_table['e'] = { 'Glu' } aa_table['f'] = { 'Phe' } aa_table['g'] = { 'Gly' } aa_table['h'] = { 'His' } aa_table['i'] = { 'Ile' } aa_table['k'] = { 'Lys' } aa_table['l'] = { 'Leu' } aa_table['m'] = { 'Met' } aa_table['n'] = { 'Asn' } aa_table['p'] = { 'Pro' } aa_table['q'] = { 'Gln' } aa_table['r'] = { 'Arg' } aa_table['s'] = { 'Ser' } aa_table['t'] = { 'Thr' } aa_table['v'] = { 'Val' } aa_table['w'] = { 'Trp' } aa_table['y'] = { 'Tyr' } -- aa_count = structure.GetCount() -- number of amino acids in the protein function CheckSubscores( p_ix ) aa_ltr = structure.GetAminoAcid( p_ix ) --for aa_ix = 1, 20 do -- if aa_ltr == aa_ltr_tab[ aa_ix ] then -- aa_abrv = aa_abrv_tab[ aa_ix ] -- end --end aa_abrv = aa_table[ aa_ltr ][ 1 ] seg_energy = current.GetSegmentEnergyScore( p_ix ) print( p_ix, aa_ltr, aa_abrv, seg_energy ) tot_sub_energy = 0.0 for iy = 1,#psn_table do ls = string.lower( psn_table[ iy ] ) ses = current.GetSegmentEnergySubscore( p_ix, ls ) tot_sub_energy = tot_sub_energy + ses --if ses ~= 0 then -- print( " ", string.format( "%-12s", ls ), string.format( " %18.8f", ses ) ) --end ps_table[ iy ] = ps_table[ iy ] + ses end if math.abs( tot_sub_energy - seg_energy ) > 0.0000001 then -- print( " segment energy equals total of segment subenergies ", tot_sub_energy ) -- else print( " ***** segment energy does not equal total of segment subenergies ", tot_sub_energy ) end --print( " " ) end -- end of code for getting segment subscore energy values by LociOilling segCnt = structure.GetCount() while structure.GetSecondaryStructure(segCnt)=="M" do segCnt=segCnt-1 end exp_mult = current.GetExplorationMultiplier() print( " Exploration Multiplier: ", exp_mult ) normal = ( exp_mult == 0.0 ) if normal then print( " normal is true " ) else print( " normal is false " ) end print( " Score: ", current.GetScore() ) print( " Energy Score: ", current.GetEnergyScore() ) function basic_info() print( "Puzzle name: ", puzzle.GetName() ) print( "Amino Acid Count: ", segCnt ) print( "Score: ", current.GetEnergyScore() ) print( "Lua version: ", _VERSION ) print( "User: ", user.GetPlayerName() ) print( "Group: ", user.GetGroupName() ) print( "Local Date Time: ", os.date("%c") ) print( "UTC Time: ", os.date("!%Y-%m-%d %X UTC ") ) -- outputs UTC print( " " ) end function seg_tot_not_tot() total_seg_energy = 0.0 for p_ix = 1, segCnt do seg_energy = current.GetSegmentEnergyScore( p_ix ) total_seg_energy = total_seg_energy + seg_energy --print( " Segment Energy: ", p_ix, seg_energy ) CheckSubscores( p_ix ) end print( " Total of Segment Energies: ", total_seg_energy ) total_seg_energy = total_seg_energy + 8000.00 print( " Total Seg Energies + 8000.00: ", total_seg_energy ) energy_score = current.GetEnergyScore() print( " Total Score: ", energy_score, " difference ", energy_score - total_seg_energy ) end print( "This shows that the sum of the" ) print( "segment scores + 8000.00 is not equal to" ) print( "the energy score for the whole" ) print( "protein. This was run under " ) print( " 20140707-373183ff75-win_x86 " ) basic_info() seg_tot_not_tot() ps_tot = 0.0 for iy = 1, #psn_table do if ps_table[ iy ] ~= 0.0 then print( psn_table[ iy ], ps_table[ iy ] ) ps_tot = ps_tot + ps_table[ iy ] end end print( "total of sub energies: ", ps_tot )

Comments