These are chat archives for nextflow-io/nextflow

4th
Mar 2017
Karin Lagesen
@karinlag
Mar 04 2017 13:56
doing some (more) sat nextflow coding
not sure I understand what -> means?
Paolo Di Tommaso
@pditommaso
Mar 04 2017 14:31
@karinlag that's like a math function f(x) -> y
you can write such function as
def f (x) {
  // .. something
  return y 
}
or
or in the form of a closure
def f = { x -> /* something .. */ return y }
the second form allows you to pass the function f as an argument to another function
Paolo Di Tommaso
@pditommaso
Mar 04 2017 14:37
it must be noted that a closure defines implicitly a parameter it, thus the following two are equivalent
def f = { it -> return it * it  }
def g = {  return it * it }
finally you removing the return keyword, the value of the last evaluated expression is implicitly returned
thus you can rewrite g as
def g = { it * it }
in conclusion, you use -> to define a closure (ie. anonymous function) parameter eg
def f = { a,b,c -> a + b * c }
then, you can invoke it as
println f(1,2,3)
7
Karin Lagesen
@karinlag
Mar 04 2017 14:51
....from your explanation it seems like it's an assignment operator?
Paolo Di Tommaso
@pditommaso
Mar 04 2017 14:52
no!
:)
Karin Lagesen
@karinlag
Mar 04 2017 14:52
it felt wrong, which is why I made that comment
or more, assignment the "other way" or something....
Paolo Di Tommaso
@pditommaso
Mar 04 2017 14:53
it must be read more in the math meaning of f(x) -> y
you can find a detailed explanation here
Karin Lagesen
@karinlag
Mar 04 2017 14:54
thanks!
Paolo Di Tommaso
@pditommaso
Mar 04 2017 14:55
welcome
Karin Lagesen
@karinlag
Mar 04 2017 15:01
heh, never suspected I'd have to learn about closures to figure out my pipeline :smile:
Paolo Di Tommaso
@pditommaso
Mar 04 2017 15:04
well, the joy of being a scientist it that you never stop to learn ;)
Karin Lagesen
@karinlag
Mar 04 2017 15:09
yep :)
q: when debugging this stuff, what\s an easy way of just printing input&output variables inside a process?
Paolo Di Tommaso
@pditommaso
Mar 04 2017 15:11
process foo {
  input: 
  val x from z 

  script: 
  println x 
  """
  <your script>
  """
}
Karin Lagesen
@karinlag
Mar 04 2017 15:11
thanks!
Paolo Di Tommaso
@pditommaso
Mar 04 2017 15:12
if you want to debug the executed task script
cd <task work dir>
bash .command.run
Karin Lagesen
@karinlag
Mar 04 2017 15:13
thanks again :)
Paolo Di Tommaso
@pditommaso
Mar 04 2017 15:13
:+1:
I wish to see a NF Software Carpentry in Oslo :)
Karin Lagesen
@karinlag
Mar 04 2017 15:14
woudl you be willing to come teach?
I could get this organized for the autumn?
Paolo Di Tommaso
@pditommaso
Mar 04 2017 15:14
oh that would be great
Karin Lagesen
@karinlag
Mar 04 2017 15:15
so... for that we just have to whip up some curriculum
:smile:
Paolo Di Tommaso
@pditommaso
Mar 04 2017 15:15
that are quite some NF users in Oslo ..
Karin Lagesen
@karinlag
Mar 04 2017 15:15
yep
Paolo Di Tommaso
@pditommaso
Mar 04 2017 15:15
cool
Karin Lagesen
@karinlag
Mar 04 2017 15:16
thought I could contact a couple of the ones I know of who use it :)
Paolo Di Tommaso
@pditommaso
Mar 04 2017 15:17
I think they would be happy, if you need I can put in contact with some of them
Karin Lagesen
@karinlag
Mar 04 2017 15:17
heh, if it\s the guys at the hospital doing stuff for human genetic diseases, I used to work with them
Paolo Di Tommaso
@pditommaso
Mar 04 2017 15:17
exactly
Karin Lagesen
@karinlag
Mar 04 2017 15:18
I knew they had chosen nextflow for use on the same kind of computers that I\m using, which is why I chose to go with it too
and a couple of them are also swc people, so this is a good match
Paolo Di Tommaso
@pditommaso
Mar 04 2017 15:18
great
for the same kind of computers do you mean the computing cluster ?
Karin Lagesen
@karinlag
Mar 04 2017 15:21
yes
in oslo, we have a normal "open" cluster where people can work, but we also have a cluster set up in the same way which is intended for use on sensitive data
Paolo Di Tommaso
@pditommaso
Mar 04 2017 15:22
if I remember well they use a SLURM cluster
Karin Lagesen
@karinlag
Mar 04 2017 15:22
they and I do
they try to have the sensitive "closed" cluster mirror the open cluster as much as possible re setup and software, so people can test stuff out there before doing things on the sensitive cluster
also, ease of maintenance for them.
Paolo Di Tommaso
@pditommaso
Mar 04 2017 15:23
I see, I guess there's no containers technology there
Karin Lagesen
@karinlag
Mar 04 2017 15:31
there is, they are moving towards that
but containers are not in common use, no
Paolo Di Tommaso
@pditommaso
Mar 04 2017 15:32
good, what technology they are planning to use ?
Karin Lagesen
@karinlag
Mar 04 2017 15:32
docker, most defintively
Paolo Di Tommaso
@pditommaso
Mar 04 2017 15:32
I see
Karin Lagesen
@karinlag
Mar 04 2017 16:18
...how would I go about having , well, basically 2 types of config files
Paolo Di Tommaso
@pditommaso
Mar 04 2017 16:19
what do u mean ?
Karin Lagesen
@karinlag
Mar 04 2017 16:19
  1. having one config for my local computer and another for the cluster I work on, which would change based on cmd line input, or something ellse
  1. a data input config file
i.e. one with computer options, which would only change depending on which system you're on, and another that you change with whatever data you're currently working on
Paolo Di Tommaso
@pditommaso
Mar 04 2017 16:21
you can have two config files or a single one containing separate config profiles
Karin Lagesen
@karinlag
Mar 04 2017 16:21
thanks again!
Paolo Di Tommaso
@pditommaso
Mar 04 2017 16:21
:+1:
Karin Lagesen
@karinlag
Mar 04 2017 16:22
...how does the script figure out which profile is right for the current system?
doh
maybe I should actually read the docs :)
Paolo Di Tommaso
@pditommaso
Mar 04 2017 16:23
you will need to specify on the command line
nextflow run ... -profile your-env