Home > Tutorial > 6.Module development > Example 1

Module development

 


Example 1:

Read sequence from the 'Workspace' window, calculate average GC content at the 1st and 3rd places and then show the result in the 'Gene analysis' window

 

1. Click on the 'Module Library' in the 'Tool' menu

2. Choose 'PropBag_Custom'

3. Click on the 'Edit Module' button

4. Check the source code

5. Check on 'Registration' and set Category to be 'Sub'

 

VBScript source code

Function Main()
  Source=AppService.Workspace_Value                                                         '<--- Get sequence from 'Workspace'
  GC_1st=GeneService.Calculate_GC_Content_1st (Source,True)
                   '<--- Calculate GC content at the 1st place

  GC_3rd=GeneService.Calculate_GC_Content_3rd (Source,True)                   '<--- Calculate GC content at the 3rd place
  AvgGC=(GC_1st + GC_3rd)/2                                                                    
'<--- Calculate average value

  PropBag_Custom.Clear                                                                                
'<--- Clear PropertyBag
  ReturnValue=PropBag_Custom.Add_Parameter_StringType("DNA length",Len(Source),"False")

                                                                                                                        '<--- Add new parameter and set the value

  ReturnValue=PropBag_Custom.Add_Parameter_StringType("GC content at 1st and 3rd (%)",AvgGC,"False")

                                                                                                                        '<--- Add new parameter and set the value

End Function

 

5. Click on the 'Refresh' button.

6. Click on the 'Gene analysis' in the 'Window' menu

7. You can see the 'Gene analysis' window

8. Insert any sequence to the 'Workspace'

9. Double click on the 'PropBag_Custom'

10. Check the result