Function
Main()
'-------- Setting
---------------------------------------------------------------------------------------------------------------------
Window_Size=30 'Length of partial test sequence
Step_Size=9 'Interval between partial test
sequences through entire sequence
'------------------------------------------------------------------------------------------------------------------------------------------
SourceSeq=AppService.Workspace_Value
If
SourceSeq=""
then
Exit Function
End If
SourceSeq_Length=Len(SourceSeq)
Start_Position=1
End_Position=SourceSeq_Length
Buf_Str=""
'**** Graphics **********************
CustomUI.Define_Canvas
500,200
CustomUI.Form_BringToFront
CustomUI.Clear_Canvas
CustomUI.Form_Caption="mRNA
binding energy profile"
CustomUI.DrawLine
30,95,490,95,"LightGray"
CustomUI.DrawLine
30,10,30,180,"Black"
CustomUI.DrawLine
30,180,490,180,"Black"
CustomUI.DrawString
330,160,"G: Gibbs energy (kcal/mol/nt)","Blue"
CustomUI.DrawString
15,85,"G","Blue"
CustomUI.DrawString
250,180,"Location","Red"
CustomUI.DrawString
15,10,"0","Blue"
CustomUI.DrawString
1,170,"-0.5","Blue"
CustomUI.Set_ForeColor_byName
"Black"
'*** Calculate mRNA Gibbs free energy
************************************************
For
Current_Position=Start_Position to
End_Position
- Window_Size step Step_Size
AppService.InstantMsg
"Calculating mRNA structure at " + CStr(Current_Position)
TestSeq=Mid(SourceSeq,Current_Position,Window_Size)
TestSeq_Length=Len(TestSeq)
Call
mRNApredict.Calculate(TestSeq,True)
GibbsEnergy=mRNApredict.GibbsFreeEnergy()
X2=(Current_Position-Start_Position )/SourceSeq_Length*480+30
Y2=(-GibbsEnergy/TestSeq_Length)*170/0.5+10
If
Current_Position>Start_Position
Then
CustomUI.DrawLine
X1,Y1,X2,Y2
CustomUI.DrawRectangle
X2-1,Y2-1,2,2
CustomUI.Update_Canvas
End
If
X1=X2
Y1=Y2
Buf_Str=Buf_Str + CStr(Current_Position) +
Chr(9) + CStr(GibbsEnergy/TestSeq_Length) + Chr(13) +
Chr(10)
Next
CustomUI.RawData=Buf_Str
CustomUI.Make_Clone
End Function |