ssadedin / bpipe

Bpipe - a tool for running and managing bioinformatics pipelines

Home Page:http://docs.bpipe.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

transform function does not adapt stage naming properly

gdevenyi opened this issue · comments

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)