Skip to content
Snippets Groups Projects
Commit 38be90ae authored by Christopher Randolph Rhodes's avatar Christopher Randolph Rhodes
Browse files

Batch method for multi-chunk Ecotaxa TSV

parent e155ed65
No related branches found
No related tags found
No related merge requests found
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
......@@ -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)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment