Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function for mapcombinemultimap #339

Merged
merged 7 commits into from
Aug 2, 2023
Merged

Conversation

jfy133
Copy link
Member

@jfy133 jfy133 commented Jul 27, 2023

Extremely naïve attempt to create a map -> combine -> multiMap function (second suggestion to close #207 ), however this currently fails due to a

Missing process or function doCall()

<...>

Caused by: groovy.lang.MissingMethodException: No signature of method: WorkflowTaxprofiler$_mapCombineMultimap_closure2.doCall() is applicable for argument types: () values: []
Possible solutions: doCall(java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object), isCase(java.lang.Object), isCase(java.lang.Object), findAll(), findAll(), f
indAll(groovy.lang.Closure)

error... I'm not sure what is causing this

Test command:

nextflow run ../main.nf -profile singularity,test_nothing --run_centrifuge --outdir ./results -dump-channels

I tried to base the structure of the code on: https://github.com/Midnighter/nextflow-utility-services/blob/main/lib/CustomChannelOperators.groovy

PR checklist

  • This comment contains a description of changes (with reason).
  • If you've fixed a bug or added code that should be tested, add tests!
  • If you've added a new tool - have you followed the pipeline conventions in the contribution docs- [ ] If necessary, also make a PR on the nf-core/taxprofiler branch on the nf-core/test-datasets repository.
  • Make sure your code lints (nf-core lint).
  • Ensure the test suite passes (nextflow run . -profile test,docker --outdir <OUTDIR>).
  • Usage Documentation in docs/usage.md is updated.
  • Output Documentation in docs/output.md is updated.
  • CHANGELOG.md is updated.
  • README.md is updated (including new tool citations and authors/contributors).

@jfy133 jfy133 requested a review from Midnighter July 27, 2023 13:01
@jfy133 jfy133 marked this pull request as draft July 27, 2023 13:01
@github-actions
Copy link

github-actions bot commented Jul 27, 2023

nf-core lint overall result: Passed ✅ ⚠️

Posted for pipeline commit e38b36a

+| ✅ 157 tests passed       |+
!| ❗   1 tests had warnings |!

❗ Test warnings:

  • pipeline_todos - TODO string in methods_description_template.yml: #Update the HTML below to your preferred methods description, e.g. add publication citation for this pipeline

✅ Tests passed:

Run details

  • nf-core/tools version 2.9
  • Run at 2023-08-01 07:51:17

@jfy133
Copy link
Member Author

jfy133 commented Jul 28, 2023

With your suggestion:

    static mapCombineMultimap(ch_profile, ch_database) {

        ch_prepped_channel = ch_profile
            .map { meta, profile -> [meta.db_name, meta, profile] }
            .combine(ch_database, by: 0)
            .multiMap {
                key, meta, profile, db_meta, db ->
                    profile: [meta, profile]
                    db: db
            }

        return ch_prepped_channel
    }

I get the following:

$ nextflow run ../main.nf -profile singularity,test_nothing --run_centrifuge --outdir ./results -dump-channels
N E X T F L O W  ~  version 23.04.1
Launching `../main.nf` [zen_descartes] DSL2 - revision: e2bcf7b1a1
ERROR ~ BUG! exception in phase 'semantic analysis' in source unit 'Script_25d1d7c6' The lookup for WorkflowTaxprofiler caused a failed compilation. There should not have been any compilation from this call.

 -- Check script '/home/james/git/nf-core/taxprofiler/main.nf' at line: 52 or see '.nextflow.log' file for more details

in teh log

Jul-28 22:05:10.469 [main] DEBUG nextflow.Session - Session aborted -- Cause: BUG! exception in phase 'semantic analysis' in source unit 'Script_25d1d7c6' The lookup for WorkflowTaxprofiler caused a failed compilation. There should not have been any compilation from this call.
Jul-28 22:05:10.487 [main] ERROR nextflow.cli.Launcher - @unknown
org.codehaus.groovy.GroovyBugError: BUG! exception in phase 'semantic analysis' in source unit 'Script_25d1d7c6' The lookup for WorkflowTaxprofiler caused a failed compilation. There should not have been any compilation from this call.
        at org.codehaus.groovy.control.ClassNodeResolver.findByClassLoading(ClassNodeResolver.java:214)
        at org.codehaus.groovy.control.ClassNodeResolver.tryAsLoaderClassOrScript(ClassNodeResolver.java:198)
        at org.codehaus.groovy.control.ClassNodeResolver.findClassNode(ClassNodeResolver.java:169)
        at org.codehaus.groovy.control.ClassNodeResolver.resolveName(ClassNodeResolver.java:125)
        at org.codehaus.groovy.control.ResolveVisitor.resolveToOuter(ResolveVisitor.java:869)
        at org.codehaus.groovy.control.ResolveVisitor.resolve(ResolveVisitor.java:506)
        at org.codehaus.groovy.control.ResolveVisitor.resolve(ResolveVisitor.java:468)
        at org.codehaus.groovy.control.ResolveVisitor.transformVariableExpression(ResolveVisitor.java:1129)
        at org.codehaus.groovy.control.ResolveVisitor.transform(ResolveVisitor.java:888)
        at org.codehaus.groovy.control.ResolveVisitor.transformMethodCallExpression(ResolveVisitor.java:1274)
        at org.codehaus.groovy.control.ResolveVisitor.transform(ResolveVisitor.java:896)
        at org.codehaus.groovy.ast.ClassCodeExpressionTransformer.visitExpressionStatement(ClassCodeExpressionTransformer.java:108)
        at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:40)
        at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:86)
        at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:164)
        at org.codehaus.groovy.control.ResolveVisitor.visitBlockStatement(ResolveVisitor.java:1566)
        at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:69)
        at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:138)
        at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:111)
        at org.codehaus.groovy.ast.ClassCodeExpressionTransformer.visitConstructorOrMethod(ClassCodeExpressionTransformer.java:66)
        at org.codehaus.groovy.control.ResolveVisitor.visitConstructorOrMethod(ResolveVisitor.java:294)
        at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:106)
        at org.codehaus.groovy.ast.ClassNode.visitMethods(ClassNode.java:1094)
        at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1087)
        at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:52)
        at org.codehaus.groovy.control.ResolveVisitor.visitClass(ResolveVisitor.java:1483)
        at org.codehaus.groovy.control.ResolveVisitor.startResolving(ResolveVisitor.java:262)
        at org.codehaus.groovy.control.CompilationUnit.lambda$new$16(CompilationUnit.java:739)
        at org.codehaus.groovy.control.CompilationUnit$ISourceUnitOperation.doPhaseOperation(CompilationUnit.java:902)
        at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:628)
        at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:389)
        at groovy.lang.GroovyClassLoader.lambda$parseClass$3(GroovyClassLoader.java:332)
        at org.codehaus.groovy.runtime.memoize.StampedCommonCache.compute(StampedCommonCache.java:163)
        at org.codehaus.groovy.runtime.memoize.StampedCommonCache.getAndPut(StampedCommonCache.java:154)
        at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:330)
        at groovy.lang.GroovyShell.parseClass(GroovyShell.java:526)
        at groovy.lang.GroovyShell.parse(GroovyShell.java:538)
        at groovy.lang.GroovyShell.parse(GroovyShell.java:570)
        at nextflow.script.ScriptParser.parse(ScriptParser.groovy:169)
        at nextflow.script.ScriptParser.parse(ScriptParser.groovy:194)
        at nextflow.script.ScriptParser.runScript(ScriptParser.groovy:214)
        at nextflow.script.ScriptParser.runScript(ScriptParser.groovy:205)
        at nextflow.script.IncludeDef.memoizedMethodPriv$loadModule0PathMapSession(IncludeDef.groovy:151)
        at nextflow.script.IncludeDef.access$0(IncludeDef.groovy)
        at nextflow.script.IncludeDef$__clinit__closure2.doCall(IncludeDef.groovy)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:107)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:274)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1035)
        at groovy.lang.Closure.call(Closure.java:412)
        at org.codehaus.groovy.runtime.memoize.Memoize$MemoizeFunction.lambda$call$0(Memoize.java:137)
        at org.codehaus.groovy.runtime.memoize.ConcurrentCommonCache.getAndPut(ConcurrentCommonCache.java:137)
        at org.codehaus.groovy.runtime.memoize.ConcurrentCommonCache.getAndPut(ConcurrentCommonCache.java:113)
        at org.codehaus.groovy.runtime.memoize.Memoize$MemoizeFunction.call(Memoize.java:136)
        at nextflow.script.IncludeDef.loadModule0(IncludeDef.groovy)
        at nextflow.script.IncludeDef.load0(IncludeDef.groovy:123)
        at nextflow.script.IncludeDef$load0$1.call(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:139)
        at Script_1a59717b.runScript(Script_1a59717b:52)
        at nextflow.script.BaseScript.run0(BaseScript.groovy:145)
        at nextflow.script.BaseScript.run(BaseScript.groovy:192)
        at nextflow.script.ScriptParser.runScript(ScriptParser.groovy:229)
        at nextflow.script.ScriptRunner.run(ScriptRunner.groovy:224)
        at nextflow.script.ScriptRunner.execute(ScriptRunner.groovy:130)
        at nextflow.cli.CmdRun.run(CmdRun.groovy:368)
        at nextflow.cli.Launcher.run(Launcher.groovy:494)
        at nextflow.cli.Launcher.main(Launcher.groovy:653)
Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
/home/james/git/nf-core/taxprofiler/lib/WorkflowTaxprofiler.groovy: 261: Apparent variable 'ch_prepped_channel' was found in a static scope but doesn't refer to a local variable, static field or class. Possible causes:
You attempted to reference a variable in the binding or an instance variable from a static context.
You misspelled a classname or statically imported field. Please check the spelling.
You attempted to use a method 'ch_prepped_channel' but left out brackets in a place not allowed by the grammar.
 @ line 261, column 9.
           ch_prepped_channel = ch_profile
           ^

/home/james/git/nf-core/taxprofiler/lib/WorkflowTaxprofiler.groovy: 270: Apparent variable 'ch_prepped_channel' was found in a static scope but doesn't refer to a local variable, static field or class. Possible causes:
You attempted to reference a variable in the binding or an instance variable from a static context.
You misspelled a classname or statically imported field. Please check the spelling.
You attempted to use a method 'ch_prepped_channel' but left out brackets in a place not allowed by the grammar.
 @ line 270, column 16.
           return ch_prepped_channel
                  ^

2 errors

        at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:292)
        at org.codehaus.groovy.control.CompilationUnit$IPrimaryClassNodeOperation.doPhaseOperation(CompilationUnit.java:985)
        at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:672)
        at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:636)
        at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:389)
        at groovy.lang.GroovyClassLoader.lambda$parseClass$3(GroovyClassLoader.java:332)
        at org.codehaus.groovy.runtime.memoize.StampedCommonCache.compute(StampedCommonCache.java:163)
        at org.codehaus.groovy.runtime.memoize.StampedCommonCache.getAndPut(StampedCommonCache.java:154)
        at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:330)
        at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:314)
        at groovy.lang.GroovyClassLoader.recompile(GroovyClassLoader.java:954)
        at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:910)
        at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:979)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:574)
        at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:869)
        at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:745)
        at org.codehaus.groovy.control.ClassNodeResolver.findByClassLoading(ClassNodeResolver.java:209)
        ... 72 common frames omitted

@jfy133
Copy link
Member Author

jfy133 commented Jul 28, 2023

Prepending def to ch_prepped_channel = doesn't work (as I sort of expect as it's not a variable.) with a 'Missing process or function doCall()' error,

And instead prepending back DataflowBroadcast does the same (e.g DataflowBroadcast ch_prepped_channel = ch_profile gives a Missing process or function doCall() console log error, and .nextflow.log error below)

Jul-28 22:08:23.087 [main] ERROR nextflow.cli.Launcher - @unknown
nextflow.exception.MissingProcessException: Missing process or function doCall()
        at nextflow.script.WorkflowDef.run(WorkflowDef.groovy:191)
        at nextflow.script.BindableDef.invoke_a(BindableDef.groovy:51)
        at nextflow.script.ComponentDef.invoke_o(ComponentDef.groovy:40)
        at nextflow.script.WorkflowBinding.invokeMethod(WorkflowBinding.groovy:102)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeOnDelegationObjects(ClosureMetaClass.java:408)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:350)
        at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:61)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:171)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:194)
        at Script_25d1d7c6$_runScript_closure2$_closure4.doCall(Script_25d1d7c6:248)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:107)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:274)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1035)
        at groovy.lang.Closure.call(Closure.java:412)
        at groovy.lang.Closure.call(Closure.java:406)
        at nextflow.script.WorkflowDef.run0(WorkflowDef.groovy:204)
        at nextflow.script.WorkflowDef.run(WorkflowDef.groovy:188)
        at nextflow.script.BindableDef.invoke_a(BindableDef.groovy:51)
        at nextflow.script.ComponentDef.invoke_o(ComponentDef.groovy:40)
        at nextflow.script.WorkflowBinding.invokeMethod(WorkflowBinding.groovy:102)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeOnDelegationObjects(ClosureMetaClass.java:408)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:350)
        at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:61)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:171)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:176)
        at Script_1a59717b$_runScript_closure1$_closure3.doCall(Script_1a59717b:58)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:107)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:274)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1035)
        at groovy.lang.Closure.call(Closure.java:412)
        at groovy.lang.Closure.call(Closure.java:406)
        at nextflow.script.WorkflowDef.run0(WorkflowDef.groovy:204)
        at nextflow.script.WorkflowDef.run(WorkflowDef.groovy:188)
        at nextflow.script.BindableDef.invoke_a(BindableDef.groovy:51)
        at nextflow.script.ComponentDef.invoke_o(ComponentDef.groovy:40)
        at nextflow.script.WorkflowBinding.invokeMethod(WorkflowBinding.groovy:102)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeOnDelegationObjects(ClosureMetaClass.java:408)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:350)
        at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:61)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:171)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:176)
        at Script_1a59717b$_runScript_closure2$_closure4.doCall(Script_1a59717b:72)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:107)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:274)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1035)
        at groovy.lang.Closure.call(Closure.java:412)
        at groovy.lang.Closure.call(Closure.java:406)
        at nextflow.script.WorkflowDef.run0(WorkflowDef.groovy:204)
        at nextflow.script.WorkflowDef.run(WorkflowDef.groovy:188)
        at nextflow.script.BindableDef.invoke_a(BindableDef.groovy:51)
        at nextflow.script.ChainableDef$invoke_a.call(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:139)
        at nextflow.script.BaseScript.run0(BaseScript.groovy:183)
        at nextflow.script.BaseScript.run(BaseScript.groovy:192)
        at nextflow.script.ScriptParser.runScript(ScriptParser.groovy:229)
        at nextflow.script.ScriptRunner.run(ScriptRunner.groovy:224)
        at nextflow.script.ScriptRunner.execute(ScriptRunner.groovy:130)
        at nextflow.cli.CmdRun.run(CmdRun.groovy:368)
        at nextflow.cli.Launcher.run(Launcher.groovy:494)
        at nextflow.cli.Launcher.main(Launcher.groovy:653)
Caused by: groovy.lang.MissingMethodException: No signature of method: WorkflowTaxprofiler$_mapCombineMultimap_closure2.doCall() is applicable for argument types: () values: []
Possible solutions: doCall(java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object), isCase(java.lang.Object), isCase(java.lang.Object), findAll(), findAll(), findAll(groovy.lang.Closure)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:266)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1035)
        at groovy.lang.Closure.call(Closure.java:412)
        at groovy.lang.Closure.call(Closure.java:406)
        at nextflow.extension.MultiMapOp.<init>(MultiMapOp.groovy:41)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
        at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:72)
        at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:59)
        at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:110)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:286)
        at nextflow.extension.OperatorImpl.multiMap(OperatorImpl.groovy:1227)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:107)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1258)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1035)
        at groovy.lang.DelegatingMetaClass.invokeMethod(DelegatingMetaClass.java:147)
        at nextflow.extension.OpCall.invoke1(OpCall.groovy:317)
        at nextflow.extension.OpCall.invoke0(OpCall.groovy:303)
        at nextflow.extension.OpCall.invoke(OpCall.groovy:163)
        at nextflow.extension.OpCall.call(OpCall.groovy:113)
        at nextflow.plugin.extension.PluginExtensionProvider.invokeExtensionMethod(PluginExtensionProvider.groovy:282)
        at groovy.runtime.metaclass.NextflowDelegatingMetaClass.invokeMethod(NextflowDelegatingMetaClass.java:58)
        at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:44)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:139)
        at WorkflowTaxprofiler.mapCombineMultimap(WorkflowTaxprofiler.groovy:262)
        at WorkflowTaxprofiler$mapCombineMultimap$0.call(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:148)
        at Script_05b7b79d$_runScript_closure1$_closure2.doCall(Script_05b7b79d:242)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:107)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:274)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1035)
        at groovy.lang.Closure.call(Closure.java:412)
        at groovy.lang.Closure.call(Closure.java:406)
        at nextflow.script.WorkflowDef.run0(WorkflowDef.groovy:204)
        at nextflow.script.WorkflowDef.run(WorkflowDef.groovy:188)
        ... 79 common frames omitted

The placement of the function is debatable, but to have its definition evaluated by nextflow, rather than pure Groovy makes it work.
@Midnighter
Copy link
Collaborator

I couldn't fully test this as I was working in a codespace, but the original error went away by moving the function to a nextflow module. Let's see what the test suite says.

@jfy133 jfy133 marked this pull request as ready for review August 1, 2023 07:51
@jfy133 jfy133 requested review from Midnighter and a team August 1, 2023 07:51
@jfy133
Copy link
Member Author

jfy133 commented Aug 2, 2023

include still didn't work :( for now I'm happy with what we have (even if still slightly suboptiomal, if it's OK with you @Midnighter ?

@jfy133 jfy133 merged commit 7963917 into dev Aug 2, 2023
20 checks passed
@jfy133 jfy133 deleted the function-for-mapcombinemultimap branch August 2, 2023 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants