changeset 0:c65c94b47771 draft

"planemo upload for repository https://forgemia.inra.fr/grum/grum/-/tree/master/siwaa_recipe/galaxy_tools commit 5dce511538bebef7453c594f68ea7d13e8fc3ea8"
author siwaa
date Tue, 24 Aug 2021 13:04:11 +0000
parents
children 9c1c1c7f0e48
files default/cow_parameters.json default/goat_parameters.json test-data/inputs/BW_test.csv test-data/inputs/Litter_test.csv test-data/inputs/goat_parameters.json test-data/inputs/singlegoat_BW_test.csv test-data/inputs/singlegoat_Litter_test.csv tools_grum.xml
diffstat 8 files changed, 514 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/default/cow_parameters.json	Tue Aug 24 13:04:11 2021 +0000
@@ -0,0 +1,12 @@
+{
+    "W0": { "low": 20000, "high": 60000},
+    "G0": { "low": 400000, "high": 900000},
+    "kr": { "low": -600, "high": 600},
+    "kUa": { "low": 0.5, "high": 1.0},
+    "kUf": { "low": 0.005, "high": 0.015},
+    "kn": { "low": 0.01, "high": 0.5},
+    "kmd": { "low": 0.0001, "high": 0.01},
+    "kmr_glob": [0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01],
+    "gam_glob": [0.0000035, 281],
+    "kg_glob": 0.002
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/default/goat_parameters.json	Tue Aug 24 13:04:11 2021 +0000
@@ -0,0 +1,12 @@
+{
+    "W0": { "low": 1579.6, "high": 6009.3},
+    "G0": { "low": 74360.3, "high": 148841},
+    "kr": { "low": -120, "high": 100},
+    "kUa": { "low": 0.3, "high": 1.8},
+    "kUf": { "low": 0.01, "high": 0.05},
+    "kn": { "low": 0.02, "high": 0.5},
+    "kmd": { "low": 0.002, "high": 0.02},
+    "kmr_glob": [0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02],
+    "gam_glob": [0.0005, 150.0],
+    "kg_glob": 0.002
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/inputs/BW_test.csv	Tue Aug 24 13:04:11 2021 +0000
@@ -0,0 +1,218 @@
+"id";"age";"bw_rec"
+2004029;0;5440
+2004029;24;9080
+2004029;31;10610
+2004029;38;11550
+2004029;45;12660
+2004029;52;14310
+2004029;66;13910
+2004029;73;14630
+2004029;81;15010
+2004029;87;15780
+2004029;94;16020
+2004029;101;17960
+2004029;108;20340
+2004029;115;19860
+2004029;123;21370
+2004029;129;23030
+2004029;136;23260
+2004029;143;24510
+2004029;150;26700
+2004029;158;27100
+2004029;164;28330
+2004029;165;28300
+2004029;171;27800
+2004029;178;31170
+2004029;185;30770
+2004029;192;31910
+2004029;199;31980
+2004029;206;33830
+2004029;220;34170
+2004029;227;39020
+2004029;237;37010
+2004029;241;36660
+2004029;248;37150
+2004029;255;38140
+2004029;262;36450
+2004029;269;39020
+2004029;276;37220
+2004029;283;39900
+2004029;290;41230
+2004029;297;40680
+2004029;304;40530
+2004029;311;41460
+2004029;318;42150
+2004029;325;42370
+2004029;331;45380
+2004029;339;46430
+2004029;346;46680
+2004029;353;47250
+2004029;360;49430
+2004029;367;51030
+2004029;374;52310
+2004029;381;56000
+2004029;388;58170
+2004029;395;58690
+2004029;402;61580
+2004029;409;65430
+2004029;416;68260
+2004029;424;69470
+2004029;428;57520
+2004029;437;56200
+2004029;444;54980
+2004029;451;53930
+2004029;458;54290
+2004029;465;54260
+2004029;473;53590
+2004029;479;51830
+2004029;486;51620
+2004029;493;52200
+2004029;500;54080
+2004029;507;52600
+2004029;514;51720
+2004029;521;52480
+2004029;528;51530
+2004029;535;53250
+2004029;542;52460
+2004029;549;54200
+2004029;556;53390
+2004029;563;56620
+2004029;570;55920
+2004029;577;55570
+2004029;584;56340
+2004029;591;55810
+2004029;597;57990
+2004029;605;55970
+2004029;612;57230
+2004029;618;55270
+2004029;626;59190
+2004029;633;59430
+2004029;640;59750
+2004029;648;58880
+2004029;654;59800
+2004029;662;65330
+2004029;667;64500
+2004029;675;61380
+2004029;682;67210
+2004029;689;67040
+2004029;695;68300
+2004029;703;73800
+2004029;710;76690
+2004029;717;79660
+2004029;724;81880
+2004029;731;86380
+2004029;733;86250
+2004029;734;64490
+2004029;738;65250
+2004029;745;60790
+2004029;752;52910
+2004029;759;57200
+2005115;0;4066
+2005115;6;3714
+2005115;13;5410
+2005115;20;6330
+2005115;27;7320
+2005115;34;9430
+2005115;41;10530
+2005115;49;11760
+2005115;56;12910
+2005115;62;14650
+2005115;69;15430
+2005115;76;16240
+2005115;83;17710
+2005115;90;18350
+2005115;97;19400
+2005115;104;20350
+2005115;111;20890
+2005115;118;22080
+2005115;125;23830
+2005115;132;25020
+2005115;139;25490
+2005115;146;27520
+2005115;153;28980
+2005115;160;30130
+2005115;167;28180
+2005115;174;28610
+2005115;181;31560
+2005115;188;31750
+2005115;195;32960
+2005115;202;32950
+2005115;209;35690
+2005115;216;35860
+2005115;222;36570
+2005115;230;37420
+2005115;237;38890
+2005115;243;39790
+2005115;251;40170
+2005115;258;39110
+2005115;265;39180
+2005115;273;40460
+2005115;279;39770
+2005115;287;41520
+2005115;292;42010
+2005115;300;43490
+2005115;307;45420
+2005115;314;47560
+2005115;320;48060
+2005115;328;49030
+2005115;335;50750
+2005115;342;51660
+2005115;349;54870
+2005115;356;57180
+2005115;363;59920
+2005115;370;59990
+2005115;377;62660
+2005115;383;62660
+2005115;384;54790
+2005115;391;50570
+2005115;398;51080
+2005115;405;51600
+2005115;412;52170
+2005115;419;53620
+2005115;425;54560
+2005115;433;53580
+2005115;440;54720
+2005115;447;54710
+2005115;454;55800
+2005115;461;55230
+2005115;468;55720
+2005115;475;54890
+2005115;482;58130
+2005115;489;56410
+2005115;496;57030
+2005115;503;56830
+2005115;510;58520
+2005115;517;56750
+2005115;524;56960
+2005115;530;55010
+2005115;538;55260
+2005115;545;56590
+2005115;552;54600
+2005115;559;56210
+2005115;566;56960
+2005115;572;59260
+2005115;580;57780
+2005115;587;57990
+2005115;593;58430
+2005115;600;59430
+2005115;607;59670
+2005115;614;58680
+2005115;622;57650
+2005115;629;59520
+2005115;635;62390
+2005115;643;62090
+2005115;650;63170
+2005115;657;64770
+2005115;664;64620
+2005115;671;65440
+2005115;678;66820
+2005115;685;68630
+2005115;692;68610
+2005115;698;70750
+2005115;706;73700
+2005115;713;76200
+2005115;720;80190
+2005115;727;80010
+2005115;733;65680
+2005115;741;64090
+2005115;748;62530
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/inputs/Litter_test.csv	Tue Aug 24 13:04:11 2021 +0000
@@ -0,0 +1,6 @@
+"id";"id_partnb";"age_part";"bw_litter"
+2004029;"2004029_1";427;5078
+2004029;"2004029_2";733;12524
+2005115;"2005115_1";383;6500
+2005115;"2005115_2";727;9400
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/inputs/goat_parameters.json	Tue Aug 24 13:04:11 2021 +0000
@@ -0,0 +1,12 @@
+{
+    "W0": { "low": 1579.6, "high": 6009.3},
+    "G0": { "low": 74360.3, "high": 148841}, 
+    "kr": { "low": -120, "high": 100}, 
+    "kUa": { "low": 0.3, "high": 1.8}, 
+    "kUf": { "low": 0.01, "high": 0.05}, 
+    "kn": { "low": 0.02, "high": 0.5}, 
+    "kmd": { "low": 0.002, "high": 0.02}, 
+    "kmr_glob": [0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02],
+    "gam_glob": [0.0005, 150.0],
+    "kg_glob": 0.002
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/inputs/singlegoat_BW_test.csv	Tue Aug 24 13:04:11 2021 +0000
@@ -0,0 +1,109 @@
+"id";"age";"bw_rec"
+2004029;0;5440
+2004029;24;9080
+2004029;31;10610
+2004029;38;11550
+2004029;45;12660
+2004029;52;14310
+2004029;66;13910
+2004029;73;14630
+2004029;81;15010
+2004029;87;15780
+2004029;94;16020
+2004029;101;17960
+2004029;108;20340
+2004029;115;19860
+2004029;123;21370
+2004029;129;23030
+2004029;136;23260
+2004029;143;24510
+2004029;150;26700
+2004029;158;27100
+2004029;164;28330
+2004029;165;28300
+2004029;171;27800
+2004029;178;31170
+2004029;185;30770
+2004029;192;31910
+2004029;199;31980
+2004029;206;33830
+2004029;220;34170
+2004029;227;39020
+2004029;237;37010
+2004029;241;36660
+2004029;248;37150
+2004029;255;38140
+2004029;262;36450
+2004029;269;39020
+2004029;276;37220
+2004029;283;39900
+2004029;290;41230
+2004029;297;40680
+2004029;304;40530
+2004029;311;41460
+2004029;318;42150
+2004029;325;42370
+2004029;331;45380
+2004029;339;46430
+2004029;346;46680
+2004029;353;47250
+2004029;360;49430
+2004029;367;51030
+2004029;374;52310
+2004029;381;56000
+2004029;388;58170
+2004029;395;58690
+2004029;402;61580
+2004029;409;65430
+2004029;416;68260
+2004029;424;69470
+2004029;428;57520
+2004029;437;56200
+2004029;444;54980
+2004029;451;53930
+2004029;458;54290
+2004029;465;54260
+2004029;473;53590
+2004029;479;51830
+2004029;486;51620
+2004029;493;52200
+2004029;500;54080
+2004029;507;52600
+2004029;514;51720
+2004029;521;52480
+2004029;528;51530
+2004029;535;53250
+2004029;542;52460
+2004029;549;54200
+2004029;556;53390
+2004029;563;56620
+2004029;570;55920
+2004029;577;55570
+2004029;584;56340
+2004029;591;55810
+2004029;597;57990
+2004029;605;55970
+2004029;612;57230
+2004029;618;55270
+2004029;626;59190
+2004029;633;59430
+2004029;640;59750
+2004029;648;58880
+2004029;654;59800
+2004029;662;65330
+2004029;667;64500
+2004029;675;61380
+2004029;682;67210
+2004029;689;67040
+2004029;695;68300
+2004029;703;73800
+2004029;710;76690
+2004029;717;79660
+2004029;724;81880
+2004029;731;86380
+2004029;733;86250
+2004029;734;64490
+2004029;738;65250
+2004029;745;60790
+2004029;752;52910
+2004029;759;57200
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/inputs/singlegoat_Litter_test.csv	Tue Aug 24 13:04:11 2021 +0000
@@ -0,0 +1,3 @@
+"id";"id_partnb";"age_part";"bw_litter"
+2004029;"2004029_1";427;5078
+2004029;"2004029_2";733;12524
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools_grum.xml	Tue Aug 24 13:04:11 2021 +0000
@@ -0,0 +1,142 @@
+<tool id="GRUM" name="GRUM, Estimate the values of parameters" version="1.2.0">
+  <description></description>
+  <requirements>
+    <container type="singularity">docker://registry.forgemia.inra.fr/grum/grum:1.2</container>
+  </requirements>
+  <command detect_errors="aggressive">
+    <![CDATA[
+	     #if str( $selectAction.action ) == 'getDefaultInitial':
+	        #if str( $selectAction.mammalParamGet.choose ) == 'defaultGoat':
+                   cp '$__tool_directory__/default/goat_parameters.json' ${parameter_values_file_only};
+	        #elif str( $selectAction.mammalParamGet.choose ) == 'defaultCow':
+                   cp '$__tool_directory__/default/cow_parameters.json' ${parameter_values_file_only};
+	        #end if
+	     #elif str( $selectAction.action ) == 'estimateParameters':
+                #if str( $selectAction.mammalParamSet.choose ) == 'defaultGoat':
+	           /bin/bash -c "Rscript --verbose /data/grum/siwaa_recipe/grum_siwaa.R ${selectAction.litter_input} ${selectAction.bw_input} ${selectAction.do_plot_fitted} '$__tool_directory__/default/goat_parameters.json';";
+		   #if str( $selectAction.do_output_parameterValues ) == 'do_output_parameterValues':
+                      cp '$__tool_directory__/default/goat_parameters.json' ${parameter_values_file};
+		   #end if   
+	           #elif str( $selectAction.mammalParamSet.choose ) == 'defaultCow':
+                   /bin/bash -c "Rscript --verbose /data/grum/siwaa_recipe/grum_siwaa.R ${selectAction.litter_input} ${selectAction.bw_input} ${selectAction.do_plot_fitted} '$__tool_directory__/default/cow_parameters.json';";
+		   #if str( $selectAction.do_output_parameterValues ) == 'do_output_parameterValues':
+                      cp '$__tool_directory__/default/cow_parameters.json' ${parameter_values_file};
+		   #end if   
+	           #elif str( $selectAction.mammalParamSet.choose ) == 'customMammal':
+                   /bin/bash -c "Rscript --verbose /data/grum/siwaa_recipe/grum_siwaa.R ${selectAction.litter_input} ${selectAction.bw_input} ${selectAction.do_plot_fitted} ${selectAction.mammalParamSet.parameterValues_input} ;";
+		   #if str( $selectAction.do_output_parameterValues ) == 'do_output_parameterValues':
+                     cp ${selectAction.mammalParamSet.parameterValues_input} ${parameter_values_file};
+	           #end if
+	        #end if
+		#if str( $selectAction.do_plot_fitted ) == 'do_plot_fitted':
+                   pdfunite goat_*.pdf simulation_plots.pdf;
+                   cp simulation_plots.pdf ${simulation_plots};
+                #end if
+	     cp estimated_parameters.csv ${estimated_parameters};
+             #end if
+    ]]>
+  </command>
+  <inputs>
+    <conditional name="selectAction">
+      <param name="action" type="select" label="Select the action to perform">
+	<option value="estimateParameters" selected="true">estimate Goat parameters values</option>
+	<option value="getDefaultInitial">get default Goat initial parameters initial values</option>
+      </param>
+      <when value="estimateParameters">
+	<param name="litter_input" type="data" format="csv" label="Litter file" optional="true"/>
+	<param name="bw_input" type="data" format="csv" label="Body weight file" optional="true"/>
+	<conditional name="mammalParamSet">
+	  <param name="choose" type="select" label="Select the mammal parameters initial values">
+	    <option value="defaultGoat" selected="true">default Goat parameters initiale values</option>
+	    <option value="defaultCow">default Cow parameters initial values</option>
+	    <option value="customMammal">custom Mammal parameters initial values</option>
+	  </param>
+	  <when value="customMammal">
+	    <param name="parameterValues_input" type="data" format="json" label="Select a mammal parameters initial values file(json)"/>
+	  </when>
+	  <when value="defaultGoat">
+	  </when>
+	  <when value="defaultCow">
+	  </when>
+	</conditional>
+	<param name="do_plot_fitted" type="boolean" checked="true" label="Plot fitted"
+               truevalue="do_plot_fitted" falsevalue="do_not_plot_fitted" />
+	<param name="do_output_parameterValues" type="boolean" checked="true" label="Output the parameter Values file"
+               truevalue="do_output_parameterValues" falsevalue="do_not_outputParametersValues" />
+      </when>
+      <when value="getDefaultInitial">
+	<conditional name="mammalParamGet">
+	  <param name="choose" type="select" label="Select the mammal parameter values">
+	    <option value="defaultGoat" selected="true">default Goat parameters initial values</option>
+	    <option value="defaultCow">default Cow parameters initial values</option>
+	  </param>
+	  <when value="defaultGoat">
+	  </when>
+	  <when value="defaultCow">
+	  </when>
+	</conditional>	  
+	</when>
+      </conditional>
+  </inputs>
+  <outputs>
+    <data format="csv" name="estimated_parameters" label="GRUM estimated parameters" >
+      <filter>selectAction['action'] == 'estimateParameters'</filter>
+    </data>
+    <data format="pdf" name="simulation_plots" label="GRUM plots" >
+      <filter>selectAction['action'] == 'estimateParameters' and selectAction['do_plot_fitted']</filter>
+    </data>
+    <data format="json" name="parameter_values_file_only" label="Parameters initial values" >
+      <filter>selectAction['action'] == 'getDefaultInitial'</filter>
+    </data>
+    <data format="json" name="parameter_values_file" label="Parameters initial values" >
+      <filter>selectAction['action'] == 'estimateParameters' and selectAction['do_output_parameterValues']</filter>
+    </data>
+  </outputs>
+  <tests>
+    <test>
+      <conditional name="selectAction">
+        <param name="action" value="estimateParameters"/>
+      </conditional>
+      <param name="litter_input" value="inputs/Litter_test.csv" ftype="csv" />
+      <param name="bw_input" value="inputs/BW_test.csv" ftype="csv" />
+      <conditional name="mammalParam">
+	<param name="choose" value="defaultGoat"/>
+      </conditional>
+      <param name="do_plot_fitted" value="true" />
+      <output name="estimated_parameters" ftype="csv">
+	<assert_contents>
+          <has_line line="&quot;ID&quot;,&quot;W0&quot;,&quot;G0&quot;,&quot;kr_1&quot;,&quot;kUa_1&quot;,&quot;kUf_1&quot;,&quot;kn_1&quot;,&quot;kmd_1&quot;,&quot;kr_2&quot;,&quot;kUa_2&quot;,&quot;kUf_2&quot;,&quot;kn_2&quot;,&quot;kmd_2&quot;" />
+	  <has_line_matching expression="&quot;X2004029&quot;,.*" />
+	  <has_line_matching expression="&quot;X2005115&quot;,.*" />
+	  <has_n_columns n="13" sep=","/>
+          <has_n_lines n="3" />
+        </assert_contents>
+      </output>
+    </test>
+  </tests>
+  <help>
+Inputs:
+=======
+
+- Litter for each mammal.
+- Sequence of body weight of mammals.
+- (optional) Initial parameter values for the estimation process, if the defaults available are not revelant.
+
+Outputs:
+========
+
+- Estimated parameters for each goat (csv file).
+- (optional) Plots of simulations with estimated parameters for each goat (pdf file).
+- (optional) Initial parameters values used for the estimation process (json file)
+
+Example:
+========
+
+- Copy to your history files BW_smalltable.csv and Litter_smalltable.csv from GRUM Datasets.
+- Select default initial parameter values set, or provide one.
+- Fill filenames and choose the adequate number of cores.
+- And then execute (it takes around 20 minutes per goat for estimation)
+
+  </help>
+</tool>
+