Icon representing a recipe

Recipe: Print Scores V2

created by spvincent

Profile


Name
Print Scores V2
ID
37869
Shared with
Public
Parent
None
Children
None
Created on
January 24, 2012 at 22:59 PM UTC
Updated on
January 24, 2012 at 22:59 PM UTC
Description

V2 version of utility script to print out score components. See top of script for intended use.

Best for


Code


-- Intended use. -- -- 1) Run -- 2) Open the script log (scriptlog.default.xml) in a text editor -- 3) Strip off the start and end lines and save it as a text file with another name. -- 4) Import that into Excel as a comma-delimited text file. -- 5) Peruse, sort, compare against other solutions imported into a different sheet etc. single_letter_codes = { "g","a","v","l","i","m","f","w","p","s","t","c","y","n","q","d","e","k","r","h"} three_letter_codes = { "Gly","Ala","Val","Leu","Ile","Met","Phe","Trp","Pro","Ser","Thr","Cys","Tyr","Asn","Gln","Asp","Glu","Lys","Arg","His"} function r3 ( x ) -- Round to 3 decimal places t = 10 ^ 3 return math.floor ( x * t + 0.5 ) / t end function get_aa3 ( i ) k = structure.GetAminoAcid ( i ) for j = 1, 20 do if ( k == single_letter_codes [ j ] ) then return three_letter_codes [ j ] end end return "Unk" end function get_backbone_angle ( i ) if ( i == 1 or i == n_residues ) then return 180 else -- Cosine rule a = structure.GetDistance ( i - 1 , i ) b = structure.GetDistance ( i , i + 1 ) c = structure.GetDistance ( i - 1 , i + 1 ) cos_angle = ( a*a + b*b - c*c ) / ( 2*a*b ) return math.deg ( math.acos ( cos_angle ) ) end end n_residues = structure.GetCount () print ( "n" .. " , " .. "ID" .. " , " .. "SS" .. " , " .. "score" .. " , " .. "backbone" .. " , " .. "hiding" .. " , " .. "packing" .. " , " .. "bonding" .. " , " .. "clashing" .. " , " .. "sidechain" .. " , " .. "reference" .. " , " .. "backbone angle" ) for i = 1 , n_residues do print ( i .. " , " .. get_aa3 ( i ) .. " , " .. structure.GetSecondaryStructure ( i ) .. " , " .. r3 ( current.GetSegmentEnergyScore ( i ) ) .. " , " .. r3 ( current.GetSegmentEnergySubscore ( i , "backbone" ) ) .. " , " .. r3 ( current.GetSegmentEnergySubscore ( i , "hiding" ) ) .. " , " .. r3 ( current.GetSegmentEnergySubscore ( i, "packing" ) ) .. " , " .. r3 ( current.GetSegmentEnergySubscore ( i , "bonding" ) ) .. " , " .. r3 ( current.GetSegmentEnergySubscore ( i , "clashing" ) ) .. " , " .. r3 ( current.GetSegmentEnergySubscore ( i , "sidechain" ) ) .. " , " .. r3 ( current.GetSegmentEnergySubscore ( i , "reference" ) ) .. " , " .. r3 ( get_backbone_angle ( i ) ) ) end

Comments


dnevill Lv 1

Does exactly what it says, although its a bit bothersome we can't copy text from the recipe output window directly. Is there something in the "os" library you could use to put the output in the clipboard?

One note, if you have multiple threads for your puzzle, the output isn't in Foldit/scriptlog.default.xml, it's in Foldit/scriptlog..xml