Icon representing a recipe

Recipe: extract_scores

created by jtwolff

Profile


Name
extract_scores
ID
108530
Shared with
Public
Parent
None
Children
Created on
December 24, 2023 at 01:25 AM UTC
Updated on
December 24, 2023 at 01:25 AM UTC
Description

Get scores, including subscores, for each residue in the model in csv format if you want to perform further analysis. You can find the output in scriptlog.default.xml in your Foldit directory

Best for


Code


-- Get data about scoring per residue in csv format -- author: jtwolff -- Likely not very good lua, but probably is serviceable -- Open the scriptlog.default.log file in your Foldit directory -- after running to gain access to the output. -- Io is disabled in Foldit which is why I resorted to this function round ( x ) return x - x % 0.01 end -- Create array with location, overall score, and subscores subscore_names = puzzle.GetPuzzleSubscoreNames() columns = {"location", "score"} for i = 1, #subscore_names do columns[#columns +1] = subscore_names[i] end headerline = "" for i = 1, #columns do if headerline == "" then headerline = headerline .. columns[i] else headerline = headerline .. "," .. columns[i] end end print(headerline) -- write values numres = structure.GetCount() for i = 1, numres do currline = "" .. tostring(i) local score = current.GetSegmentEnergyScore(i) currline = currline .. "," .. tostring(round(score)) for j = 1, #subscore_names do local subscore = current.GetSegmentEnergySubscore(i, subscore_names[j]) currline = currline .. "," .. tostring(round(subscore)) end print(currline) end

Comments