These are chat archives for nextflow-io/nextflow

21st
Nov 2014
Michael L Heuer
@heuermh
Nov 21 2014 21:28
Hello! Am wondering which emacs mode I should use for editing .nf files. Fundamental doesn't cut it, maybe I should try a groovy mode?
Michael L Heuer
@heuermh
Nov 21 2014 23:14
And a second question, how might I scope a param value such that all processes can read it? If I put it in a Channel it gets read once and is gone
Paolo Di Tommaso
@pditommaso
Nov 21 2014 23:45
Hi there
Michael L Heuer
@heuermh
Nov 21 2014 23:47
Hello
Paolo Di Tommaso
@pditommaso
Nov 21 2014 23:47
Well, nextflow is a superset of groovy programming lang
You may want to try opening it in groovy mode
But I have no experience with it.
Actually, It would be nice to a Emacs nextflow mode
I would like to investigate that.
About your second question
any variable declared outside the process scope, can be referenced by the following processes
(but it should not be used for shared access)
Michael L Heuer
@heuermh
Nov 21 2014 23:52
ok, just installed groovy-mode for emacs, just need to figure out how to make it active for .nf files
Paolo Di Tommaso
@pditommaso
Nov 21 2014 23:52
sorry no experience with that
Michael L Heuer
@heuermh
Nov 21 2014 23:53
for example, I have param.sample declared at the top of my file and want to use that value inside each process
Meta-X groovy-mode works :)
Paolo Di Tommaso
@pditommaso
Nov 21 2014 23:54
as simple as that
params.sample = 'x'


process doThis {

  """
  echo ${params.sample} 
  """ 
}

process doThat {

  """
  echo ${params.sample} 
  """ 
}
Michael L Heuer
@heuermh
Nov 21 2014 23:55
then if I something similaroutput:
file "${params.sample}.ssake.fa.gz" into ssakeFasta

I get General error during conversion: Cannot cast object 'org.codehaus.groovy.ast.expr.PropertyExpression@63a3bd86[object: org.codehaus.groovy.ast.expr.VariableExpression@12efdb85[variable: params] property: ConstantExpression[sample]]' with class 'org.codehaus.groovy.ast.expr.PropertyExpression' to class 'org.codehaus.groovy.ast.expr.VariableExpression'

org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'org.codehaus.groovy.ast.expr.PropertyExpression@63a3bd86[object: org.codehaus.groovy.ast.expr.VariableExpression@12efdb85[variable: params] property: ConstantExpression[sample]]' with class 'org.codehaus.groovy.ast.expr.PropertyExpression' to class 'org.codehaus.groovy.ast.expr.VariableExpression'

sorry about formatting
Paolo Di Tommaso
@pditommaso
Nov 21 2014 23:55
ah
that is an open bug
nextflow-io/nextflow#18
Michael L Heuer
@heuermh
Nov 21 2014 23:56
I see
Can I assign params.sample to another variable and then use that in the expression?
Currently I'm going
```groovy
sample = Channel.from(params.sample)
process foo {
  input:
    val s from sample
}
sample = Channel.from(params.sample)
process bar {
  input:
    val s from sample
}
That seems ick
Paolo Di Tommaso
@pditommaso
Nov 21 2014 23:59
umh, a workaround could be something liek this
params.sample = 'x'


process doThis {

  output: 
  ile "${fileName}.ssake.fa.gz" into ssakeFasta 

  script: 
  def fileName = params.sample    
  """
  echo ${params.sample} 
  """ 
}
but my suggestion is to avoid to to encode the "meta-data" in the file name