Foldit Wiki
m (// repaired to more accurate link //)
m (LociOiling moved page Get segment score part to Foldit Lua Function get segment score part: Renamed to use V2 naming convention.)
 
(4 intermediate revisions by 4 users not shown)
Line 1: Line 1:
'''number get_segment_score_part(string score_part, integer segment_index_1[, ..., integer segment_index_n])'''
+
{{LuaV1FunctionDetail|returns=number|namespace=|functionname=get_segment_score_part|arguments=(string score_part, integer segment_index_1[, ..., integer segment_index_n])|description=Return the current score part of the given segments. More than one segment index may be specified.|newfunctionname=current.GetSegmentEnergySubscore|}}
   
Return the current backbone score of the given segments.  More than one segment index may be specified.
+
More than one segment index may be specified.
   
 
== Example ==
 
== Example ==
   
  +
The recipe [https://fold.it/portal/recipe/1915 print_segment_details] shows an example of using get_segment_score_part to report on a single segment.
[http://fold.it/comm/macro_try?mid=1915 Add to Cookbook!]
 
[[File:Print_segment_details.png|left|frame|Sample Script]]
 
[[File:Print_segment_details_recipe_output.png|left|frame|Recipe Output]]
 
   
  +
function print_segment_details(seg)
== Reference ==
 
  +
attr = {"clashing", "packing", "hiding", "bonding","backbone","sidechain","reference", "disulfides", "other"}
When you call it with a score_part of 'Reference', the number that is returned will be these values:
 
  +
rpt = "segment #" .. seg .. ":\n"
  +
tot = 0
  +
for x=1,9 do
  +
part = get_segment_score_part(attr[x], seg)
  +
tot = tot + part
  +
rpt = rpt .. attr[x] .. " = " .. part .. "\n"
  +
end
  +
rpt = rpt .. "Total = " .. tot .. "\n" ..
  +
"get_segment_score(" .. seg .. ") = " .. get_segment_score(seg) .. "\n\n"
  +
print (rpt)
  +
end
   
  +
-----
-17 C Cysteine Phobic
 
-9 W Tryptophan Phobic
 
-6 F Phenylalanine Phobic
 
-5 Y Tyrosine Phobic
 
-5 H Histidine Philic
 
-2 I Isoleucine Phobic
 
-2 V Valine Phobic
 
-1 A Alanine Phobic
 
0 P Proline Phobic
 
1 G Glycine Phobic
 
1 L Leucine Phobic
 
2 T Threonine Philic
 
3 M Methionine Phobic
 
3 S Serine Philic
 
6 K Lysine Philic
 
6 D Aspartate Philic
 
8 E Glutamate Philic
 
8 N Asparagine Philic
 
9 R Arginine Philic
 
9 Q Glutamine Philic
 
   
  +
print_segment_details(18)
==REFERENCES==
 
  +
See also [[Score]]
 
  +
The results look something like this:
  +
 
[[File:Print_segment_details_recipe_output.png|left|frame|Recipe Output]]
  +
[[Category:Script tutorial]]

Latest revision as of 18:54, 24 March 2017

get_segment_score_part[]

Function
number get_segment_score_part(string score_part, integer segment_index_1[, ..., integer segment_index_n])
Description
Return the current score part of the given segments. More than one segment index may be specified.
V2 Function Name
current.GetSegmentEnergySubscore

More than one segment index may be specified.

Example[]

The recipe print_segment_details shows an example of using get_segment_score_part to report on a single segment.

function print_segment_details(seg) 
  attr = {"clashing", "packing", "hiding", "bonding","backbone","sidechain","reference", "disulfides", "other"}
  rpt = "segment #" .. seg .. ":\n"
  tot  = 0
  for x=1,9 do 
    part =  get_segment_score_part(attr[x], seg)
    tot = tot +  part
    rpt = rpt .. attr[x] .. " = " .. part .. "\n"
  end
  rpt  = rpt .. "Total = " .. tot .. "\n" ..
              "get_segment_score(" .. seg .. ") = " .. get_segment_score(seg) .. "\n\n"
 print (rpt)
end
-----
print_segment_details(18)

The results look something like this:

Print segment details recipe output

Recipe Output