Question: CWL BWA-MEM RG fields from string parameters - use several input strings to generate a single input string
0
gravatar for dganiewich
25 days ago by
dganiewich30
dganiewich30 wrote:

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 • 102 views
ADD COMMENTlink modified 20 days ago by Tom200 • written 25 days ago by dganiewich30
2
gravatar for Tom
20 days ago by
Tom200
Bielefeld University, CeBiTec, Germany
Tom200 wrote:

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 COMMENTlink written 20 days ago by Tom200
1

woohoo! Thank you very much Tom!

ADD REPLYlink written 20 days ago by dganiewich30
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1303 users visited in the last hour