Basic built in functions of Qliphoth - hello31337/BI-SGX GitHub Wiki

As the name "BI-SGX" shows, BI-SGX provides a lot of utility built-in functions mainly for bioinformatic analysis.

List of built-in functions

print

Output some string or content of variable to result file (NOT TO STDOUT). You have to use this function or println to get calculation result from ISV.

arguments

You can combine following 2 types of arguments with ,.

  • string: string to output to result. Currently BI-SGX doesn't support string-type variable, so use this type by directly hard-coding to your code.
  • double: Variable name of double value.

return value

There is no return value with this function.

example

source code

var arg1

arg1 = 9999
print "arg1 is: ", arg1

result returned from ISV

==============================================
--------------------------------------------
Date: 2019/05/05 Sun 02:31:40
--------------------------------------------
arg1 is: 9999
==============================================



println

Output some string or content of variable to result file (NOT TO STDOUT). Different from print, println inserts newline after output designated contexts. You have to use this function or print to get calculation result from ISV.

arguments

You can combine following 2 types of arguments with ,.

  • string: string to output to result. Currently BI-SGX doesn't support string-type variable, so use this type by directly hard-coding to your code.
  • double: Variable name of double value.

return value

There is no return value with this function.

example

source code

var arg1

arg1 = 9999
println "arg1 is: ", arg1

result returned from ISV

==============================================
--------------------------------------------
Date: 2019/05/05 Sun 02:31:40
--------------------------------------------
arg1 is: 9999

==============================================



toint

Truncate after the decimal point of designated double variable.

arguments

  • double: double variable to truncate after the decimal point.

return value

  • double: Truncation result.

example

var dbl1

dbl1 = 12.34567
trc_dbl1 = toint(dbl1)

println trc_dbl1 // "12.0" will be written to the result file.



average

Calculate average of secret in protected which is stored in DB.

arguments

  • string: Dataset name. Designate the name of dataset (which is stored in DB table: BI-SGX->stored_data).

return value

double: Average value of designated dataset.

example

var avg

avg = average("dataset0")
println "average of dataset0 is: ", avg



edist

Calculate edit distance between first string of designated dataset's secret and other designated dataset's secrets. BI-SGX uses bit-parallel method to calculate edit distance; And the code implementation is refer to this code. NOTE: The feature to compute edit distance between researcher's own query string and dataset's secret will be implemented in near future.

arguments

  • string: Dataset name. Designate the name of dataset (which is stored in DB table: BI-SGX->stored_data).

return value

double: Average of edit distance.

example

var ed1

ed1 = edist("dataset0")
println "edit distance's average of dataset0 is: ", ed1



galign

Execute global alignment between first string of designated dataset's secret and other designated dataset's secrets. BI-SGX uses Needleman-Wunsch algorithm for computing global alignment.

arguments

  • string: Dataset name. Designate the name of dataset (which is stored in DB table: BI-SGX->stored_data). Note that the dataset's format must be FASTA.

return value

double: Maximum score from every global alignment computation.

example

var nw_res

nw_res = galign("dataset0")
println "Maximum score of NW is: ", nw_res



inquiryDB

Output the list of dataname and datatype pair in the table stored_data to the result file.

arguments

No arguments are needed. Parentheses for arguments isn’t needed too (i.e. inquiryDB is correct although inquiryDB() is incorrect).

return value

There is no return value with this function.

example

source code

println “TableName-DataType list: ”
inquiryDB

result returned from ISV

==============================================
--------------------------------------------
Date: 2019/07/15 Sun 13:30:04
--------------------------------------------
TableName-DataType list: 
dataset0 -> integer
dataset1 -> genome
dataset2 -> FASTA

==============================================



rand

Generate true random in integer between designated range. RDRAND instruction of Intel CPU is internally used for generating random numbers.

arguments

  • int: Minimum number for RNG. If you designated this argument with double, it will be automatically cast to int. Must be between -2147483647 and 2147483647.
  • int: Maximum number for RNG. If you designated this argument with double, it will be automatically cast to int. Must be between -2147483647 and 2147483647.

If the first argument is larger than the second argument, they will be automatically exchanged.

return value

double: Generated true random number in the range of minimum to maximum.

example

var rnd_res

rnd_res = rand(-40000, 60000)
println "Generated random number: ", rnd_res
⚠️ **GitHub.com Fallback** ⚠️