How to use class
A class can be defined as a reproducible object that is a collection of
modules. Visual Gene Developer has several classes and allows users to
make use of them to develop new modules.
Every class may have a function routine, subroutine, and
property. Function routine is used mainly for a calculation and returns
a result value. In contrast, subroutine doesn't return a value and
property works as a variable whose value is readable or writable. In
spite of different names, their internal algorithms and usages are very
similar. Google websites to get more information!
o Rule
VBScript
Function routine: Other
variable =
Class name.function name
(parameter1, parameter2, ...)
Sub routine :
Call Class name.sub
name (parameter1, parameter2, ...)
Class name.sub name
parameter1, parameter2, ...
Property (reading): Other variable
= Class name.property
name (parameter1, parameter2, ...)
Property (writing):
Class name.property name (parameter1,
parameter2, ...) = Other variable
JScript
Function routine: Other
variable =
Class name.function name
(parameter1, parameter2, ...);
Sub routine :
Call Class name.sub
name (parameter1, parameter2, ...);
Property (reading): Other variable
= Class name.property
name (parameter1, parameter2, ...);
Property (writing):
Class name.property name (parameter1,
parameter2, ...) = Other variable;
Here, parameters can be optional and a user may not distinguish between
'Function routine' and 'Property (reading)'.
o Example
1:
Function
VBScript
Function Main()
Main=GeneConstruct.TableValue(1,1)
End Function |
JScript
function Main() {
return GeneConstruct.TableValue(1,1);
}
|
'GeneConstruct' is a class, and 'TableValue'
is a function. The first parameter is the gene construct index and the
second is the column position. 'TableValue' accesses to the gene construct table on
the 'Gene optimization' window.
o Example 2: Subroutine
VBScript
Function Main()
ReturnValue=mRNApredict.Calculate("GCGGGCGGCGGCTATTGCA",False)
Call mRNApredict.ShowStructure
End Function |
Or
Function Main()
mRNApredict.Calculate
"GCGGGCGGCGGCTATTGCA",False
mRNApredict.ShowStructure
End Function |
JScript
function Main() {
ReturnValue=mRNApredict.Calculate("GCGGGCGGCGGCTATTGCA","False");
mRNApredict.ShowStructure;
} |
'mRNApredict' is a class name, and both 'Calculate' and 'ShowStructure' are
subroutine names. Because 'ShowStructure' doesn't have a parameter, it
doesn't have parenthesis. In the case of 'Calculate', there are two
parameters: source DNA sequence (string type), fast calculation mode
(Boolean type: 'True' or 'False')
o Example
3:
Property
VBScript
Function Main()
TargetGeneConstructIndex=GeneConstruct.CurrentConstructIndex
TargetGeneName=PropBag_Param.Value("Target
Gene Component ID")
PropBag_Param.Value("Modified
DNA")="AGTGACTGACACAGTTCACGTGC"
End Function |
JScript
function Main() {
TargetGeneConstructIndex=GeneConstruct.CurrentConstructIndex;
TargetGeneName=PropBag_Param.Value("Target
Gene Component ID");
PropBag_Param.Value("Modified
DNA")="AGTGACTGACACAGTTCACGTGC";
} |
Both 'GeneConstruct' and 'PropBag_Param' are classes, and 'Value' is a
property. In the case of 'CurrentConstructIndex', it is not clear if it
belongs to function routine or property. However, the name of the module
suggests that it is a property since the name looks like a single
variable.
o Example
4:
Function
VBScript
Function Main()
Main=GeneService.Calculate_CAI("GCGGGCGGCGGCTATTGGCACACGAGCGGCCGGGAGATCCTGGACGC",True)
End Function |
JScript
function Main() {
return GeneService.Calculate_CAI("GCGGGCGGCGGCTATTGGCACACGAGCGGCCGGGAGATCCTGGACGC","True");
} |
'GeneService' is a class, and 'Calculate_CAI' is a function. It has two
parameters: source DNA sequence (type: string) and Bulmer's correction
term (Boolean type: 'True' or 'False').
|