These are chat archives for nextflow-io/nextflow

22nd
Nov 2018
cpang429
@cpang429
Nov 22 2018 02:47
Hello, I'm working on writing a pipeline for analyzing long-read RNA-Seq data, and would like to integrate a couple R scripts into my Nextflow script. Can somebody advise on how to do this? Thank you in advance.
Alexander Peltzer
@apeltzer
Nov 22 2018 06:41
Store them in baseDir/bin and you can simply call them
cpang429
@cpang429
Nov 22 2018 08:34
Thank you, I will try that
Anthony Underwood
@aunderwo
Nov 22 2018 10:46
One thing I think would be a helpful topic for the #nfhack18 would be to make a repo for all the useful helper functions that people use in their pipelines with a README.md explaining what each does. For instance I have a helper function to do param checking which I am sure many others have done also. A repo of utility functions could be useful to the community
Alexander Peltzer
@apeltzer
Nov 22 2018 10:49
You mean by adding to this one? https://github.com/nextflow-io/patterns
Ah no, probably a bit different then
Anthony Underwood
@aunderwo
Nov 22 2018 10:52

A subdir in that repo path could work. Slightly different though . A collection of useful functions for reuse.

For instance here are some of the functions I include in a file lib/Helper.groovy

static def check_mandatory_parameter(Map params, String parameter_name){
        if ( !params[parameter_name]){
            println "You must specifiy a " + parameter_name
            System.exit(1)
        } else {
            return params[parameter_name]
        }
    }

    static def check_optional_parameters(Map params, List parameter_names){
        if (parameter_names.collect{element -> params[element]}.every{element -> element == false}){
            println "You must specifiy at least one of these options: " + parameter_names.join(", ")
            System.exit(1)
        }
    }

    static def check_parameter_value(String parameter_name, String value, List value_options){
        if (value_options.any{ it == value }){
            return value
        } else {
            println "The value for " + parameter_name + " must be one of " + value_options.join(", ")
            System.exit(1)
        }
    }
Alexander Peltzer
@apeltzer
Nov 22 2018 10:54
True
Anthony Underwood
@aunderwo
Nov 22 2018 10:57
With these I was wanting something sort of like Python's argparse
Evan Floden
@evanfloden
Nov 22 2018 10:59
@aunderwo Have your seen this issue? Attempts to deal with parameter types nextflow-io/nextflow#866
Anthony Underwood
@aunderwo
Nov 22 2018 11:03
@evanfloden - I do remember seeing the early posts on that issue but hadn't looked for a while. It seems to have come a long way. The methodologies proposed look interesting but are a bit beyond my programming skillset
@evanfloden Thanks for the helpful reminder
LukeGoodsell
@LukeGoodsell
Nov 22 2018 16:35
@evanfloden new nfhack18 idea: nextflow-io/nextflow#936
micans
@micans
Nov 22 2018 18:10
@pditommaso , any chance we could have syntactic sugar; ch_rnaseq .when{ params.run_rnaseq } (or given or something similar) is much more readable than ch_rnaseq .until{ ! params.run_rnaseq } ?
Take some time to think about it :-)
Paolo Di Tommaso
@pditommaso
Nov 22 2018 18:18
pushed patch both for #877 and #824
tbugfinder
@tbugfinder
Nov 22 2018 22:44
In regards to the GUI discussion: Would VSCode and a nextflow code completion (intellisense) be considered as a GUI too? How about the integration with Jupyter ?