From cf16ca858a57929386fb9365141ace584c3a7e37 Mon Sep 17 00:00:00 2001 From: Marco Del Tufo <marco.deltufo@exact-lab.it> Date: Wed, 2 Aug 2023 14:49:52 +0000 Subject: [PATCH] Update properties-handled-by-scripts.md --- .../properties-handled-by-scripts.md | 40 ++++++++++--------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/docs/user-documentation/general-admin-users/properties-handled-by-scripts.md b/docs/user-documentation/general-admin-users/properties-handled-by-scripts.md index ef28f715bc4..eda47d8a9c5 100644 --- a/docs/user-documentation/general-admin-users/properties-handled-by-scripts.md +++ b/docs/user-documentation/general-admin-users/properties-handled-by-scripts.md @@ -188,30 +188,32 @@ You can test your script on selected entities 2. Calculate a new float value based some other values + ```java - import java.lang.String as String - - def calculateValue(): - nM = 0 - uLDNA = 0 - if entity.propertyValue('CONCENTRATION_PREPARED_ILLUMINA') != '' and \ - entity.propertyValue('FRAGMENT_SIZE_PREPARED_ILLUMINA') != '' : - nM = float(entity.propertyValue('CONCENTRATION_PREPARED_ILLUMINA')) / \ - float(entity.propertyValue('FRAGMENT_SIZE_PREPARED_ILLUMINA')) * \ - 1000000 / 650 - if float(entity.propertyValue('UL_STOCK')) !='' : - uLDNA = float(entity.propertyValue('UL_STOCK')) * 2 / nM - uLEB = float(entity.propertyValue('UL_STOCK')) - uLDNA - return String.format("%16.1f", uLEB) - return 0 - - def calculate(): - """Main script function. The result will be used as the value of appropriate dynamic property.""" - return calculateValue() +import java.lang.String as String + +def calculateValue(): + nM = 0 + uLDNA = 0 + if entity.propertyValue('CONCENTRATION_PREPARED_ILLUMINA') != '' and \ + entity.propertyValue('FRAGMENT_SIZE_PREPARED_ILLUMINA') != '' : + nM = float(entity.propertyValue('CONCENTRATION_PREPARED_ILLUMINA')) / \ + float(entity.propertyValue('FRAGMENT_SIZE_PREPARED_ILLUMINA')) * \ + 1000000 / 650 + if float(entity.propertyValue('UL_STOCK')) !='' : + uLDNA = float(entity.propertyValue('UL_STOCK')) * 2 / nM + uLEB = float(entity.propertyValue('UL_STOCK')) - uLDNA + return String.format("%16.1f", uLEB) + return 0 + +def calculate(): + """Main script function. The result will be used as the value of appropriate dynamic property.""" + return calculateValue() ``` 3. Calculate a time difference between two time stamps: + ```java from datetime import datetime def dateTimeSplitter(openbisDate): -- GitLab