This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Rename file in CWL ExpressionTool?

Expanding on best practice for renaming file in CWL workflow

Is there any way to do this after the fact in an ExpressionTool?

I'm running a somatic workflow and using Strelka to call germline variants. Inside the CWL, I'm easily able to refer to the outputs as "tumor_germline/variants_vcf" and "normal_germline/variants_vcf" (e.g. to run a concordance SNP check to confirm that we have a match from the same subjects), but the underlying filenames for both of these files are "../results/variants.vcf.gz".

When I do an ExpressionTool to collect the results at the end of the workflow into a subject-directory, it names my files "variants.vcf.gz" and "variants.vcf_2.gz" and, concerningly, it names the second vcf's associated .tbi file "variants.vcf.gz_2.tbi" which breaks things.

I'd really like to name them "tumor.variants.vcf.gz" and "normal.variants.vcf.gz" and I want to do that in my collection expression tool. I'm not really worried about extraneous files, as these tend to be in the "just a few megabytes" range, and I'm cleaning out non-final-output intermediate files at workflow completion.

cwl file management

2 answers

Hello alanh,

Yes, you can rename files using an ExpressionTool in CWL.

Change the basename property of the File objects.

Here is a very complicated example: https://github.com/EBI-Metagenomics/ebi-metagenomics-cwl/blob/cac44f2cf14110fde9951161c663c4525772f616/workflows/convert-to-v3-layout.cwl

Hello alanh,

Yes, you can rename files using an ExpressionTool in CWL.

Change the basename property of the File objects.

Here is a very complicated example: https://github.com/EBI-Metagenomics/ebi-metagenomics-cwl/blob/cac44f2cf14110fde9951161c663c4525772f616/workflows/convert-to-v3-layout.cwl

Log in to answer this question.