Mercurial > repos > bgruening > cp_export_to_spreadsheet
view export_to_spreadsheet.xml @ 5:d0178bdcd00e draft
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 7d7a519c3a2cc612d38695b335d0f6c75a099de3"
author | bgruening |
---|---|
date | Fri, 26 Feb 2021 14:12:26 +0000 |
parents | 72a7f23f3a79 |
children | f24c370e5ea4 |
line wrap: on
line source
<tool id="cp_export_to_spreadsheet" name="ExportToSpreadsheet" version="@CP_VERSION@+galaxy@VERSION_SUFFIX@"> <description>export measurements into one or more files</description> <macros> <import>macros.xml</import> <token name="@VERSION_SUFFIX@">1</token> <xml name="metadata_sample_row" > <param name="metadata_category" type="select" label="Select the metadata to use as the identifier"> <option value="FileName">File name</option> <option value="Frame">Frame</option> <option value="Height">Height</option> <option value="MD5Digest">MD5Digest</option> <option value="PathName">Path name</option> <option value="Scaling">Scaling</option> <option value="Series">Series</option> <option value="URL">URL</option> <option value="Width">Width</option> </param> <param name="metadata_measurement" type="text" label="Measurements" > <help> Choose the measurement that corresponds to the identifier, such as metadata from the Metadata tool. Please see the Metadata tool for more details on metadata collection and usage. </help> </param> </xml> </macros> <expand macro="py_requirements"/> <expand macro="cmd_modules" /> <configfiles> <inputs name="inputs"/> <configfile name="script_file"> import json import sys import os FOURSPACES=@SPACES@ input_json_path = sys.argv[1] input_pipeline= sys.argv[2] params = json.load(open(input_json_path, "r")) def write_etss(): _str = "\nExportToSpreadsheet:[module_num:%d|svn_version:\\'Unknown\\'|variable_revision_number:12|show_window:True|notes:\\x5B\\x5D|batch_state:array(\\x5B\\x5D, dtype=uint8)|enabled:True|wants_pause:False]\n" % new_count _str += FOURSPACES + "Select the column delimiter:%s\n" % params["delimiter"] _str += FOURSPACES + "Add image metadata columns to your object data file?:%s\n" % params["add_metadata_column_to_object"] _str += FOURSPACES + "Select the measurements to export:No\n" _str += FOURSPACES + "Calculate the per-image mean values for object measurements?:%s\n" % params['calc_mean'] _str += FOURSPACES + "Calculate the per-image median values for object measurements?:%s\n" % params['calc_median'] _str += FOURSPACES + "Calculate the per-image standard deviation values for object measurements?:%s\n" % params['calc_standard_deviation'] _str += FOURSPACES + "Output file location:Default Output Folder\\x7C\n" create_gene = params["con_create_gene_pattern"]["create_gene_pattern"] _str += FOURSPACES + "Create a GenePattern GCT file?:%s\n" % create_gene #default values when create gene is no source_sample_row = "Metadata" image_as_id = "None" metadata_as_id = "None" if create_gene == "Yes": source_sample_row = params["con_create_gene_pattern"]["con_source_sample_row"]["select_source_sample_row_name"] if source_sample_row == "Metadata": metadata_as_id = params["con_create_gene_pattern"]["con_source_sample_row"]["metadata_category"] + "_" + params["con_create_gene_pattern"]["con_source_sample_row"]["metadata_measurement"] else: image_as_id = params["con_create_gene_pattern"]["con_source_sample_row"]["image_filename_cat"] _str += FOURSPACES + "Select source of sample row name:%s\n" % source_sample_row _str += FOURSPACES + "Select the image to use as the identifier:%s\n" % image_as_id _str += FOURSPACES + "Select the metadata to use as the identifier:%s\n" % metadata_as_id export_all_measurements = "Yes" # always export all _str += FOURSPACES + "Export all measurement types?:%s\n" % export_all_measurements _str += FOURSPACES + "Press button to select measurements:\n" _str += FOURSPACES + "Representation of Nan/Inf:%s\n" % params["represent_nan"] _str += FOURSPACES + "Add a prefix to file names?:%s\n" % params["con_prefix"]["add_prefix"] if "filename_prefix" in params["con_prefix"]: _str += FOURSPACES + "Filename prefix:%s\n" % params["con_prefix"]["filename_prefix"] else: _str += FOURSPACES + "Filename prefix:MyPrefix_\n" _str += FOURSPACES + "Overwrite existing files without warning?:%s\n" % params["overwrite_existing_file"] use_as_filename = "Yes" _str += FOURSPACES + "Data to export:Do not use\n" _str += FOURSPACES + "Combine these object measurements with those of the previous object?:No\n" _str += FOURSPACES + "File name:DATA.csv\n" _str += FOURSPACES + "Use the object name for the file name?:Yes\n" return _str with open(input_pipeline) as fin: lines = fin.readlines() k, v = lines[4].strip().split(':') module_count = int(v) new_count = module_count + 1 lines[4] = k + ":%d\n" % new_count with open("output.cppipe", "w") as f: f.writelines(lines) f.write(write_etss()) f.close() </configfile> </configfiles> <inputs> <expand macro="input_pipeline_param" /> <param name="delimiter" type="select" label="Select the column delimiter"> <option value="Comma (",")">Comma (",")</option> <option value="Tab">Tab</option> <sanitizer sanitize="false"/> </param> <conditional name="con_prefix"> <param name="add_prefix" type="select" label="Add a prefix to file names?"> <option value="Yes">Add prefix to the file name</option> <option value="No">Do not add prefix to the file name</option> </param> <when value="Yes"> <param name="filename_prefix" type="text" value="MyExpt_" label="Enter the prefix to be added to the file names"/> </when> <when value="No" /> </conditional> <param name="overwrite_existing_file" display="radio" type="select" label="Overwrite existing files without warning?"> <option value="Yes">Yes</option> <option value="No">No</option> </param> <param name="add_metadata_column_to_object" display="radio" type="select" label="Add image metadata columns to your object data file?" help="'Image_Metadata_' columns are normally exported in the Image data file, but if you select 'Yes', they will also be exported with the Object data file(s)."> <option value="Yes">Yes</option> <option value="No">No</option> </param> <param name="represent_nan" type="select" label="Representation of Nan/Inf" help="CellProfiler will produce Inf or NaN values under certain rare circumstances, for instance when calculating the mean intensity of an object within a masked region of an image."> <option value="NaN">NaN</option> <option value="Null">Null</option> </param> <param name="calc_mean" type="select" display="radio" label="Calculate the per-image mean values for object measurements?" help="Select 'Yes' to calculate the population mean over all the objects in each image and save that value as an aggregate measurement in the image file."> <option value="Yes">Yes</option> <option value="No">No</option> </param> <param name="calc_median" type="select" display="radio" label="Calculate the per-image median values for object measurements?" help="Select 'Yes' to calculate the population median over all the objects in each image and save that value as an aggregate measurement in the image file."> <option value="Yes">Yes</option> <option value="No">No</option> </param> <param name="calc_standard_deviation" type="select" display="radio" label="Calculate the per-image standard deviation values for object measurements?" help="Select 'Yes' to calculate the population standard deviation over all the objects in each image and save that value as an aggregate measurement in the image file."> <option value="Yes">Yes</option> <option value="No">No</option> </param> <conditional name="con_create_gene_pattern"> <param name="create_gene_pattern" type="select" display="radio" label="Create a GenePattern GCT file?" help="Select 'Yes' to create a GCT file compatible with GenePattern. The GCT file format is a tab-delimited text file format designed for gene expression datasets; the specifics of the format are described here. By converting your measurements into a GCT file, you can make use of GenePattern’s data visualization and clustering methods."> <option value="Yes">Yes</option> <option value="No" selected="true">No</option> </param> <when value="Yes"> <conditional name="con_source_sample_row"> <param name="select_source_sample_row_name" type="select" label="Select source of sample row name"> <help> <![CDATA[ The first column of the GCT file is the unique identifier for each sample, which is ordinarily the gene name. This information may be specified in one of two ways: <br> - Metadata: If you used the Metadata modules to add metadata to your images, you may specify a metadata tag that corresponds to the identifier for this column. <br> - Image filename: If the gene name is not available, the image filename can be used as a surrogate identifier. ]]> </help> <option value="Metadata">Metadata</option> <option value="Image filename">Image filename</option> </param> <when value="Metadata"> <expand macro="metadata_sample_row" /> </when> <when value="Image filename"> <param name="image_filename_cat" type="text" value="None" label="Enter the name of the image to use as the identifier" help="Enter the name of the image image whose filename will be used to identify each sample row. " /> </when> </conditional> </when> <when value="No" /> </conditional> </inputs> <outputs> <expand macro="output_pipeline_param" /> </outputs> <tests> <test> <!-- create gene pattern =no--> <expand macro="test_input_pipeline_param" /> <param name="delimiter" value="Tab" /> <param name="output_file_location" value="Default Output Folder" /> <conditional name="con_prefix"> <param name="add_prefix" value="No"/> </conditional> <param name="overwrite_existing_file" value="Yes" /> <param name="add_metadata_column_to_object" value="Yes" /> <param name="represent_nan" value="NaN" /> <param name="calc_mean" value="Yes" /> <param name="calc_median" value="Yes" /> <param name="calc_standard_deviation" value="Yes" /> <conditional name="con_create_gene_pattern"> <param name="create_gene_pattern" value="No" /> </conditional> <expand macro="test_out_file" file="export_to_spreadsheet.cppipe" /> </test> <test> <!-- create gene=yes , source of sampe row name= metadata--> <expand macro="test_input_pipeline_param" /> <param name="delimiter" value="Tab" /> <param name="output_file_location" value="Default Output Folder" /> <conditional name="con_prefix"> <param name="add_prefix" value="No"/> </conditional> <param name="overwrite_existing_file" value="Yes" /> <param name="add_metadata_column_to_object" value="Yes" /> <param name="represent_nan" value="NaN" /> <param name="calc_mean" value="Yes" /> <param name="calc_median" value="Yes" /> <param name="calc_standard_deviation" value="Yes" /> <conditional name="con_create_gene_pattern"> <param name="create_gene_pattern" value="Yes" /> <conditional name="con_source_sample_row"> <param name="select_source_sample_row_name" value="Metadata" /> <param name="metadata_category" value="FileName" /> <param name="metadata_measurement" value="DNA" /> </conditional> </conditional> <expand macro="test_out_file" file="export_to_spreadsheet_create_gene_metadata.cppipe" /> </test> <test> <!-- create gene=yes , source of sampe row name= image filename--> <expand macro="test_input_pipeline_param" /> <param name="delimiter" value="Tab" /> <param name="output_file_location" value="Default Output Folder" /> <conditional name="con_prefix"> <param name="add_prefix" value="Yes"/> <param name="filename_prefix" value="MyExpt_" /> </conditional> <param name="overwrite_existing_file" value="Yes" /> <param name="add_metadata_column_to_object" value="Yes" /> <param name="represent_nan" value="NaN" /> <param name="calc_mean" value="Yes" /> <param name="calc_median" value="Yes" /> <param name="calc_standard_deviation" value="Yes" /> <conditional name="con_create_gene_pattern"> <param name="create_gene_pattern" value="Yes" /> <conditional name="con_source_sample_row"> <param name="select_source_sample_row_name" value="Image filename" /> <param name="image_filename_cat" value="DNA" /> </conditional> </conditional> <expand macro="test_out_file" file="export_to_spreadsheet_create_gene_image_filename.cppipe" /> </test> <test> <!--repeat test for multiple data export. create gene=yes , source of sampe row name= image filename--> <expand macro="test_input_pipeline_param" /> <param name="delimiter" value="Tab" /> <param name="output_file_location" value="Default Output Folder" /> <conditional name="con_prefix"> <param name="add_prefix" value="Yes"/> <param name="filename_prefix" value="MyExpt_" /> </conditional> <param name="overwrite_existing_file" value="Yes" /> <param name="add_metadata_column_to_object" value="Yes" /> <param name="represent_nan" value="NaN" /> <param name="calc_mean" value="Yes" /> <param name="calc_median" value="Yes" /> <param name="calc_standard_deviation" value="Yes" /> <conditional name="con_create_gene_pattern"> <param name="create_gene_pattern" value="Yes" /> <conditional name="con_source_sample_row"> <param name="select_source_sample_row_name" value="Image filename" /> <param name="image_filename_cat" value="DNA" /> </conditional> </conditional> <expand macro="test_out_file" file="export_to_spreadsheet_multi.cppipe" /> </test> </tests> <help> <![CDATA[ .. class:: infomark **What it does** This tool will convert the measurements to a comma-, tab-, or other character-delimited text format and save them in one or several files, as requested. @COMMON_HELP@ ]]> </help> <expand macro="citations" /> </tool>