This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*Helper code for selecting rows from a CSV file that satisfy certain user-defined selection criteria (the query) | |
The criteria are expressed in a special Groovy Syntax that allows it to be evaluated as a Groovy Map to provide the WHERE CLAUSE components | |
Author: Ioannis K. Moutsatsos | |
*/ | |
/*Example Selection Criteria in Groovy Format. | |
All criteria are used in AND format | |
Basic format is that of a Groovy map. You have to delimit single quotes and string map values | |
The map keys are the names of the file columns that will be tested by a selection criterium | |
The criteria values can be in the format of an List, Range or another Map (see examples and formatting below) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*writes a table like delimited file from Groovy list | |
works with both simple lists and lists of lists | |
author IoannisK. Moutsatsos | |
since Aug-2-2016 | |
*/ | |
/* list of lists */ | |
//theList=[[1,"LoadData"],[2,"IdentifyPrimaryObjects"],[3,"IdentifySecondaryObjects"],[4,"MaskImage"],[5,"CorrectIlluminationCalculate"],[6,"CorrectIlluminationApply"],[7,"IdentifyPrimaryObjects"],[3,"MaskImage"],[3,"CorrectIlluminationCalculate"],[3,"CorrectIlluminationApply"],[3,"IdentifyPrimaryObjects"]] | |
//theList=[['ModuleIndex','ModuleName'],[1,"LoadData"],[2,"IdentifyPrimaryObjects"],[3,"IdentifySecondaryObjects"],[4,"MaskImage"],[5,"CorrectIlluminationCalculate"],[6,"CorrectIlluminationApply"],[7,"IdentifyPrimaryObjects"],[3,"MaskImage"],[3,"CorrectIlluminationCalculate"],[3,"CorrectIlluminationApply"],[3,"IdentifyPrimaryObjects"]] | |
/*a simple list */ | |
theList = ["LoadData", "IdentifyPrimaryObjects", "IdentifySecondaryObjects", "MaskImage", "CorrectIlluminationCalculate", "CorrectIlluminationApply", "IdentifyPrimaryObjects", "MaskIma |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* A groovy example for inferring data types of elements in an ArrayList | |
* Perhaps useful for when analyzing values to be create column in database | |
* by IKM-July 29, 2016 | |
*/ | |
a=[2.345, 3.2, 4.1, 2.23] | |
c=[1,23,33,23,34] | |
d=['text','read',2,45,'how',10,234.45] | |
println "a-contains:, ${a.collect{it.getClass().simpleName}.unique()}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Required Parameters | |
vDestination: folder where files are copied | |
VPropFilePath:CSV file path | |
vArtifactCol: CSV file column (index-1) where file path value is located | |
vArtifactPath: null for auto-discovery from full path, or a standard path where file artifacts are found | |
*/ | |
//collect environment variables that may be useful for path expansion | |
def env = System.getenv() | |
def JENKINS_URL=env['JENKINS_URL'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Groovy script adds a CSV header to headless CSV files in a parent folder | |
CSV files with header are saved as originalName_h.csv | |
*/ | |
//The CSV header to be added | |
def headerPath = 'D:/mydata/data/header.csv' | |
def header = new File(headerPath) | |
assert header.exists() | |
def parentPath = 'D:/workspace/MySQLout' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Wells in assay plates are frequently labelled with alphanumeric identifiers (A04, E11 etc) | |
Script assign row/columns numbers to alphanumeric Well IDs | |
Note that the column is returned as a formatted String | |
*/ | |
rowIds='A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,AA,AB,AC,AD,AE,AF'.tokenize(',') | |
columnIds=(1..48) | |
plate=GroovyCollections.combinations(rowIds,columnIds.collect{String.format('%02d',it)}) | |
assert plate.size()==1536 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Script example for querying the Jenkins PluginManager for plugin names | |
Requires the class name of the plugin, typically found in the appropriate step of the configuration file | |
*/ | |
import jenkins.model.Jenkins; | |
import hudson.PluginWrapper; | |
Jenkins instance = Jenkins.getInstance(); | |
uc= instance.getPluginManager().whichPlugin(org.biouno.unochoice.model.ScriptlerScript); | |
println uc.getLongName() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Creates a CSV table from properties formatted by the following convention | |
prefixID.CSV_Column.Value=ObjId01,ObjId02,....,ObjId0n | |
Semantics of this format are that each object has a unique 'ObjId' and a 'Value' for the column header 'CSV_Column' | |
You would somehow first group the properties by the identifying prefix | |
In this example the | |
property prefixId: 'metadata.plate' | |
Header CSV_Column: ['fixation','probe','cell_line'] | |
fixation.Value:['PFA','methanol','none'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hudson.model.* | |
// get current thread / Executor | |
def thr = Thread.currentThread() | |
// get current build | |
def build = thr?.executable | |
// get job 'file-type' parameter named 'My_file | |
def resolver = build.buildVariableResolver | |
my_file=resolver.resolve("My_file") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import jenkins.* | |
import jenkins.model.* | |
import hudson.* | |
import hudson.model.* | |
import org.kohsuke.stapler.Stapler | |
import groovy.text.SimpleTemplateEngine | |
def sessionID= Stapler.getCurrentRequest().getSession().getId() | |
instance = Jenkins.getInstance() | |
globalNodeProperties = instance.getGlobalNodeProperties() |
OlderNewer