GithubHelp home page GithubHelp logo

Nested params about nf-test HOT 6 CLOSED

birnbera avatar birnbera commented on June 3, 2024
Nested params

from nf-test.

Comments (6)

lukfor avatar lukfor commented on June 3, 2024 1

This feature is now available in version 0.7.1

👉 https://code.askimed.com/nf-test/testcases/global_variables/

from nf-test.

birnbera avatar birnbera commented on June 3, 2024

I just realized that it does work to define params using standard groovy for nested objects, as in:

when {
    params {
        output_dir = "tests/results"
        outer = [inner: 'value']
    }
...

It's not a bad workaround, but it would be nice to have a unified syntax between Nextflow and nf-test. I'd also still be interested in passing params as a file if that were possible.

from nf-test.

lukfor avatar lukfor commented on June 3, 2024

Thanks for reporting this issues and giving nf-test a try. It definitely makes sense to use the same syntax as Nextflow. 👍 We will try to fix it.

Passing params as a file is not yet supported, but we will think about it...

from nf-test.

Khushbu04in avatar Khushbu04in commented on June 3, 2024

Thanks for reporting this issues and giving nf-test a try. It definitely makes sense to use the same syntax as Nextflow. 👍 We will try to fix it.

Passing params as a file is not yet supported, but we will think about it...

We tried doing that and it is working for us:
def other_param_yaml = new FileInputStream(new File("file name"))
new Yaml().load(other_param_yaml).each { k, v -> delegate[k] = v }

from nf-test.

lukfor avatar lukfor commented on June 3, 2024

Thank you @Khushbu04in! I will reuse your code to create a load function:

when {
    params {
        load("file name")
    }

Best, lukas.

from nf-test.

odoublewen avatar odoublewen commented on June 3, 2024

Passing params from a file (json, yaml, etc) is almost a must have feature, IMO. We have big datasets we'd like to test and it would (will) be very painful to convert the json to the groovy object notation. I'm not sure of anyway to do it other than by hand.

@Khushbu04in could you share your full approach? I'm not sure how to get the data into the when {} closure.

I can do this outside of nextflow_pipeline{}:

slurper = new groovy.json.JsonSlurper()                                                                                                                                                      
params_file = new File('tests/data/params/params.json')                                                                                                                           
params_data = slurper.parseText(params_file.text)

... and it works in the sense that params_data holds the params in groovy dotted notation.

But if I then do this:

    test("Should run without failures") {

        when {
            params = params_data
        }

I get this:

groovy.lang.MissingPropertyException: No such property: params_data for class: com.askimed.nf.test.lang.TestContext

from nf-test.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.