diff --git a/extensions/chaeo/batch_jobs/20231028_Porto_PA.py b/extensions/chaeo/batch_jobs/20231028_Porto_PA.py index f41950fdc4ce0d599c6909afbed67f26431ec491..7e02c856ed24e7cb9e727c12f02dcb3687cc8e22 100644 --- a/extensions/chaeo/batch_jobs/20231028_Porto_PA.py +++ b/extensions/chaeo/batch_jobs/20231028_Porto_PA.py @@ -1,7 +1,7 @@ from pathlib import Path from model_server.util import autonumber_new_directory, get_matching_files, loop_workflow -from extensions.chaeo.ecotaxa import write_ecotaxa_tsv +from extensions.chaeo.ecotaxa import write_ecotaxa_tsv_chunked_subdirectories from extensions.chaeo.workflows import export_patches_from_multichannel_zstack from extensions.ilastik.models import IlastikPixelClassifierModel @@ -51,7 +51,11 @@ if __name__ == '__main__': chunk_size=25, ) - # csv_path = (Path(where_output) / 'workflow_data.csv').__str__() - # write_ecotaxa_tsv(csv_path, where_output, sample_id=sample_id, scope_id='EMBL-MS-Zeiss-LSM900') + write_ecotaxa_tsv_chunked_subdirectories( + where_output, + 'workflow_data.csv', + sample_id=sample_id, + scope_id='EMBL-MS-Zeiss-LSM900' + ) print('Finished') \ No newline at end of file diff --git a/extensions/chaeo/ecotaxa.py b/extensions/chaeo/ecotaxa.py index 12a8bb6d494ca3eb18b80c4acbfc9fc6bf3d9f71..255552f3522e89ff9b6cb4b3bbf9f362d670d1cb 100644 --- a/extensions/chaeo/ecotaxa.py +++ b/extensions/chaeo/ecotaxa.py @@ -38,4 +38,8 @@ def write_ecotaxa_tsv(patches_csv_path: str, where: str, sample_id: str, scope_i 'process_id' ] df_export = df_patches.loc[:, pd.IndexSlice[cols_to_transfer, :]] - df_export.to_csv(Path(where) / 'ecotaxa.tsv', sep='\t', index=False) \ No newline at end of file + df_export.to_csv(Path(where) / 'ecotaxa.tsv', sep='\t', index=False) + +def write_ecotaxa_tsv_chunked_subdirectories(top_dir: str, csv_filename: str, sample_id: str, scope_id: str): + for sd in Path(top_dir).iterdir(): + write_ecotaxa_tsv((sd / csv_filename).__str__(), sd.__str__(), sample_id, scope_id)