steve
03/21/2024, 7:23 PMworkflow objects from the current Nextflow run to generate some pre-formatted text
however when I write the function, I am doing it like this;
@Function
String makeTable(Map params, Map workflow, Map manifest, List bad_params){
}
I am not sure if this is the best way to write the function? Should I be passing the params and workflow objects as input args to the function? It seems like it might not be a great idea to try to get them from implicit environment variables at runtime. However since I am typing these input args as Map I am not sure if this is gonna actually break in my Nextflow pipeline when I use it like this
include { makeTable } from 'plugin/nf-myutils'
makeTable(params: params, workflow: workflow, manifest: workflow.manifest, bad_params: ['foo_key'])
it keeps breaking with errors like this
nextflow.exception.MissingProcessException: Missing process or function makeTable([[params:[:], workflow:repository: null, projectDir: /Users/.../examples, commitId: null, revision: null, startTime: 2024-03-21T15:12:05.581281-04:00, endTime: null, duration: null, container: {}, commandLine: nextflow run examples/test.nf, nextflow: nextflow.NextflowMeta(version:23.10.1, build:5891, timestamp:12-01-2024 22:01 UTC, preview:nextflow.NextflowMeta$Preview@35d60381, enable:nextflow.NextflowMeta$Features@68ab6ab0, dsl2:true, dsl2Final:true, strictModeEnabled:false), success: false, workDir: /Users/.../work, launchDir: /Users/.../nf-myutils, profile: standard, manifest:nextflow.config.Manifest@5c4cc644, bad_params:[foo_key]]]) -- Did you mean 'makeTable' instead?
not sure what is wrong with this? Does it not like the typing of the Nextflow params and workflow objects I am trying to pass?Jorge
03/21/2024, 7:43 PMinclude { makeTable } from 'plugin/nf-myutils'
makeTable(params, workflow, workflow.manifest, ['foo_key'])steve
03/21/2024, 7:48 PMsteve
03/21/2024, 7:54 PMmakeTable(params, workflow, workflow.manifest, ['foo_key'])
gives
Missing process or function makeTable([[:], repository: null, projectDir: /Users/.../examples, commitId: null, revision: null, startTime: 2024-03-21T15:53:28.814071-04:00, endTime: null, duration: null, container: {}, commandLine: nextflow run examples/test.nf, nextflow: nextflow.NextflowMeta(version:23.10.1, build:5891, timestamp:12-01-2024 22:01 UTC, preview:nextflow.NextflowMeta$Preview@4dfe8b37, enable:nextflow.NextflowMeta$Features@11dcd42c, dsl2:true, dsl2Final:true, strictModeEnabled:false), success: false, workDir: /Users/.../work, launchDir: /Users/.../, profile: standard, nextflow.config.Manifest@3c81cd82, [foo_key]]) -- Did you mean 'makeTable' instead?steve
03/21/2024, 7:55 PMparams and workflow into Map objects? not sureJorge
03/21/2024, 7:56 PMsteve
03/21/2024, 7:58 PMdef 'should return a workflow table' () {
given:
def example = new ExampleFunctions()
example.init(new Session([:]))
def params = ['foo': 1, 'bar': 2, "buzzzz": 5]
def bad_params = ["buzzzz"]
def workflow = ['baz': 3]
def manifest = ['buzz': 4]
def expected = """
some text goes here
"""
when:
def result = example.makeTable(params, workflow, manifest, bad_params)
println result
then:
result == expected
}steve
03/21/2024, 8:03 PMsteve
03/21/2024, 8:03 PMrandomString() function also works.steve
03/21/2024, 8:04 PM@Function decorator or something like that, it seems to be breaking arg passing to the functionsteve
03/21/2024, 8:04 PMsteve
03/21/2024, 8:05 PMprintln makeTable(1)
Missing process or function makeTable([1]) -- Did you mean 'makeTable' instead?Jorge
03/21/2024, 8:12 PMsteve
03/21/2024, 8:24 PM./gradlew test
but when I try to run in a real pipeline, its giving these errors shown
./nextflow run examples/test.nfsteve
03/22/2024, 1:46 AMworkflow object is not acceptable as an arg that is expecting Map