with CellProfilermacros.xml2
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.
operation_3443CellProfilercellprofiler
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()
- 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.
- Image filename: If the gene name is not available, the image filename can be used as a surrogate identifier.
]]>