diff --git a/data/0.6.3/tables/prospr-6dpf-1-whole-virtual-cells-labels/additional_tables.txt b/data/0.6.3/tables/prospr-6dpf-1-whole-virtual-cells-labels/additional_tables.txt new file mode 100644 index 0000000000000000000000000000000000000000..fa898e9f593eb179ef1eecad06131e49bd522b11 --- /dev/null +++ b/data/0.6.3/tables/prospr-6dpf-1-whole-virtual-cells-labels/additional_tables.txt @@ -0,0 +1 @@ +profile_clust_curated.csv diff --git a/data/0.6.3/tables/sbem-6dpf-1-whole-segmented-cells-labels/additional_tables.txt b/data/0.6.3/tables/sbem-6dpf-1-whole-segmented-cells-labels/additional_tables.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f8b18c5e23c560b0356d29e0b93e6063fc2f9d1 --- /dev/null +++ b/data/0.6.3/tables/sbem-6dpf-1-whole-segmented-cells-labels/additional_tables.txt @@ -0,0 +1,6 @@ +cells_to_nuclei.csv +extrapolated_intensity_correction.csv +genes.csv +morphology.csv +regions.csv +vc_assignments.csv diff --git a/data/0.6.3/tables/sbem-6dpf-1-whole-segmented-cilia-labels/additional_tables.txt b/data/0.6.3/tables/sbem-6dpf-1-whole-segmented-cilia-labels/additional_tables.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f85507f9cf2fe12a3bd267ce72f93241da53b7d --- /dev/null +++ b/data/0.6.3/tables/sbem-6dpf-1-whole-segmented-cilia-labels/additional_tables.txt @@ -0,0 +1,2 @@ +cell_mapping.csv +morphology.csv diff --git a/data/0.6.3/tables/sbem-6dpf-1-whole-segmented-nuclei-labels/additional_tables.txt b/data/0.6.3/tables/sbem-6dpf-1-whole-segmented-nuclei-labels/additional_tables.txt new file mode 100644 index 0000000000000000000000000000000000000000..acc707e85088f2103233c4d3175135a75fda9545 --- /dev/null +++ b/data/0.6.3/tables/sbem-6dpf-1-whole-segmented-nuclei-labels/additional_tables.txt @@ -0,0 +1,2 @@ +extrapolated_intensity_correction.csv +morphology.csv diff --git a/scripts/attributes/base_attributes.py b/scripts/attributes/base_attributes.py index fad0384519f31c0b2fe000db1d52ed33340f11f7..1df9f1a888688f1f0e4f48aea53a48009d327572 100644 --- a/scripts/attributes/base_attributes.py +++ b/scripts/attributes/base_attributes.py @@ -160,6 +160,34 @@ def base_attributes(input_path, input_key, output_path, resolution, return label_ids +def write_additional_table_file(table_folder): + # get all the file names in the table folder + file_names = os.listdir(table_folder) + file_names.sort() + + # make sure we have the default table + default_name = 'default.csv' + if default_name not in file_names: + raise RuntimeError("Did not find the default table ('default.csv') in the table folder %s" % table_folder) + + # don't write anything if we don't have additional tables + if len(file_names) == 1: + return + + # write file for the additional tables + out_file = os.path.join(table_folder, 'additional_tables.txt') + with open(out_file, 'w') as f: + for name in file_names: + ext = os.path.splitext(name)[1] + # only add csv files + if ext != '.csv': + continue + # don't add the default table + if name == 'default.csv': + continue + f.write(name + '\n') + + # TODO this is un-tested !!! def propagate_attributes(id_mapping_path, old_table_path, output_path): """ Propagate all attributes to new ids. (column label id) diff --git a/scripts/attributes/master.py b/scripts/attributes/master.py index df607d919b580eb7598d7ed72b0e8c6ad841cc32..7541b4c159655f952b321d26463b3e916a786662 100644 --- a/scripts/attributes/master.py +++ b/scripts/attributes/master.py @@ -1,7 +1,7 @@ import os import h5py -from .base_attributes import base_attributes, propagate_attributes +from .base_attributes import base_attributes, propagate_attributes, write_additional_table_file from .cell_nucleus_mapping import map_cells_to_nuclei from .genes import gene_assignment_table, vc_assignment_table from .morphology import write_morphology_cells, write_morphology_nuclei @@ -84,6 +84,8 @@ def make_cell_tables(old_folder, folder, name, tmp_folder, resolution, extrapol_mask, 't00000/s00/0/cells', extrapol_out, tmp_folder, target, max_jobs) + write_additional_table_file(table_folder) + def make_nucleus_tables(old_folder, folder, name, tmp_folder, resolution, target='slurm', max_jobs=100): @@ -117,6 +119,8 @@ def make_nucleus_tables(old_folder, folder, name, tmp_folder, resolution, extrapol_mask, 't00000/s00/0/cells', extrapol_out, tmp_folder, target, max_jobs) + write_additional_table_file(table_folder) + def make_cilia_tables(old_folder, folder, name, tmp_folder, resolution, target='slurm', max_jobs=100): @@ -144,3 +148,5 @@ def make_cilia_tables(old_folder, folder, name, tmp_folder, resolution, cilia_morphology(seg_path, seg_key, base_out, morpho_out, resolution, tmp_folder, target=target, max_jobs=max_jobs) + + write_additional_table_file(table_folder) diff --git a/scripts/files/copy_helper.py b/scripts/files/copy_helper.py index 9d6c5705282bce209b8018ba1ee57f43a36dff04..b7c6ad31d71f73706d765b877e8c20df5513c6d2 100644 --- a/scripts/files/copy_helper.py +++ b/scripts/files/copy_helper.py @@ -2,6 +2,7 @@ import os import shutil from .xml_utils import copy_xml_with_newpath, get_h5_path_from_xml from .sources import get_image_names, get_segmentation_names, get_segmentations +from ..attributes.base_attributes import write_additional_table_file def copy_file(xml_in, xml_out): @@ -28,6 +29,8 @@ def copy_tables(src_folder, dst_folder, name): rel_path = os.path.relpath(src_file, table_out) if not os.path.exists(dst_file): os.symlink(rel_path, dst_file) + # write the txt file for additional tables + write_additional_table_file(dst_folder) def copy_segmentation(src_folder, dst_folder, name):