illegal string body character after dollar sign

Skip to first unread message

Eduard Valera Zorita

unread,
Mar 30, 2017, 1:05:49 PM3/30/17
to Nextflow
I am getting the following error and I don't understand why:


_nf_script_72c850b0: 292: illegal string body character after dollar sign;
solution: either escape a literal dollar sign "\$5" or bracket the value expression "${5}" @ line 292, column 17.
zcat -f ${cdna} | awk 'BEGIN{p=0; IGNORECASE=1;} {
                    ^
1 error


this is the process code:

process buildKallistoIndex
{
   
// Process options
   tag
"${kpath}"
   
// Cluster options
   cpus
1
   memory
'32GB'

   input
:
   file kpath
from kindex_path
   file cdna  
from cdna_file

   output
:
   file kpath
into kallisto_index

   script
:
   
"""
  #!/usr/bin/env bash
  zcat -f ${cdna} | awk 'BEGIN{p=0; IGNORECASE=1;} {
  if($1 ~ /^>/) {
  split($0,chr,"
:");
  if (chr[4] ~ /^[MYX0-9][T0-9]*/) { p = 1; }
  else { p = 0; }
  }
  if (p == 1) { print $0; }
  }' > transcripts_chr.fasta
  kalisto index -i ${kpath} transcripts_chr.fasta
  """

}

I used ${} inside scripts before without any problem.

Thanks

Paolo Di Tommaso

unread,
Mar 30, 2017, 1:44:42 PM3/30/17
to nextflow
Because you need to escape the $0 awk variable ie. \$0. 

Alternatively you can use a shell script, which uses a different placeholder for NF variables.  


Cheers,
p


--
You received this message because you are subscribed to the Google Groups "Nextflow" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nextflow+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/nextflow.
For more options, visit https://groups.google.com/d/optout.

Eduard Valera Zorita

unread,
Mar 31, 2017, 7:01:42 AM3/31/17
to Nextflow
I see, I got mislead because when I added \$ I consistently got a "no such variable: process" and the fact that the ^ pointed to ${cdna}.

However, I just found out that the "no such variable: process" is an independent bug on output channel described here: https://groups.google.com/forum/#!searchin/nextflow/no$20such$20variable$20process%7Csort:relevance/nextflow/DGEzkj5I7eg/HARXMuP5BwAJ

Thanks!
To unsubscribe from this group and stop receiving emails from it, send an email to nextflow+u...@googlegroups.com.

Paolo Di Tommaso

unread,
Mar 31, 2017, 7:23:19 AM3/31/17
to nextflow

To unsubscribe from this group and stop receiving emails from it, send an email to nextflow+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages