These are chat archives for nextflow-io/nextflow

4th
Aug 2017
Anthony Underwood
@aunderwo
Aug 04 2017 07:04

Hi all.

I'm trying to test if a param has been passed in with

if ( params.paired_read_dir ) { 
   ....
}

I get a warning

WARN: Access to undefined parameter `paired_read_dir` -- Initialise it to a default value eg. `params.paired_read_dir = some_value`

What is the preferred way for testing of a parameter having been set?

Anthony Underwood
@aunderwo
Aug 04 2017 07:19
Also in groovy is it possible to extract a params by 'sending' a string e.g
params.send("paired_read_dir")
Paolo Di Tommaso
@pditommaso
Aug 04 2017 08:06
Hi Antony, regarding the warning you need to initialise the parameter to a (default) value before using it
if you don't have any just set it to false
Also in groovy is it possible to extract a params by 'sending' a string e.g
what do you mean ?
@mhalagan-nmdp regarding the confirmation, currently it's not possible, but please open a feature request for that. it's easily doable
Anthony Underwood
@aunderwo
Aug 04 2017 12:12

@pditommaso I was trying to write a method to check a param (those that are mandatory) and because I wanted to be DRY wanted to pass in the param to check

so rather than params.ARG1 , something like params.get("ARG1")

When running Singularity I have a tool that is trying to write to the Singularity filesystem

I get the error

[04 Aug 2017 12:06:30-lIF][file_util.c:169] Fatal Error: Cannot write to file: /usr/local/lib/python3.5/site-packages/mykatlas/atlas/data/skeletons/staph-species-160227-staph-amr-bradley_2015-feb-17-2017_15.ctx [Read-only file system]

Is it possible to mount Singularity image as writable?
@pditommaso Thanks this works nicely
Paolo Di Tommaso
@pditommaso
Aug 04 2017 12:17
the params object is a Map, to you can use get of containsKey
I think it should even work
Anthony Underwood
@aunderwo
Aug 04 2017 12:18

This seems to work

def check_parameter(params, parameter_name){
   if ( !params[parameter_name]){
      error "You must specifiy a " + parameter_name
   } else {
      variable = params[parameter_name]
      return variable
   }

}

Is that idiomatic?

Paolo Di Tommaso
@pditommaso
Aug 04 2017 12:18
if( 'paired_read_dir' in params ) { .. etc }
Anthony Underwood
@aunderwo
Aug 04 2017 12:18
used the params[] notation
could I also have used params.get('paired_read_dir')?
Anthony Underwood
@aunderwo
Aug 04 2017 12:24

When running Singularity I have a tool that is trying to write to the Singularity filesystem

I get the error

[04 Aug 2017 12:06:30-lIF][file_util.c:169] Fatal Error: Cannot write to file: /usr/local/lib/python3.5/site-packages/mykatlas/atlas/data/skeletons/staph-species-160227-staph-amr-bradley_2015-feb-17-2017_15.ctx [Read-only file system]

I think this needs to be solved by the software author. I don't have this issue with Docker- are Docker images writable?
Paolo Di Tommaso
@pditommaso
Aug 04 2017 12:30
could I also have used
yes
Fatal Error: Cannot write to file
yes, with singularity you can only write in the home and /tmp by default
cannot that configured to write in another path ?
Anthony Underwood
@aunderwo
Aug 04 2017 12:33
Ok will contact author - thanks :thumbsup:
Evan Floden
@evanfloden
Aug 04 2017 14:15

Greetings all,

I think I have some unexpected behaviour.

I have process with a when conditional.
The script part calls a template.

Problem is, NF complains and dies if the template does not exist, even when the condition is not meet. Eg.

param.x=false

process foo {
    when:
        param.x ==true 
    script:
        template "xyz.sh"
}
The above case does made immediate sense but in my use case there are many templates, some which work with param.x, and some that don't.
Basically NF requires the template before testing if it should be executed.
Paolo Di Tommaso
@pditommaso
Aug 04 2017 14:18
I guess so
but what's the ratio to use a template which does not exist ?!
Evan Floden
@evanfloden
Aug 04 2017 14:19
Because the template name is dynamically generated. It exists in some conditions, but not others.
Paolo Di Tommaso
@pditommaso
Aug 04 2017 14:19
ahh!!
Evan Floden
@evanfloden
Aug 04 2017 14:19
(You suggested this BTW :laughing: )
Paolo Di Tommaso
@pditommaso
Aug 04 2017 14:20
pushing to a new limit!! :D
need to check not sure what can be done
Evan Floden
@evanfloden
Aug 04 2017 14:21
NP. I can create empty template files for now :+1:
Will push stuff later so you can see.
Félix C. Morency
@fmorency
Aug 04 2017 14:24

(You suggested this BTW :laughing: )

lol

Paolo Di Tommaso
@pditommaso
Aug 04 2017 14:25
there are some chances
the when is evaluated here
instead the template is resolved in the method invoked in the previous line ..
Evan Floden
@evanfloden
Aug 04 2017 14:26
cool, so a switcharoo could be on the cards
Paolo Di Tommaso
@pditommaso
Aug 04 2017 14:30
unbelievable!
I have the ` key that works only if I open the mac virtual keyboard .. :satisfied:
Anyhow 0.25.5 is out :tada:
Evan Floden
@evanfloden
Aug 04 2017 14:31
:gin&tonic:
:wink:
Paolo Di Tommaso
@pditommaso
Aug 04 2017 14:32
ahah
@mhalagan-nmdp now the cloud create command has a -y option to skip the confirmation message
Paolo Di Tommaso
@pditommaso
Aug 04 2017 14:42
@skptic and a new hot snapshot with your fix 0.25.6-SNAPSHOT
give a try and let me know
Evan Floden
@evanfloden
Aug 04 2017 14:46
@pditommaso fucking beautiful. 29 min from bug detection to bug solved. Thanks to @edgano for helping to point out the issue too.
Paolo Di Tommaso
@pditommaso
Aug 04 2017 14:51
I can do even better, from feature request to stable release in 5 mins nextflow-io/nextflow#418
:joy:
Evan Floden
@evanfloden
Aug 04 2017 14:52
Now you are just showing off. I'm still not convinced there is only one @pditommaso
Paolo Di Tommaso
@pditommaso
Aug 04 2017 14:53
ahahah
Evan Floden
@evanfloden
Aug 04 2017 14:53
At any given moment, one is sailing, one is sleeping and one is coding.
Paolo Di Tommaso
@pditommaso
Aug 04 2017 14:54
well actually it's to go :sailboat: !!
:wave: :wave: :wave:
Félix C. Morency
@fmorency
Aug 04 2017 15:28
I played a bit with NF yesterday on FreeBSD and it would seems that the installation script make use of deprecated mktemp flags (namely -p and -t)
Félix C. Morency
@fmorency
Aug 04 2017 15:37
The fix is quite simple. I'll make a PR after all my testing