Mercurial > repos > greg > extract_ipm_date_interval
comparison extract_ipm_date_interval.xml @ 10:c2eb16ef23c0 draft
Uploaded
| author | greg |
|---|---|
| date | Tue, 07 Aug 2018 13:02:58 -0400 |
| parents | 0764ac25c68f |
| children | fff2e4833e8f |
comparison
equal
deleted
inserted
replaced
| 9:fd41f452c9fe | 10:c2eb16ef23c0 |
|---|---|
| 1 <tool id="ipm_date_interval" name="Extract date interval" version="1.1.0"> | 1 <tool id="ipm_date_interval" name="Extract date interval" version="1.1.0"> |
| 2 <description>from insect phenology model data</description> | 2 <description>from insect phenology model data</description> |
| 3 <requirements> | 3 <requirements> |
| 4 <requirement type="package" version="1.10.4">r-data.table</requirement> | |
| 5 <requirement type="package" version="2.2.6">r-hash</requirement> | |
| 4 <requirement type="package" version="1.4.4">r-optparse</requirement> | 6 <requirement type="package" version="1.4.4">r-optparse</requirement> |
| 5 <requirement type="package" version="1.10.4">r-data.table</requirement> | |
| 6 </requirements> | 7 </requirements> |
| 7 <command detect_errors="exit_code"><![CDATA[ | 8 <command detect_errors="exit_code"><![CDATA[ |
| 8 #import os | 9 #import os |
| 9 #set input_dir = 'input_dir' | 10 #set input_data_dir = 'input_data_dir' |
| 10 #set output_data_dir = "output_data_dir" | 11 #set output_data_dir = "output_data_dir" |
| 11 #set output_plots_dir = "output_plots_dir" | 12 #set output_plots_dir = "output_plots_dir" |
| 12 #set error_file = $os.path.join($output_data_dir, "04_combined_generations.csv") | 13 #set error_file = $os.path.join($output_data_dir, "04_combined_generations.csv") |
| 13 mkdir $input_dir && | 14 #set job = $input_data[0].creating_job |
| 15 #set tool_parameters = "" | |
| 16 #for $p in $job.parameters: | |
| 17 #set tool_parameters = $tool_parameters + "__SeP__" + $p.name | |
| 18 #set tool_parameters = $tool_parameters + "__SeP__" + $p.value | |
| 19 #end for | |
| 20 mkdir $input_data_dir && | |
| 14 mkdir output_data_dir && | 21 mkdir output_data_dir && |
| 15 mkdir output_plots_dir && | 22 mkdir output_plots_dir && |
| 16 #for $i in $input: | 23 #for $i in $input_data: |
| 17 #set filename = $i.file_name | 24 #set filename = $i.file_name |
| 18 #set name = $i.name | 25 #set name = $i.name |
| 19 ln -s $filename $input_dir/$name && | 26 ln -s $filename $input_data_dir/$name && |
| 20 #end for | 27 #end for |
| 21 Rscript '$__tool_directory__/extract_ipm_date_interval.R' | 28 Rscript '$__tool_directory__/extract_ipm_date_interval.R' |
| 22 --end_date '$end_date' | 29 --end_date '$end_date' |
| 23 --input_dir '$input_dir' | 30 --input_data_dir '$input_data_dir' |
| 24 --plot_std_error $plot_std_error | |
| 25 --script_dir '$__tool_directory__' | 31 --script_dir '$__tool_directory__' |
| 26 --start_date '$start_date' | 32 --start_date '$start_date' |
| 27 &>ipm_log.txt; | 33 --tool_parameters '$tool_parameters' |
| 34 &>eipmdi_log.txt; | |
| 28 if [[ $? -ne 0 ]]; then | 35 if [[ $? -ne 0 ]]; then |
| 29 cp ipm_log.txt '$error_file'; | 36 cp eipmdi_log.txt '$error_file'; |
| 30 exit 1; | 37 exit 1; |
| 31 fi]]></command> | 38 fi]]></command> |
| 32 <inputs> | 39 <inputs> |
| 33 <param name="input" type="data_collection" format="csv" collection_type="list" label="Insect phenology model data files" /> | 40 <param name="input_data" type="data_collection" format="csv" collection_type="list" label="Insect phenology model data files" /> |
| 34 <param name="start_date" type="text" value="" label="Start date" help="Format must be yyyy-mm-dd"> | 41 <param name="start_date" type="text" value="" label="Start date" help="Format must be yyyy-mm-dd"> |
| 35 <validator type="expression" message="Date must have the format yyyy-mm-dd">len(value.split('-')[0])==4 and int(value.split('-')[0]) and len(value.split('-')[1])==2 and int(value.split('-')[1]) and len(value.split('-')[2])==2 and int(value.split('-')[2])</validator> | 42 <validator type="expression" message="Date must have the format yyyy-mm-dd">len(value.split('-')[0])==4 and int(value.split('-')[0]) and len(value.split('-')[1])==2 and int(value.split('-')[1]) and len(value.split('-')[2])==2 and int(value.split('-')[2])</validator> |
| 36 </param> | 43 </param> |
| 37 <param name="end_date" type="text" value="" label="End date" help="Format must be yyyy-mm-dd"> | 44 <param name="end_date" type="text" value="" label="End date" help="Format must be yyyy-mm-dd"> |
| 38 <validator type="expression" message="Date must have the format yyyy-mm-dd">len(value.split('-')[0])==4 and int(value.split('-')[0]) and len(value.split('-')[1])==2 and int(value.split('-')[1]) and len(value.split('-')[2])==2 and int(value.split('-')[2])</validator> | 45 <validator type="expression" message="Date must have the format yyyy-mm-dd">len(value.split('-')[0])==4 and int(value.split('-')[0]) and len(value.split('-')[1])==2 and int(value.split('-')[1]) and len(value.split('-')[2])==2 and int(value.split('-')[2])</validator> |
| 39 </param> | 46 </param> |
| 40 <param name="plot_std_error" type="select" label="Plot standard error?"> | |
| 41 <option value="yes" selected="True">Yes</option> | |
| 42 <option value="no">No</option> | |
| 43 </param> | |
| 44 </inputs> | 47 </inputs> |
| 45 <outputs> | 48 <outputs> |
| 46 <collection name="output_data_collection" type="list" label="${tool.name} (data), on ${on_string}"> | 49 <collection name="output_data_collection" type="list" label="${tool.name} (data), on ${on_string}"> |
| 47 <discover_datasets pattern="__name__" directory="output_data_dir" format="csv"/> | 50 <discover_datasets pattern="__name__" directory="output_data_dir" format="csv"/> |
| 48 </collection> | 51 </collection> |
| 49 <collection name="output_plots_collection" type="list" label="${tool.name} (plots), on ${on_string}"> | 52 <collection name="output_plot_collection" type="list" label="${tool.name} (plots), on ${on_string}"> |
| 50 <discover_datasets pattern="__name__" directory="output_plots_dir" format="pdf"/> | 53 <discover_datasets pattern="__name__" directory="output_plots_dir" format="pdf"/> |
| 51 </collection> | 54 </collection> |
| 52 </outputs> | 55 </outputs> |
| 53 <tests> | 56 <tests> |
| 54 <test> | 57 <test> |
| 55 <param name="input"> | 58 <!-- |
| 59 FIXME: Here is a sort of layout for a test, but since the input collection will be uploaded, the test | |
| 60 will fail bacused the job parameters for the inputs will not be those produced by the insect_phenology_model | |
| 61 tool. Testing this tool will require using the workflow testing approach. | |
| 62 <param name="input_data"> | |
| 56 <collection type="list"> | 63 <collection type="list"> |
| 57 <element name="04_combined_generations.csv"/> | 64 <element name="input_p_1.csv" value="input_p_1.csv" ftype="csv"/> |
| 65 <element name="input_f1_1.csv" value="input_f1_1.csv" ftype="csv"/> | |
| 66 <element name="input_f2_1.csv" value="input_f2_1.csv" ftype="csv"/> | |
| 67 <element name="input_combined1.csv" value="input_combined1.csv" ftype="csv"/> | |
| 58 </collection> | 68 </collection> |
| 59 </param> | 69 </param> |
| 60 <param name="start_date" value="2017-04-01"/> | 70 <param name="start_date" value="2017-04-01"/> |
| 61 <param name="end_date" value="2017-04-15"/> | 71 <param name="end_date" value="2017-04-15"/> |
| 62 <output_collection name="output_data_collection" type="list"> | 72 <output_collection name="output_data_collection" type="list"> |
| 63 <element name="04_combined_generations.csv" file="output_combined6.csv" ftype="csv" compare="contains"/> | 73 <element name="01_generation_P.csv" file="output_p_1.csv" ftype="csv" compare="contains"/> |
| 74 <element name="02_generation_F1.csv" file="output_f1_1.csv" ftype="csv" compare="contains"/> | |
| 75 <element name="03_generation_F2.csv" file="output_f2_1.csv" ftype="csv" compare="contains"/> | |
| 76 <element name="04_combined_generations.csv" file="output_combined1.csv" ftype="csv" compare="contains"/> | |
| 64 </output_collection> | 77 </output_collection> |
| 65 <!-- | 78 <output_collection name="output_plot_collection" type="list"> |
| 66 <output_collection name="output_plots_collection" type="list"> | 79 <element name="01_egg_pop_by_generation.pdf" file="plot.pdf" ftype="pdf" compare="contains"/> |
| 67 <element name="02_young_nymph_pop.pdf" file="plot.pdf" ftype="pdf" compare="contains"/> | 80 <element name="04_total_nymph_pop_by_generation.pdf" file="plot.pdf" ftype="pdf" compare="contains"/> |
| 68 <element name="05_pre-vittelogenic_adult_pop.pdf" file="plot.pdf" ftype="pdf" compare="contains"/> | 81 <element name="08_total_adult_pop_by_generation.pdf" file="plot.pdf" ftype="pdf" compare="contains"/> |
| 69 </output_collection> | 82 <element name="09_total_pop_by_generation.pdf" file="plot.pdf" ftype="pdf" compare="contains"/> |
| 70 --> | |
| 71 </test> | |
| 72 <test> | |
| 73 <param name="input"> | |
| 74 <collection type="list"> | |
| 75 <element name="04_combined_generations.csv"/> | |
| 76 </collection> | |
| 77 </param> | |
| 78 <param name="start_date" value="2017-01-01"/> | |
| 79 <param name="end_date" value="2017-01-15"/> | |
| 80 <output_collection name="output_data_collection" type="list"> | |
| 81 <element name="04_combined_generations.csv" file="output_combined7.csv" ftype="csv" compare="contains"/> | |
| 82 </output_collection> | |
| 83 <!-- | |
| 84 <output_collection name="output_plots_collection" type="list"> | |
| 85 <element name="02_young_nymph_pop.pdf" file="plot.pdf" ftype="pdf" compare="contains"/> | |
| 86 <element name="05_pre-vittelogenic_adult_pop.pdf" file="plot.pdf" ftype="pdf" compare="contains"/> | |
| 87 </output_collection> | 83 </output_collection> |
| 88 --> | 84 --> |
| 89 </test> | 85 </test> |
| 90 </tests> | 86 </tests> |
| 91 <help> | 87 <help> |
