bpipe
bpipe copied to clipboard
transform function does not adapt stage naming properly
I have the following code snippit, as per discussion at #248
convert = {
branch.name = "${branch.name}.convert"
if(file(input).name.endsWith('.mnc')) {
exec """
mincconvert -2 -clobber -compress 9 $input.mnc $output.mnc
"""
}
else
if(file(input).name.endsWith('.nii.gz')) {
transform('.nii.gz') to('.convert.mnc') {
exec """
nii2mnc -clobber $input $output.mnc
"""
}
}
else
if(file(input).name.endsWith('.nii')) {
transform('.nii') to('.convert.mnc') {
exec """
nii2mnc -clobber $input $output.mnc
"""
}
}
}
Providing the following inputs:
../GAD_1.mnc ../GAD_2.nii ../GAD_3.nii.gz
Results in the following output filenames:
nii2mnc -clobber ../GAD_2.nii GAD_2.convert.mnc
nii2mnc -clobber ../GAD_3.nii.gz GAD_3.convert.mnc
mincconvert -2 -clobber -compress 9 ../GAD_1.mnc GAD_1.convert.mnc
However the naming of the stages is incorrect:
# Stage convert (GAD_3.nii)
# Stage convert (GAD_2)
# Stage convert (GAD_1)