This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Utilizing R Script Inputs in CWL

Hi everyone,

I am creating a CWL pipeline for a simple R script (runs in a docker container) that reads in a .csv file and subsequently analyzes it via a R package. I am able to read in the file by passing the file from the command line to the R script using commandArgs(trailingOnly=TRUE) in the script. However, is there any other way of reading in a file (i.e csv file) into a R script using CWL? I feel like commandArgs(trailingOnly=TRUE) may not be the best option.

Here is my .cwl and .yml file

  #!/usr/bin/env cwl-runner
cwlVersion: v1.0
class: CommandLineTool
requirements:
  ResourceRequirement:
    ramMin: 2096

hints:
 DockerRequirement:
  dockerPull: docker/image

inputs:

 script:
   type: File
   inputBinding:
      position: 1

 annotation:
   type: File
   inputBinding:
      position: 2

baseCommand: [ Rscript ]

outputs:
 getFile:
  type: File
  outputBinding:
   glob: getFile.RData

.yml

script:
  class: File
  path: script_final.R

annotation:
  class: File
  path: annotation_full.csv

Thank you for your help.

cwl r

Be warned: I have almost no experience with R.

Why is your current way of handling this not sufficent? How would you prefer to read in the file? I guess you could make cwl stage the csv table in the working directory and make the R script read it in from there.

1 answer

Be warned: I have almost no experience with R.

Why is your current way of handling this not sufficent? How would you prefer to read in the file? I guess you could make cwl stage the csv table in the working directory and make the R script read it in from there.

Hello Tom. Can you move your response from being an "answer" to a comment on the original post?

Log in to answer this question.