CWL BWA-MEM RG fields from string parameters - use several input strings to generate a single input string
1
0
Entering edit mode
5.8 years ago
dganiewich ▴ 130

Hi everyone! I am experimenting on CWL to generate a bwa-mem command, which is like this:

#!/usr/bin/env cwl-runner

cwlVersion: v1.0
class: CommandLineTool

requirements:
  - $import: bwa-docker.yml
  - class: InlineJavascriptRequirement

inputs:
  reference:
    type: File
    secondaryFiles:
        - .64.amb
        - .64.ann
        - .64.bwt
        - .64.pac
        - .64.sa
    inputBinding:
      position: 1

  read_1:
    type: File
    inputBinding:
      position: 2

  read_2:
    type: File
    inputBinding:
      position: 3

  sample_name:
    type: string

  platform:
    type: string

  id_sample:
    type: string

  pu:
    type: string

  lb:
    type: string


stdout: output.bam

outputs:
  output:
    type: File
    outputBinding:
      glob: output.bam

baseCommand:
- bwa
- mem

Now, what I would like to accomplish is to generate a complete RG string using the sample_name, platform, id_sample, pu and lb. Something like this, considering a \t is needed in between (using Java expressions):

'@RG\tSM:$(inputs.sample_name)\tPL:$(inputs.platform)\tID:$(inputs.id_sample)\tPU:$(inputs.pu)\tLB:$inputs.lb)'

I have tried adding it as an argument with valueFrom and it replaces the java expression with the value, but it won't take the tabs, it ends up being (it keeps the 't's):

'@RGtSM:sample_nametPL:platformtID:sample_idtPU:putLB:library'

I also tried using actual tabs, but then:

    -R \
    '@RG SM:sample_name  PL:ILLUMINA ID:id_sample PU:foo LB:bar' > /tmp/tmpsss7fq_t/short_9.bam

[E::bwa_set_rg] no ID at the read group line

When trying to use it as an input, it does not replace the values and takes $(inputs...) as a string I suppose, rather than an expression. The added code was:

  info_field: 
    type: string
    default: "@RG\tSM:$(inputs.sample_name)\tPL:$(inputs.platform)\tID:$(inputs.id_sample)\tPU:$(inputs.pu)\tLB:$inputs.lb)"
    inputBinding:
      prefix: -R

Any ideas how can I make it happen?

Thank you everyone!!

Daiana

cwl bwa-mem • 1.8k views
ADD COMMENT
2
Entering edit mode
5.8 years ago
Tom ▴ 540

Hi Daiana,

I'm not sure you can use a javascript expression in the default field. I tested passing the parameter using arguments and it seems to work.

arguments:
  - valueFrom: $("@RG\tSM:"+(inputs.sample_name)+"\tPL:"+(inputs.platform)+"\tID:+"+(inputs.id_sample)+"\tPU:"+(inputs.pu)+"\tLB:"+inputs.lb))
    prefix: -R

Regards Tom

ADD COMMENT
1
Entering edit mode

woohoo! Thank you very much Tom!

ADD REPLY

Login before adding your answer.

Traffic: 2012 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6