# NOT RUN {
# THE CODE IN THIS EXAMPLE IS THE SAME AS THAT USED IN THE TUTORIAL, AND
# THUS YOU NEED TO DOWNLOAD THE TUTORIAL DATA SET AND SET FILEPATH
# CORRECTLY TO RUN THIS
##---- Firstly, declare the parameters required for the four functions ----
### FIRST DECLARE THE PARAMETERS REQUIRED FOR THIS ANALYSIS:
# A: THE ROOT FILE PATH. EITHER WHERE THE SIMULATION RESPONSES ARE, OR
# WHERE A CSV FILE SUMMARISING THESE RESPONSES IS LOCATED
FILEPATH<-"/home/kieran/Downloads/OAT/RANGE/"
# B: EITHER (i) THE NAME OF THE FILE CONTAINING ALL THE SIMULATION OUTPUT
# OR (ii) THE NAME OF THE FILE THAT WILL BE CREATED TO SUMMARISE SIMULATION
# RESPONSES
CSV_FILE_NAME<-"OAT_Medians.csv"
# C: THE SIMULATION PARAMETERS BEING EXPLORED
PARAMETERS<-c("chemoLowerLinearAdjust","chemoUpperLinearAdjust")
# E: PARAMETER VALUE INFORMATION
# YOU CAN SPECIFY THIS IN TWO WAYS: (i) THE MINIMUM AND MAXIMUM OF EACH
# PARAMETER, AND THE INCREMENT OVER WHICH THE SAMPLING WAS INCREASED
# (ii) A STRING LIST OF VALUES THAT PARAMETER WAS ASSIGNED IN SIMULATION
# EXAMPLE OF (i):
PMIN<-c(0.015,0.10)
PMAX<-c(0.08,0.50)
PINC<-c(0.005,0.05)
PARAMVALS<-NULL
# EXAMPLE OF (ii)
#PARAMVALS<-c("0.015,0.02,0.025,0.03,0.035,0.04,0.045,0.05,0.055,0.06,0.065,0.07,0.075,0.08",
# "0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.45,0.5")
# PMIN<NULL; PMAX<-NULL; PINC<-NULL
# F: BASELINE VALUES FOR ALL PARAMETERS (CALIBRATION VALUES)
BASELINE<-c(0.04,0.2)
# G: SIMULATION OUTPUT MEASURES
MEASURES<-c("Velocity","Displacement")
# H: NAME TO GIVE THE CSV FILE CONTAINING THE ATEST RESULTS FOR
# ROBUSTNESS ANALYSIS
ATESTRESULTFILENAME<-"OAT_ATestScores.csv"
# I: A-TEST RESULT VALUE EITHER SIDE OF 0.5 AT WHICH THE DIFFERENCE BETWEEN
#TWO SETS OF RESULTS IS SIGNIFICANT
ATESTSIGLEVEL<-0.21
# J: IF USING SPARTAN TO PROCESS THE RESULTS FROM REPLICATE RUNS, IN THE SET
# FOLDER STRUCTURE DESCRIBED IN THE TUTORIAL PAPER, ENTER THE NUMBER OF
# REPLICATE RUNS PERFORMED FOR EACH PARAMETER CONDITION
NUMRUNSPERSAMPLE<-300
# K: AGAIN IF PROCESSING INDIVIDUAL RUN RESULTS, NOT A FILE SUMMARISING SIM
# BEHAVIOUR, ENTER THE SIMULATION RESULT FILE NAME
RESULTFILENAME<-"trackedCells_Close.csv"
# L: USEFUL IN CASES WHERE TWO RESULT FILES MAY EXIST, AND WHERE A SECOND IS
# PROCESSED
# IF THERE ARE NO RESPONSES IN THE FIRST
ALTERNATIVEFILENAME<-NULL
# M: USE THIS IF SIM RESULTS ARE IN CSV FORMAT (ALSO ACCEPTS XML)
# THE COLUMN WITHIN THE CSV RESULTS FILE WHERE OUTPUT RESPONSES START. USEFUL
# AS IT RESTRICTS WHAT IS READ INTO R, GETTING AROUND POTENTIAL ERRORS WHERE
# THE FIRST COLUMN DUPLICATES
OUTPUTCOLSTART<-10
# N: COLUMN WHERE OUTPUT RESPONSES END
OUTPUTCOLEND<-11
# O: USED WHERE A SIMULATION IS BEING ANALYSED AT MULTIPLE TIMEPOINTS. THIS IS
# AN ADDENDUM TO OUR R JOURNAL ARTICLE, AND INSTRUCTIONS TO DO THIS CAN BE
# FOUND ON OUR WEBSITE
TIMEPOINTS<-NULL
TIMEPOINTSCALE<-NULL
# EXAMPLE OF TIMEPOINT STRUCTURE
#TIMEPOINTS<-c(12,36,48,60)
#TIMEPOINTSCALE<-"Hours"
# NOW RUN THE METHODS
# }
# NOT RUN {
# DONTRUN IS SET SO THIS IS NOT EXECUTED WHEN PACKAGE IS COMPILED - BUT THIS
# HAS BEEN TESTED WITH THE TUTORIAL DATA
# A - FOR STOCHASTIC SIMULATIONS IN THE SET FOLDER STRUCTURE, GENERATE THE
# MEDIAN SET FOR EACH SET OF RUNS FOR THE PARAMETER VALUE
oat_processParamSubsets(FILEPATH,PARAMETERS,NUMRUNSPERSAMPLE,MEASURES,
RESULTFILENAME,ALTERNATIVEFILENAME,OUTPUTCOLSTART,OUTPUTCOLEND,
CSV_FILE_NAME,BASELINE,PMIN,PMAX,PINC,PARAMVALS,TIMEPOINTS,TIMEPOINTSCALE)
# B - RUN THE ATEST FOR EACH PARAMETER VALUE, AND EACH PARAMETER
# USES EITHER THE CSV FILE GENERATED IN THE METHOD ABOVE OR ONE THAT IS
# SUPPLIED
oat_csv_result_file_analysis(FILEPATH,CSV_FILE_NAME,PARAMETERS,BASELINE,
MEASURES,ATESTRESULTFILENAME,PMIN,PMAX,PINC,PARAMVALS,
TIMEPOINTS,TIMEPOINTSCALE)
# C - GRAPH THE RESULTS FOR ALL MEASURES FOR EACH PARAMETER
oat_graphATestsForSampleSize(FILEPATH,PARAMETERS,MEASURES,ATESTSIGLEVEL,
ATESTRESULTFILENAME,BASELINE,PMIN,PMAX,PINC,PARAMVALS,TIMEPOINTS,
TIMEPOINTSCALE)
# D - GRAPH THE DISTRIBUTION OF THE RESULTS FOR THIS MEASURE, FOR
# THIS PARAMETER
oat_plotResultDistribution(FILEPATH,PARAMETERS,MEASURES,MEASURE_SCALE,
CSV_FILE_NAME,BASELINE,PMIN,PMAX,PINC,PARAMVALS,TIMEPOINTS,
TIMEPOINTSCALE)
# E - COUNT THE NUMBER OF TIMES A PARAMETER (SUCH AS vcamSlope
# PRODUCES AN OUTPUT RESPONSE OF 0 FOR AREA
oat_countResponsesOfDesiredValue(FILEPATH,PARAMETERS,RESULTFILENAME,
OUTPUTCOLSTART,OUTPUTCOLEND,"vcamSlope",NUMRUNSPERSAMPLE,"Area",
0,OUTPUTFILENAME,BASELINE,PMIN,PMAX,PINC,PARAMVALS,TIMEPOINTS,
TIMEPOINTSCALE)
# IF ANALYSING A SIMULATION OF A NUMBER OF TIMEPOINTS, EACH IN A
# SEPARATE RESULT FILE. USE THIS FUNCTION TO PLOT THE A-TESTS FOR
# EACH PARAMETER VALUE OVER TIME
plotATestsFromTimepointFiles(FILEPATH,PARAMETERS,ATESTRESULTFILENAME,
ATESTSIGLEVEL,MEASURES,PMIN,PMAX,PINC,TIMEPOINTS)
# Similar function, dealing with multiple timepoint files
oat_graph_Leish_ATestsMultipleTimepoints(FILEPATH,PARAMETERS,MEASURES,
PMIN,PMAX,PINC,PARAMVALS,BASELINE,ATESTRESULTFILENAME,
ATESTSIGLEVEL,TIMEPOINTS)
# }
Run the code above in your browser using DataLab