Icon representing a recipe

Recipe: print protein lua2 V0

created by marie_s

Profile


Name
print protein lua2 V0
ID
31098
Shared with
Public
Parent
None
Children
Created on
August 15, 2011 at 09:05 AM UTC
Updated on
August 15, 2011 at 09:05 AM UTC
Description

all info on the protein

Best for


Code


--- info on the protein - concatenation of recipes , part of recipes or function by Tlaloc, spvincent, seagate, John McLeod, Crashguard303,Gary Forbis and authors on wiki ---- option for comma for delimitation of decimal number put y if your decimal point is not a point comma='y' if comma =='y' then separ=";" else separ="," end ----- count of segment, search of ligand function GetSeCount () segCount = structure.GetCount() isLigand =(structure.GetSecondaryStructure(segCount) == 'M') -- ligands have ss of 'M' if isLigand then print ('this puzzle is a ligand puzzle') segCount = segCount - 1 end -- of isligand return segCount end -- of function GetSegCount --- segments table without ligand function tablesegment() table={{}} -- residues with -- in front (commented) are not in Foldit (as of Nov 15, 2010) aminosLetterIndex=1 aminosShortIndex=2 aminosLongIndex=3 aminosPolarityIndex=4 aminosAcidityIndex=5 aminosHydropathyIndex=6 amino = { {'a','Ala','Alanine', 'nonpolar','neutral', 1.8}, -- {'b','Asx','Asparagine or Aspartic acid' }, {'c','Cys','Cysteine', 'nonpolar','neutral', 2.5}, {'d','Asp','Aspartic acid', 'polar','negative', -3.5}, {'e','Glu','Glutamic acid', 'polar','negative', -3.5}, {'f','Phe','Phenylalanine','nonpolar','neutral', 2.8}, {'g','Gly','Glycine', 'nonpolar','neutral', -0.4}, {'h','His','Histidine', 'polar','neutral', -3.2}, {'i','Ile','Isoleucine', 'nonpolar','neutral', 4.5}, -- {'j','Xle','Leucine or Isoleucine' }, {'k','Lys','Lysine', 'polar','positive', -3.9}, {'l','Leu','Leucine', 'nonpolar','neutral', 3.8}, {'m','Met','Methionine ', 'nonpolar','neutral', 1.9}, {'n','Asn','Asparagine', 'polar','neutral', -3.5}, -- {'o','Pyl','Pyrrolysine' }, {'p','Pro','Proline', 'nonpolar','neutral', -1.6}, {'q','Gln','Glutamine', 'polar','neutral', -3.5}, {'r','Arg','Arginine', 'polar','positive', -4.5}, {'s','Ser','Serine', 'polar','neutral', -0.8}, {'t','Thr','Threonine', 'polar','neutral', -0.7}, -- {'u','Sec','Selenocysteine' }, {'v','Val','Valine', 'nonpolar','neutral', 4.2}, {'w','Trp','Tryptophan', 'nonpolar','neutral', -0.9}, -- {'x','Xaa','Unspecified or unknown amino acid' }, {'y','Tyr','Tyrosine', 'polar','neutral', -1.3}, -- {'z','Glx','Glutamine or glutamic acid' } } for i = 1, segCount do table[i]={} table[i][1]=structure.GetAminoAcid(i) for j = 1, 20 do if ( table[i][1]== amino[j][1] ) then table[i][2]=amino[j][2] table[i][3]=amino[j][3] table[i][4]=amino[j][6] end -- of if amino end -- of loop onj table[i][5]=structure.GetSecondaryStructure(i) end -- of loop on i return table end -- function tablesegment -- tlaloc functions to print sequence of letter function BuildSequence(table) string = '' hydrostring='' strucstring='' for i=1, segCount do string = string..table[i][1] if structure.IsHydrophobic(i) then hydrostring=hydrostring..'i' else hydrostring=hydrostring..'e' end strucstring=strucstring..table[i][5] end -- of loop on i print('sequence with 1 letter by amino for searching in PDB') print(string) print('sequence with i if hydrophobic') print(hydrostring) print('sequence of structure') print(strucstring) end --function build sequence ---- find mutable segments function FindMutable(table) print("Finding Mutable Segments") local mutable={} mutablestring='' local i for i=1,segCount do if structure.IsMutable(i) == true -- find the mutble segments then mutable[#mutable + 1] = i end -- of if mutable end -- of loop on i print(#mutable," mutables found") for mut=1 ,#mutable do print (mut,separ,mutable[mut],separ, table[mutable[mut]][1], separ,table[mutable[mut]][3]) mutablestring=mutablestring.."'"..table[mutable[mut]][1].."'," end -- on loopon mut print(mutablestring) --- for copy paste on other recipe end --function finf mutable -- function print score by spvincent --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. kNoTrunc = false function t3 ( x ) -- Truncates a value to 3 decimal places unless kNoTrunc is set to true. Easier to read. if ( kNoTrunc == true ) then return x else if comma=="y" then x=1000*x return x - x% 1 else return x - x % 0.001 end -- on test on comma end -- of test on trunc end -- of function t3 function score(table) print ( "n" , separ , "ID" , separ, "SS" , separ , "Hyd",separ, "score" , separ , "backbone" , separ, "hiding" , separ , "packing" , separ , "bonding" , separ , "clashing" , separ , "sidechain" , separ, "reference" ) for i = 1 , segCount do print ( i , separ , table[i][1] , separ , table[i][5] , separ , t3(table[i][4] ), separ , t3 ( current.GetSegmentEnergyScore ( i ) ) , separ , t3 ( current.GetSegmentEnergySubscore ( i,"backbone" ) ) , separ , t3 ( current.GetSegmentEnergySubscore (i, "hiding" ) ) , separ, t3 ( current.GetSegmentEnergySubscore ( i,"packing") ) , separ, t3 ( current.GetSegmentEnergySubscore ( i,"bonding" ) ) , separ , t3 ( current.GetSegmentEnergySubscore (i, "clashing" ) ) , separ , t3 ( current.GetSegmentEnergySubscore (i, "sidechain" ) ) , separ , t3 ( current.GetSegmentEnergySubscore ( i,"reference" ) ) ) end -- of loop on i end --- of function score -- Table PuzzleStructsTab from Report on Structures, by John McLeod function fstructure() PuzzleStructsTab = {} -- consecutive elements are of the form { start_seg, end_seg, structure_code } local PuzzleStructs_start_ind = 1 local PuzzleStructs_end_ind = 2 local PuzzleStructs_ss_ind = 3 PuzzleStructs_num_structs = 0 local current_struct = '' local current_start_seg = 0 local current_struct_ind = 0 current_struct = structure.GetSecondaryStructure(1) current_struct_ind = 1 current_start_seg = 1 PuzzleStructsTab[current_struct_ind] = {} PuzzleStructsTab[current_struct_ind][PuzzleStructs_start_ind] = current_start_seg PuzzleStructsTab[current_struct_ind][PuzzleStructs_ss_ind] = current_struct for x=2, segCount do if structure.GetSecondaryStructure(x) ~= current_struct then current_struct = structure.GetSecondaryStructure(x) current_struct_ind = current_struct_ind + 1 current_start_seg = x PuzzleStructsTab[current_struct_ind] = {} PuzzleStructsTab[current_struct_ind][PuzzleStructs_start_ind] = current_start_seg PuzzleStructsTab[current_struct_ind][PuzzleStructs_ss_ind] = current_struct PuzzleStructsTab[current_struct_ind - 1][PuzzleStructs_end_ind] = x - 1 end --if end struc end--for x PuzzleStructsTab[current_struct_ind][PuzzleStructs_end_ind] = segCount PuzzleStructs_num_structs = current_struct_ind return PuzzleStructsTab, PuzzleStructs_num_structs end -- constructor for PuzzleStructsTab ---- function to print a litle contact table , has to be tested on the next free design puzzle function contact() head=separ..separ first=1 for s=1 ,PuzzleStructs_num_structs do if PuzzleStructsTab[s][3] =='H' or PuzzleStructsTab[s][3] == 'E' then string=PuzzleStructsTab[s][3]..separ..PuzzleStructsTab[s][1]..separ..PuzzleStructsTab[s][2] for s2=2,PuzzleStructs_num_structs do if PuzzleStructsTab[s2][3] == 'H' or PuzzleStructsTab[s2][3] == 'E' then if first then head=head..separ..PuzzleStructsTab[s2][3] end mean= 0 nb=0 for i= PuzzleStructsTab[s][1],PuzzleStructsTab[s][2] do min=999999 for j=PuzzleStructsTab[s2][1],PuzzleStructsTab[s2][2] do dist=structure.GetDistance(i,j) if dist<min then min=dist end end --j mean= mean+min nb=nb+1 end --i mean=mean/nb if structure.GetDistance(PuzzleStructsTab[s][1],PuzzleStructsTab[s2][2] ) < structure.GetDistance(PuzzleStructsTab[s][1],PuzzleStructsTab[s2][1] ) then if mean< 5 then c='X' else if mean<10 then c='x' else c=' ' end end else if mean< 5 then c='O' else if mean<10 then c='o' else c=' ' end end end string=string..separ..c end--if end --s2 if first==1 then print ('mini contact table') print(head) first=0 end print(string) end --- if end -- s1 end -- function ----- count of segment and search of ligand GetSeCount () print('number of segments : ',segCount) tablesegment() ------ sequence of letters, hydrophobes, structures BuildSequence(table) ----- find mutable segments and print them FindMutable(table) ------ score of segments score(table) --- table des structures fstructure() -- mini contact table contact() --- end of recipe

Comments


marie_s Lv 1

parts can be useful on other recipe like find mutable.

Concatenation of recipes by spvincent, Ttaloc, Seagat, John McLeod, Crashguard303,Gary Forbis and authors on wiki