From b74e23b82fb1151759fcb28debefe1709b6cea6b Mon Sep 17 00:00:00 2001 From: Ben Sherman Date: Thu, 14 Nov 2024 13:30:12 -0600 Subject: [PATCH] Refactor Constant, Function, DslType -> Description Signed-off-by: Ben Sherman --- .../nextflow/config/dsl/ConfigSchema.java | 4 +- .../nextflow/lsp/ast/ASTNodeStringUtils.java | 22 ++-- .../script/ScriptCompletionProvider.java | 19 +-- .../services/script/VariableScopeVisitor.java | 15 ++- .../dsl/{Constant.java => Description.java} | 4 +- .../groovy/nextflow/script/dsl/DslType.java | 27 ----- .../nextflow/script/dsl/FeatureFlag.java | 3 +- .../nextflow/script/dsl/FeatureFlagDsl.java | 63 +++++----- .../groovy/nextflow/script/dsl/Function.java | 27 ----- .../nextflow/script/dsl/OutputDsl.groovy | 30 ++--- .../nextflow/script/dsl/ProcessDsl.groovy | 112 +++++++++--------- .../nextflow/script/dsl/ScriptDsl.groovy | 42 +++---- .../nextflow/script/dsl/WorkflowDsl.groovy | 88 +++++++------- .../groovy/nextflow/script/types/Channel.java | 27 ++--- 14 files changed, 207 insertions(+), 276 deletions(-) rename src/main/groovy/nextflow/script/dsl/{Constant.java => Description.java} (89%) delete mode 100644 src/main/groovy/nextflow/script/dsl/DslType.java delete mode 100644 src/main/groovy/nextflow/script/dsl/Function.java diff --git a/src/main/groovy/nextflow/config/dsl/ConfigSchema.java b/src/main/groovy/nextflow/config/dsl/ConfigSchema.java index 97ba58d..cce8e73 100644 --- a/src/main/groovy/nextflow/config/dsl/ConfigSchema.java +++ b/src/main/groovy/nextflow/config/dsl/ConfigSchema.java @@ -20,7 +20,7 @@ import java.util.Map; import nextflow.config.scopes.*; -import nextflow.script.dsl.Function; +import nextflow.script.dsl.Description; import nextflow.script.dsl.ProcessDirectiveDsl; public class ConfigSchema { @@ -110,7 +110,7 @@ private static Map getConfigOptions() { } // derive process config from process directives for( var method : ProcessDirectiveDsl.class.getDeclaredMethods() ) { - var annot = method.getAnnotation(Function.class); + var annot = method.getAnnotation(Description.class); if( annot == null ) continue; var name = "process." + method.getName(); diff --git a/src/main/groovy/nextflow/lsp/ast/ASTNodeStringUtils.java b/src/main/groovy/nextflow/lsp/ast/ASTNodeStringUtils.java index 3d54fe3..1202216 100644 --- a/src/main/groovy/nextflow/lsp/ast/ASTNodeStringUtils.java +++ b/src/main/groovy/nextflow/lsp/ast/ASTNodeStringUtils.java @@ -21,10 +21,8 @@ import groovy.lang.groovydoc.Groovydoc; import nextflow.lsp.services.util.FormattingOptions; import nextflow.lsp.services.util.Formatter; -import nextflow.script.dsl.Constant; -import nextflow.script.dsl.DslType; +import nextflow.script.dsl.Description; import nextflow.script.dsl.FeatureFlag; -import nextflow.script.dsl.Function; import nextflow.script.dsl.Operator; import nextflow.script.dsl.OutputDsl; import nextflow.script.dsl.ProcessDirectiveDsl; @@ -246,7 +244,7 @@ private static String variableToLabel(Variable variable) { public static String getDocumentation(ASTNode node) { if( node instanceof FeatureFlagNode ffn ) { if( ffn.target instanceof AnnotatedNode an ) - return annotationValueToMarkdown(an, FeatureFlag.class, "description"); + return annotationValueToMarkdown(an); } if( node instanceof WorkflowNode wn ) @@ -261,40 +259,36 @@ public static String getDocumentation(ASTNode node) { if( node instanceof ClassNode cn ) { var result = groovydocToMarkdown(cn.getGroovydoc()); if( result == null ) - result = annotationValueToMarkdown(cn, DslType.class); + result = annotationValueToMarkdown(cn); return result; } if( node instanceof FieldNode fn ) { var result = groovydocToMarkdown(fn.getGroovydoc()); if( result == null ) - result = annotationValueToMarkdown(fn, Constant.class); + result = annotationValueToMarkdown(fn); return result; } if( node instanceof MethodNode mn ) { var result = groovydocToMarkdown(mn.getGroovydoc()); if( result == null ) - result = annotationValueToMarkdown(mn, Function.class); + result = annotationValueToMarkdown(mn); return result; } return null; } - private static String annotationValueToMarkdown(AnnotatedNode node, Class type, String member) { - return findAnnotation(node, type) + private static String annotationValueToMarkdown(AnnotatedNode node) { + return findAnnotation(node, Description.class) .map((an) -> { - var description = an.getMember(member).getText(); + var description = an.getMember("value").getText(); return StringGroovyMethods.stripIndent(description, true).trim(); }) .orElse(null); } - private static String annotationValueToMarkdown(AnnotatedNode node, Class type) { - return annotationValueToMarkdown(node, type, "value"); - } - private static String groovydocToMarkdown(Groovydoc groovydoc) { if( groovydoc == null || !groovydoc.isPresent() ) return null; diff --git a/src/main/groovy/nextflow/lsp/services/script/ScriptCompletionProvider.java b/src/main/groovy/nextflow/lsp/services/script/ScriptCompletionProvider.java index a872682..29c1515 100644 --- a/src/main/groovy/nextflow/lsp/services/script/ScriptCompletionProvider.java +++ b/src/main/groovy/nextflow/lsp/services/script/ScriptCompletionProvider.java @@ -30,10 +30,10 @@ import nextflow.lsp.services.CompletionProvider; import nextflow.lsp.util.LanguageServerUtils; import nextflow.lsp.util.Logger; -import nextflow.script.dsl.Constant; +import nextflow.script.dsl.Description; import nextflow.script.dsl.FeatureFlag; import nextflow.script.dsl.FeatureFlagDsl; -import nextflow.script.dsl.Function; +import nextflow.script.dsl.Description; import nextflow.script.dsl.ScriptDsl; import nextflow.script.v2.FunctionNode; import nextflow.script.v2.InvalidDeclaration; @@ -288,12 +288,12 @@ private void populateLocalVariables(VariableScope scope, String namePrefix, Set< private void populateItemsFromDslScope(ClassNode cn, String namePrefix, Set existingNames, List items) { while( cn != null && !ClassHelper.isObjectType(cn) ) { var constants = cn.getFields().stream() - .filter(fn -> findAnnotation(fn, Constant.class).isPresent()) + .filter(fn -> findAnnotation(fn, Description.class).isPresent()) .iterator(); populateItemsFromFields(constants, namePrefix, existingNames, items); var functions = cn.getMethods().stream() - .filter(mn -> findAnnotation(mn, Function.class).isPresent()) + .filter(mn -> findAnnotation(mn, Description.class).isPresent()) .iterator(); populateItemsFromMethods(functions, namePrefix, existingNames, items); @@ -607,13 +607,14 @@ def greet(greeting, name) { )); for( var field : FeatureFlagDsl.class.getDeclaredFields() ) { - var annot = field.getAnnotation(FeatureFlag.class); - if( annot == null ) + var name = field.getAnnotation(FeatureFlag.class); + var description = field.getAnnotation(Description.class); + if( name == null || description == null ) continue; snippets.add(new Snippet( - annot.name(), - annot.description(), - annot.name() + " = " + name.value(), + description.value(), + name.value() + " = " )); } diff --git a/src/main/groovy/nextflow/lsp/services/script/VariableScopeVisitor.java b/src/main/groovy/nextflow/lsp/services/script/VariableScopeVisitor.java index 44f3933..ca9c9bf 100644 --- a/src/main/groovy/nextflow/lsp/services/script/VariableScopeVisitor.java +++ b/src/main/groovy/nextflow/lsp/services/script/VariableScopeVisitor.java @@ -34,11 +34,10 @@ import nextflow.lsp.compiler.PhaseAware; import nextflow.lsp.compiler.Phases; import nextflow.lsp.compiler.RelatedInformationAware; -import nextflow.script.dsl.Constant; +import nextflow.script.dsl.Description; import nextflow.script.dsl.EntryWorkflowDsl; import nextflow.script.dsl.FeatureFlag; import nextflow.script.dsl.FeatureFlagDsl; -import nextflow.script.dsl.Function; import nextflow.script.dsl.OutputDsl; import nextflow.script.dsl.ParamsMap; import nextflow.script.dsl.ProcessDsl; @@ -193,7 +192,7 @@ public void visitFeatureFlag(FeatureFlagNode node) { var result = cn.getFields().stream() .filter(fn -> findAnnotation(fn, FeatureFlag.class) - .map(an -> an.getMember("name").getText()) + .map(an -> an.getMember("value").getText()) .map(name -> name.equals(node.name)) .orElse(false) ) @@ -284,7 +283,7 @@ private void declareParameters() { fn.setHasNoRealSourcePosition(true); fn.setDeclaringClass(cn); fn.setSynthetic(true); - var an = new AnnotationNode(ClassHelper.makeCached(Constant.class)); + var an = new AnnotationNode(ClassHelper.makeCached(Description.class)); an.addMember("value", new ConstantExpression(description)); fn.addAnnotation(an); cn.addField(fn); @@ -626,7 +625,7 @@ else if( node instanceof VariableExpression ve ) { private void declareAssignedVariable(VariableExpression ve) { var variable = findVariableDeclaration(ve.getName(), ve); if( variable != null ) { - if( variable instanceof FieldNode fn && findAnnotation(fn, Constant.class).isPresent() ) + if( variable instanceof FieldNode fn && findAnnotation(fn, Description.class).isPresent() ) addError("Built-in variable cannot be re-assigned", ve); else checkExternalWriteInClosure(ve, variable); @@ -666,7 +665,7 @@ else if( node instanceof BinaryExpression be && be.getOperation().getType() == T if( target == null ) return; var variable = findVariableDeclaration(target.getName(), target); - if( variable instanceof FieldNode fn && findAnnotation(fn, Constant.class).isPresent() ) { + if( variable instanceof FieldNode fn && findAnnotation(fn, Description.class).isPresent() ) { if( "params".equals(variable.getName()) ) sourceUnit.addWarning("Params should be declared at the top-level (i.e. outside the workflow)", target); // TODO: re-enable after workflow.onComplete bug is fixed @@ -877,7 +876,7 @@ private Variable findVariableDeclaration(String name, ASTNode node) { private Variable findClassMember(ClassNode cn, String name, ASTNode node) { while( cn != null && !ClassHelper.isObjectType(cn) ) { var fn = cn.getDeclaredField(name); - if( fn != null && findAnnotation(fn, Constant.class).isPresent() ) { + if( fn != null && findAnnotation(fn, Description.class).isPresent() ) { if( findAnnotation(fn, Deprecated.class).isPresent() ) addFutureWarning("`" + name + "` is deprecated and will be removed in a future version", node); return fn; @@ -889,7 +888,7 @@ private Variable findClassMember(ClassNode cn, String name, ASTNode node) { if( mn instanceof FunctionNode || mn instanceof ProcessNode || mn instanceof WorkflowNode ) { return wrapMethodAsVariable(mn, cn); } - if( findAnnotation(mn, Function.class).isPresent() ) { + if( findAnnotation(mn, Description.class).isPresent() ) { if( findAnnotation(mn, Deprecated.class).isPresent() ) addFutureWarning("`" + name + "` is deprecated and will be removed in a future version", node); return wrapMethodAsVariable(mn, cn); diff --git a/src/main/groovy/nextflow/script/dsl/Constant.java b/src/main/groovy/nextflow/script/dsl/Description.java similarity index 89% rename from src/main/groovy/nextflow/script/dsl/Constant.java rename to src/main/groovy/nextflow/script/dsl/Description.java index c870b95..f044dfa 100644 --- a/src/main/groovy/nextflow/script/dsl/Constant.java +++ b/src/main/groovy/nextflow/script/dsl/Description.java @@ -21,7 +21,7 @@ import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.FIELD) -public @interface Constant { +@Target({ ElementType.TYPE, ElementType.FIELD, ElementType.METHOD }) +public @interface Description { String value(); } diff --git a/src/main/groovy/nextflow/script/dsl/DslType.java b/src/main/groovy/nextflow/script/dsl/DslType.java deleted file mode 100644 index 440f8eb..0000000 --- a/src/main/groovy/nextflow/script/dsl/DslType.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2013-2024, Seqera Labs - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package nextflow.script.dsl; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface DslType { - String value(); -} diff --git a/src/main/groovy/nextflow/script/dsl/FeatureFlag.java b/src/main/groovy/nextflow/script/dsl/FeatureFlag.java index 116a8b2..caf4fc3 100644 --- a/src/main/groovy/nextflow/script/dsl/FeatureFlag.java +++ b/src/main/groovy/nextflow/script/dsl/FeatureFlag.java @@ -23,6 +23,5 @@ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) public @interface FeatureFlag { - String name(); - String description(); + String value(); } diff --git a/src/main/groovy/nextflow/script/dsl/FeatureFlagDsl.java b/src/main/groovy/nextflow/script/dsl/FeatureFlagDsl.java index 429a008..53379e8 100644 --- a/src/main/groovy/nextflow/script/dsl/FeatureFlagDsl.java +++ b/src/main/groovy/nextflow/script/dsl/FeatureFlagDsl.java @@ -18,54 +18,47 @@ public class FeatureFlagDsl { @Deprecated - @FeatureFlag( - name="nextflow.enable.configProcessNamesValidation", - description=""" - When `true`, prints a warning for every `withName:` process selector that doesn't match a process in the pipeline (default: `true`). - """) + @FeatureFlag("nextflow.enable.configProcessNamesValidation") + @Description(""" + When `true`, prints a warning for every `withName:` process selector that doesn't match a process in the pipeline (default: `true`). + """) public boolean configProcessNamesValidation; @Deprecated - @FeatureFlag( - name="nextflow.enable.dsl", - description=""" - Defines the DSL version (`1` or `2`). - """) + @FeatureFlag("nextflow.enable.dsl") + @Description(""" + Defines the DSL version (`1` or `2`). + """) public float dsl; - @FeatureFlag( - name="nextflow.enable.moduleBinaries", - description=""" - When `true`, enables the use of modules with executable scripts i.e. [module binaries](https://nextflow.io/docs/latest/module.html#module-binaries). - """) + @FeatureFlag("nextflow.enable.moduleBinaries") + @Description(""" + When `true`, enables the use of modules with executable scripts i.e. [module binaries](https://nextflow.io/docs/latest/module.html#module-binaries). + """) public boolean moduleBinaries; - @FeatureFlag( - name="nextflow.enable.strict", - description=""" - When `true`, the pipeline is executed in [strict mode](https://nextflow.io/docs/latest/reference/feature-flags.html). - """) + @FeatureFlag("nextflow.enable.strict") + @Description(""" + When `true`, the pipeline is executed in [strict mode](https://nextflow.io/docs/latest/reference/feature-flags.html). + """) public boolean strict; - @FeatureFlag( - name="nextflow.preview.output", - description=""" - When `true`, enables the use of the [workflow output definition](https://nextflow.io/docs/latest/workflow.html#workflow-output-def). - """) + @FeatureFlag("nextflow.preview.output") + @Description(""" + When `true`, enables the use of the [workflow output definition](https://nextflow.io/docs/latest/workflow.html#workflow-output-def). + """) public boolean previewOutput; - @FeatureFlag( - name="nextflow.preview.recursion", - description=""" - When `true`, enables the use of [process and workflow recursion](https://github.com/nextflow-io/nextflow/discussions/2521). - """) + @FeatureFlag("nextflow.preview.recursion") + @Description(""" + When `true`, enables the use of [process and workflow recursion](https://github.com/nextflow-io/nextflow/discussions/2521). + """) public boolean previewRecursion; - @FeatureFlag( - name="nextflow.preview.topic", - description=""" - When `true`, enables the use of [topic channels](https://nextflow.io/docs/latest/reference/channel.html#topic). - """) + @FeatureFlag("nextflow.preview.topic") + @Description(""" + When `true`, enables the use of [topic channels](https://nextflow.io/docs/latest/reference/channel.html#topic). + """) public boolean previewTopic; } diff --git a/src/main/groovy/nextflow/script/dsl/Function.java b/src/main/groovy/nextflow/script/dsl/Function.java deleted file mode 100644 index 58f3602..0000000 --- a/src/main/groovy/nextflow/script/dsl/Function.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2013-2024, Seqera Labs - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package nextflow.script.dsl; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.METHOD) -public @interface Function { - String value(); -} diff --git a/src/main/groovy/nextflow/script/dsl/OutputDsl.groovy b/src/main/groovy/nextflow/script/dsl/OutputDsl.groovy index c8d6aa6..bf6ee9b 100644 --- a/src/main/groovy/nextflow/script/dsl/OutputDsl.groovy +++ b/src/main/groovy/nextflow/script/dsl/OutputDsl.groovy @@ -20,19 +20,19 @@ import groovy.transform.CompileStatic @CompileStatic class OutputDsl implements DslScope { - @Constant(''' + @Description(''' List of positional arguments specified on the command line. ''') List args - @Constant(''' + @Description(''' Map of workflow parameters specified in the config file or as command line options. ''') Map params static class TargetDsl implements DslScope { - @Function(''' + @Description(''' *Currently only supported for S3.* Specify the media type a.k.a. [MIME type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_Types) of published files (default: `false`). Can be a string (e.g. `'text/html'`), or `true` to infer the content type from the file extension. @@ -40,43 +40,43 @@ class OutputDsl implements DslScope { void contentType(value) { } - @Function(''' + @Description(''' Enable or disable publishing (default: `true`). ''') void enabled(boolean value) { } - @Function(''' + @Description(''' When `true`, the workflow will not fail if a file can't be published for some reason (default: `false`). ''') void ignoreErrors(boolean value) { } - @Function(''' + @Description(''' Create an index file of the values that were published. ''') void index(Closure closure) { } - @Function(''' + @Description(''' The file publishing method (default: `'symlink'`). ''') void mode(String value) { } - @Function(''' + @Description(''' When `true` any existing file in the specified folder will be overwritten (default: `'standard'`). ''') void overwrite(value) { } - @Function(''' + @Description(''' Specify the publish path relative to the output directory (default: the target name). ''') void path(String value) { } - @Function(''' + @Description(''' *Currently only supported for S3.* Specify the storage class for published files. @@ -84,7 +84,7 @@ class OutputDsl implements DslScope { void storageClass(String value) { } - @Function(''' + @Description(''' *Currently only supported for S3.* Specify arbitrary tags for published files. @@ -96,25 +96,25 @@ class OutputDsl implements DslScope { static class IndexDsl implements DslScope { - @Function(''' + @Description(''' When `true`, the keys of the first record are used as the column names (default: `false`). Can also be a list of column names. ''') void header(value) { } - @Function(''' + @Description(''' Closure which defines how to transform each published value into a CSV record. The closure should return a list or map. By default, no transformation is applied. ''') void mapper(Closure value) { } - @Function(''' + @Description(''' The name of the index file relative to the target path (required). ''') void path(String value) { } - @Function(''' + @Description(''' The character used to separate values (default: `','`). ''') void sep(String value) { diff --git a/src/main/groovy/nextflow/script/dsl/ProcessDsl.groovy b/src/main/groovy/nextflow/script/dsl/ProcessDsl.groovy index 040dac4..ce87759 100644 --- a/src/main/groovy/nextflow/script/dsl/ProcessDsl.groovy +++ b/src/main/groovy/nextflow/script/dsl/ProcessDsl.groovy @@ -25,12 +25,12 @@ import nextflow.util.MemoryUnit @CompileStatic class ProcessDsl implements DslScope { - @Constant(''' + @Description(''' Map of task properties, including directive values. ''') TaskConfig task - @Function(''' + @Description(''' Define a script template. ''') Path template(path) { @@ -41,7 +41,7 @@ class ProcessDsl implements DslScope { @CompileStatic class ProcessDirectiveDsl implements DslScope { - @Function(''' + @Description(''' The `accelerator` directive allows you to request hardware accelerators (e.g. GPUs) for the task execution. [Read more](https://nextflow.io/docs/latest/reference/process.html#accelerator) @@ -49,7 +49,7 @@ class ProcessDirectiveDsl implements DslScope { void accelerator(Map value) { } - @Function(''' + @Description(''' The `afterScript` directive allows you to execute a custom (Bash) snippet *after* the task script. [Read more](https://nextflow.io/docs/latest/reference/process.html#afterscript) @@ -57,7 +57,7 @@ class ProcessDirectiveDsl implements DslScope { void afterScript(String value) { } - @Function(''' + @Description(''' The `arch` directive allows you to define the CPU architecture to build the software used by the task. [Read more](https://nextflow.io/docs/latest/reference/process.html#arch) @@ -65,7 +65,7 @@ class ProcessDirectiveDsl implements DslScope { void arch(String value) { } - @Function(''' + @Description(''' The `array` directive allows you to submit tasks as *job arrays* for executors that support it. [Read more](https://nextflow.io/docs/latest/reference/process.html#array) @@ -73,7 +73,7 @@ class ProcessDirectiveDsl implements DslScope { void array(Integer value) { } - @Function(''' + @Description(''' The `beforeScript` directive allows you to execute a custom (Bash) snippet *before* the task script. [Read more](https://nextflow.io/docs/latest/reference/process.html#beforescript) @@ -81,7 +81,7 @@ class ProcessDirectiveDsl implements DslScope { void beforeScript(String value) { } - @Function(''' + @Description(''' The `cache` directive allows you to store the process results to a local cache. When the cache is enabled *and* the pipeline is launched with the `-resume` option, any task executions that are already cached will be re-used. [Read more](https://nextflow.io/docs/latest/reference/process.html#cache) @@ -89,7 +89,7 @@ class ProcessDirectiveDsl implements DslScope { void cache(String value) { } - @Function(''' + @Description(''' The `clusterOptions` directive allows the usage of any native configuration option accepted by your cluster submit command. You can use it to request non-standard resources or use settings that are specific to your cluster and not supported out of the box by Nextflow. [Read more](https://nextflow.io/docs/latest/reference/process.html#clusteroptions) @@ -97,7 +97,7 @@ class ProcessDirectiveDsl implements DslScope { void clusterOptions(String value) { } - @Function(''' + @Description(''' The `conda` directive allows for the definition of the process dependencies using the [Conda](https://conda.io) package manager. [Read more](https://nextflow.io/docs/latest/reference/process.html#conda) @@ -105,7 +105,7 @@ class ProcessDirectiveDsl implements DslScope { void conda(String value) { } - @Function(''' + @Description(''' The `container` directive allows you to execute the process script in a container. [Read more](https://nextflow.io/docs/latest/reference/process.html#container) @@ -113,7 +113,7 @@ class ProcessDirectiveDsl implements DslScope { void container(String value) { } - @Function(''' + @Description(''' The `containerOptions` directive allows you to specify any container execution option supported by the underlying container engine (ie. Docker, Singularity, etc). This can be useful to provide container settings only for a specific process. [Read more](https://nextflow.io/docs/latest/reference/process.html#containeroptions) @@ -121,7 +121,7 @@ class ProcessDirectiveDsl implements DslScope { void containerOptions(String value) { } - @Function(''' + @Description(''' The `cpus` directive allows you to define the number of (logical) CPUs required by each task. [Read more](https://nextflow.io/docs/latest/reference/process.html#cpus) @@ -129,7 +129,7 @@ class ProcessDirectiveDsl implements DslScope { void cpus(Integer value) { } - @Function(''' + @Description(''' The `debug` directive allows you to print the process standard output to Nextflow\'s standard output, i.e. the console. By default this directive is disabled. [Read more](https://nextflow.io/docs/latest/reference/process.html#debug) @@ -137,7 +137,7 @@ class ProcessDirectiveDsl implements DslScope { void debug(boolean value) { } - @Function(''' + @Description(''' The `disk` directive allows you to define how much local disk storage the process is allowed to use. [Read more](https://nextflow.io/docs/latest/reference/process.html#disk) @@ -145,7 +145,7 @@ class ProcessDirectiveDsl implements DslScope { void disk(MemoryUnit value) { } - @Function(''' + @Description(''' The `errorStrategy` directive allows you to define what to do when a task fails. [Read more](https://nextflow.io/docs/latest/reference/process.html#errorstrategy) @@ -153,7 +153,7 @@ class ProcessDirectiveDsl implements DslScope { void errorStrategy(String value) { } - @Function(''' + @Description(''' The `executor` defines the underlying system where tasks are executed. [Read more](https://nextflow.io/docs/latest/reference/process.html#executor) @@ -161,7 +161,7 @@ class ProcessDirectiveDsl implements DslScope { void executor(String value) { } - @Function(''' + @Description(''' The `ext` is a special directive used for custom settings by some executors. [Read more](https://nextflow.io/docs/latest/reference/process.html#ext) @@ -169,7 +169,7 @@ class ProcessDirectiveDsl implements DslScope { void ext(Map value) { } - @Function(''' + @Description(''' The `fair` directive, when enabled, guarantees that process outputs will be emitted in the order in which they were received. [Read more](https://nextflow.io/docs/latest/reference/process.html#fair) @@ -177,7 +177,7 @@ class ProcessDirectiveDsl implements DslScope { void fair(boolean value) { } - @Function(''' + @Description(''' The `label` directive allows you to annotate a process with a mnemonic identifier of your choice. [Read more](https://nextflow.io/docs/latest/reference/process.html#label) @@ -185,7 +185,7 @@ class ProcessDirectiveDsl implements DslScope { void label(String value) { } - @Function(''' + @Description(''' The `machineType` directive can be used to specify a predefined Google Compute Platform [machine type](https://cloud.google.com/compute/docs/machine-types) when using the [Google Batch](https://nextflow.io/docs/latest/google.html#cloud-batch) executor. [Read more](https://nextflow.io/docs/latest/reference/process.html#machinetype) @@ -193,7 +193,7 @@ class ProcessDirectiveDsl implements DslScope { void machineType(String value) { } - @Function(''' + @Description(''' The `maxErrors` directive allows you to specify the maximum number of times a process can fail when using the `retry` or `ignore` error strategy. By default this directive is disabled. [Read more](https://nextflow.io/docs/latest/reference/process.html#maxerrors) @@ -201,7 +201,7 @@ class ProcessDirectiveDsl implements DslScope { void maxErrors(int value) { } - @Function(''' + @Description(''' The `maxForks` directive allows you to define the maximum number of tasks (per process) that can be executed in parallel. [Read more](https://nextflow.io/docs/latest/reference/process.html#maxforks) @@ -209,7 +209,7 @@ class ProcessDirectiveDsl implements DslScope { void maxForks(Integer value) { } - @Function(''' + @Description(''' The `maxRetries` directive allows you to define the maximum number of times a task can be retried when using the `retry` error strategy. By default only one retry is allowed. [Read more](https://nextflow.io/docs/latest/reference/process.html#maxretries) @@ -217,7 +217,7 @@ class ProcessDirectiveDsl implements DslScope { void maxRetries(int value) { } - @Function(''' + @Description(''' The `maxSubmitAwait` directives allows you to specify how long a task can remain in the submission queue. If a task remains in the queue beyond this time limit, it will fail. [Read more](https://nextflow.io/docs/latest/reference/process.html#maxsubmitawait) @@ -225,7 +225,7 @@ class ProcessDirectiveDsl implements DslScope { void maxSubmitAwait(Duration value) { } - @Function(''' + @Description(''' The `memory` directive allows you to define how much memory is required by each task. Can be a string (e.g. `\'8 GB\'`) or a memory unit (e.g. `8.GB`). [Read more](https://nextflow.io/docs/latest/reference/process.html#memory) @@ -233,7 +233,7 @@ class ProcessDirectiveDsl implements DslScope { void memory(MemoryUnit value) { } - @Function(''' + @Description(''' The `module` directive allows you to provide software dependencies to a process using [Environment Modules](http://modules.sourceforge.net/). [Read more](https://nextflow.io/docs/latest/reference/process.html#module) @@ -241,7 +241,7 @@ class ProcessDirectiveDsl implements DslScope { void module(String value) { } - @Function(''' + @Description(''' The `penv` directive allows you to define the parallel environment to be used when submitting a parallel task to the [SGE](https://nextflow.io/docs/latest/executor.html#sge) resource manager. [Read more](https://nextflow.io/docs/latest/reference/process.html#penv) @@ -249,7 +249,7 @@ class ProcessDirectiveDsl implements DslScope { void penv(String value) { } - @Function(''' + @Description(''' The `pod` directive allows you to define pod specific settings, such as environment variables, secrets, and config maps, when using the [Kubernetes](https://nextflow.io/docs/latest/kubernetes.html) executor. [Read more](https://nextflow.io/docs/latest/reference/process.html#pod) @@ -257,7 +257,7 @@ class ProcessDirectiveDsl implements DslScope { void pod(List value) { } - @Function(''' + @Description(''' The `publishDir` directive allows you to publish the process output files to a directory. [Read more](https://nextflow.io/docs/latest/reference/process.html#publishdir) @@ -265,7 +265,7 @@ class ProcessDirectiveDsl implements DslScope { void publishDir(List value) { } - @Function(''' + @Description(''' The `queue` directive allows you to specify the queue to which jobs are submitted when using a grid executor. [Read more](https://nextflow.io/docs/latest/reference/process.html#queue) @@ -273,7 +273,7 @@ class ProcessDirectiveDsl implements DslScope { void queue(String value) { } - @Function(''' + @Description(''' The `resourceLabels` directive allows you to specify custom name-value pairs which are applied to the compute resources used for the process execution. [Read more](https://nextflow.io/docs/latest/reference/process.html#resourcelabels) @@ -281,7 +281,7 @@ class ProcessDirectiveDsl implements DslScope { void resourceLabels(Map value) { } - @Function(''' + @Description(''' The `resourceLimits` directive allows you to specify environment-specific limits for task resource requests. [Read more](https://nextflow.io/docs/latest/reference/process.html#resourcelimits) @@ -289,7 +289,7 @@ class ProcessDirectiveDsl implements DslScope { void resourceLimits(Map value) { } - @Function(''' + @Description(''' The `scratch` directive allows you to execute each task in a temporary directory that is local to the compute node. [Read more](https://nextflow.io/docs/latest/reference/process.html#scratch) @@ -297,7 +297,7 @@ class ProcessDirectiveDsl implements DslScope { void scratch(String value) { } - @Function(''' + @Description(''' The `secret` directive allows you to securely provide secrets to a process. [Read more](https://nextflow.io/docs/latest/secrets.html#process-directive) @@ -305,7 +305,7 @@ class ProcessDirectiveDsl implements DslScope { void secret(String value) { } - @Function(''' + @Description(''' The `shell` directive allows you to define a custom shell command for process scripts. By default, script blocks are executed with `/bin/bash -ue`. [Read more](https://nextflow.io/docs/latest/reference/process.html#shell) @@ -313,7 +313,7 @@ class ProcessDirectiveDsl implements DslScope { void shell(String value) { } - @Function(''' + @Description(''' The `spack` directive allows you to provide software dependencies using the [Spack](https://spack.io) package manager. [Read more](https://nextflow.io/docs/latest/reference/process.html#spack) @@ -321,7 +321,7 @@ class ProcessDirectiveDsl implements DslScope { void spack(String value) { } - @Function(''' + @Description(''' The `stageInMode` directive defines how input files are staged into the task work directory. [Read more](https://nextflow.io/docs/latest/reference/process.html#stageinmode) @@ -329,7 +329,7 @@ class ProcessDirectiveDsl implements DslScope { void stageInMode(String value) { } - @Function(''' + @Description(''' The `stageOutMode` directive defines how output files are staged out from the scratch directory to the task work directory when using the `scratch` directive. [Read more](https://nextflow.io/docs/latest/reference/process.html#stageoutmode) @@ -337,7 +337,7 @@ class ProcessDirectiveDsl implements DslScope { void stageOutMode(String value) { } - @Function(''' + @Description(''' The `storeDir` directive allows you to use an external directory as a *permanent* cache for process outputs. [Read more](https://nextflow.io/docs/latest/reference/process.html#storedir) @@ -345,7 +345,7 @@ class ProcessDirectiveDsl implements DslScope { void storeDir(String value) { } - @Function(''' + @Description(''' The `tag` directive allows you to associate each process execution with a custom label, so that it will be easier to identify in the log file or in a report. [Read more](https://nextflow.io/docs/latest/reference/process.html#tag) @@ -353,7 +353,7 @@ class ProcessDirectiveDsl implements DslScope { void tag(String value) { } - @Function(''' + @Description(''' The `time` directive allows you to define how long a task is allowed to run. [Read more](https://nextflow.io/docs/latest/reference/process.html#time) @@ -366,20 +366,20 @@ class ProcessDirectiveDsl implements DslScope { @CompileStatic class ProcessInputDsl implements DslScope { - @Function(''' + @Description(''' Declare a variable input. The received value can be any type, and it will be made available to the process body (i.e. `script`, `shell`, `exec`) as a variable with the given name. ''') void val(arg) { } @Deprecated - @Function(''' + @Description(''' Declare a file input. ''') void file(arg) { } - @Function(''' + @Description(''' Declare a file input. The received value should be a file or collection of files. The argument can be an identifier or string. If an identifier, the received value will be made available to the process body as a variable. If a string, the received value will be staged into the task directory under the given alias. @@ -387,19 +387,19 @@ class ProcessInputDsl implements DslScope { void path(arg) { } - @Function(''' + @Description(''' Declare an environment variable input. The received value should be a string, and it will be exported to the task environment as an environment variable given by `identifier`. ''') void env(arg) { } - @Function(''' + @Description(''' Declare a `stdin` input. The received value should be a string, and it will be provided as the standard input (i.e. `stdin`) to the task script. It should be declared only once for a process. ''') void stdin() { } - @Function(''' + @Description(''' Declare a tuple input. Each argument should be an input declaration such as `val`, `path`, `env`, or `stdin`. The received value should be a tuple with the same number of elements as the `tuple` declaration, and each received element should be compatible with the corresponding `tuple` argument. Each tuple element is treated the same way as if it were a standalone input. @@ -408,7 +408,7 @@ class ProcessInputDsl implements DslScope { } @Deprecated - @Function(''' + @Description(''' Declare an `each` input. ''') void each(arg) { @@ -419,44 +419,44 @@ class ProcessInputDsl implements DslScope { @CompileStatic class ProcessOutputDsl implements DslScope { - @Function(''' + @Description(''' Declare a value output. The argument can be any value, and it can reference any output variables defined in the process body (i.e. variables declared without the `def` keyword). ''') void val(arg) { } @Deprecated - @Function(''' + @Description(''' Declare a file output. ''') void file(arg) { } - @Function(''' + @Description(''' Declare a file output. It receives the output files from the task environment that match the given pattern. ''') void path(arg) { } - @Function(''' + @Description(''' Declare an environment variable output. It receives the value of the environment variable given by `identifier` from the task environment. ''') void env(arg) { } - @Function(''' + @Description(''' Declare a `stdout` output. It receives the standard output of the task script. ''') void stdout() { } - @Function(''' + @Description(''' Declare an `eval` output. It receives the standard output of the given command, which is executed in the task environment after the task script. ''') void eval(arg) { } - @Function(''' + @Description(''' Declare a tuple output. Each argument should be an output declaration such as `val`, `path`, `env`, `stdin`, or `eval`. Each tuple element is treated the same way as if it were a standalone output. ''') void tuple(Object... args) { diff --git a/src/main/groovy/nextflow/script/dsl/ScriptDsl.groovy b/src/main/groovy/nextflow/script/dsl/ScriptDsl.groovy index 8e35a37..ad06178 100644 --- a/src/main/groovy/nextflow/script/dsl/ScriptDsl.groovy +++ b/src/main/groovy/nextflow/script/dsl/ScriptDsl.groovy @@ -36,120 +36,120 @@ class ScriptDsl implements DslScope { ] @Deprecated - @Constant(''' + @Description(''' Alias of `workflow.projectDir`. ''') Path baseDir - @Constant(''' + @Description(''' Alias of `workflow.launchDir`. ''') Path launchDir - @Constant(''' + @Description(''' Logger which can be used to log messages to the console. ''') Logger log - @Constant(''' + @Description(''' The directory where a module script is located (equivalent to `projectDir` if used in the main script). ''') Path moduleDir - @Constant(''' + @Description(''' Map of Nextflow runtime information. ''') NextflowMeta nextflow - @Constant(''' + @Description(''' Alias of `workflow.projectDir`. ''') Path projectDir - @Constant(''' + @Description(''' Map of user-defined pipeline secrets. ''') Map secrets - @Constant(''' + @Description(''' Alias of `workflow.workDir`. ''') Path workDir - @Constant(''' + @Description(''' Map of workflow runtime information. ''') WorkflowMetadata workflow - @Function(''' + @Description(''' Create a branch criteria to use with the `branch` operator. ''') void branchCriteria(Closure closure) { } - @Function(''' + @Description(''' Throw a script runtime error with an optional error message. ''') void error(String message=null) { } @Deprecated - @Function(''' + @Description(''' Stop the pipeline execution and return an exit code and optional error message. ''') void exit(int exitCode=0, String message=null) { } - @Function(''' + @Description(''' Get one or more files from a path or glob pattern. Returns a Path or list of Paths if there are multiple files. ''') /* Path | List */ Object file(Map opts=null, String filePattern) { } - @Function(''' + @Description(''' Convenience method for `file()` that always returns a list. ''') List files(Map opts=null, String filePattern) { } - @Function(''' + @Description(''' Create a grouping key to use with the [groupTuple](https://nextflow.io/docs/latest/operator.html#grouptuple) operator. ''') GroupKey groupKey(Object key, int size) { } - @Function(''' + @Description(''' Create a multi-map criteria to use with the `multiMap` operator. ''') void multiMapCriteria(Closure closure) { } - @Function(''' + @Description(''' Print a value to standard output. ''') void print(Object object) { } - @Function(''' + @Description(''' Print a newline to standard output. ''') void println() { } - @Function(''' + @Description(''' Print a value to standard output with a newline. ''') void println(Object object) { } - @Function(''' + @Description(''' Send an email. ''') void sendMail(Map params) { } - @Function(''' + @Description(''' Create a tuple object from the given arguments. ''') ArrayTuple tuple(Object... args) { diff --git a/src/main/groovy/nextflow/script/dsl/WorkflowDsl.groovy b/src/main/groovy/nextflow/script/dsl/WorkflowDsl.groovy index 6046ffc..b7b2f40 100644 --- a/src/main/groovy/nextflow/script/dsl/WorkflowDsl.groovy +++ b/src/main/groovy/nextflow/script/dsl/WorkflowDsl.groovy @@ -24,13 +24,13 @@ import nextflow.script.ChannelOut @CompileStatic class WorkflowDsl implements DslScope { - @Constant(''' + @Description(''' Alias for `Channel`. ''') Channel channel @Operator - @Function(''' + @Description(''' The `branch` operator forwards each value from a source channel to one of multiple output channels, based on a selection criteria. [Read more](https://nextflow.io/docs/latest/reference/operator.html#branch) @@ -39,7 +39,7 @@ class WorkflowDsl implements DslScope { } @Operator - @Function(''' + @Description(''' The `buffer` operator collects values from a source channel into subsets and emits each subset separately. [Read more](https://nextflow.io/docs/latest/reference/operator.html#buffer) @@ -48,7 +48,7 @@ class WorkflowDsl implements DslScope { } @Operator - @Function(''' + @Description(''' The `collate` operator collects values from a source channel into groups of *N* values. [Read more](https://nextflow.io/docs/latest/reference/operator.html#collate) @@ -57,7 +57,7 @@ class WorkflowDsl implements DslScope { } @Operator - @Function(''' + @Description(''' The `collect` operator collects all values from a source channel into a list and emits it as a single value. [Read more](https://nextflow.io/docs/latest/reference/operator.html#collect) @@ -66,7 +66,7 @@ class WorkflowDsl implements DslScope { } @Operator - @Function(''' + @Description(''' The `collectFile` operator collects the values from a source channel and saves them to one or more files, emitting the collected file(s). [Read more](https://nextflow.io/docs/latest/reference/operator.html#collectfile) @@ -75,7 +75,7 @@ class WorkflowDsl implements DslScope { } @Operator - @Function(''' + @Description(''' The `combine` operator produces the combinations (i.e. cross product, “Cartesian” product) of two source channels, or a channel and a list (as the right operand), emitting each combination separately. [Read more](https://nextflow.io/docs/latest/reference/operator.html#combine) @@ -84,7 +84,7 @@ class WorkflowDsl implements DslScope { } @Operator - @Function(''' + @Description(''' The `concat` operator emits the values from two or more source channels into a single output channel. Each source channel is emitted in the order in which it was specified. [Read more](https://nextflow.io/docs/latest/reference/operator.html#concat) @@ -93,7 +93,7 @@ class WorkflowDsl implements DslScope { } @Operator - @Function(''' + @Description(''' The `count` operator computes the total number of values from a source channel and emits it. [Read more](https://nextflow.io/docs/latest/reference/operator.html#count) @@ -102,7 +102,7 @@ class WorkflowDsl implements DslScope { } @Operator - @Function(''' + @Description(''' The `cross` operator emits every pairwise combination of two channels for which the pair has a matching key. [Read more](https://nextflow.io/docs/latest/reference/operator.html#cross) @@ -111,7 +111,7 @@ class WorkflowDsl implements DslScope { } @Operator - @Function(''' + @Description(''' The `distinct` operator forwards a source channel with consecutively repeated values removed, such that each emitted value is different from the preceding one. [Read more](https://nextflow.io/docs/latest/reference/operator.html#distinct) @@ -120,7 +120,7 @@ class WorkflowDsl implements DslScope { } @Operator - @Function(''' + @Description(''' When the pipeline is executed with the `-dump-channels` command-line option, the `dump` operator prints each value in a source channel, otherwise it does nothing. [Read more](https://nextflow.io/docs/latest/reference/operator.html#dump) @@ -129,7 +129,7 @@ class WorkflowDsl implements DslScope { } @Operator - @Function(''' + @Description(''' The `filter` operator emits the values from a source channel that satisfy a condition, discarding all other values. The filter condition can be a literal value, a regular expression, a type qualifier, or a boolean predicate. [Read more](https://nextflow.io/docs/latest/reference/operator.html#filter) @@ -138,7 +138,7 @@ class WorkflowDsl implements DslScope { } @Operator - @Function(''' + @Description(''' The `first` operator emits the first value from a source channel, or the first value that satisfies a condition. The condition can be a regular expression, a type qualifier (i.e. Java class), or a boolean predicate. [Read more](https://nextflow.io/docs/latest/reference/operator.html#first) @@ -147,7 +147,7 @@ class WorkflowDsl implements DslScope { } @Operator - @Function(''' + @Description(''' The `flatMap` operator applies a mapping function to each value from a source channel. When the mapping function returns a list, each element in the list is emitted separately. When the mapping function returns a map, each key-value pair in the map is emitted separately. @@ -158,7 +158,7 @@ class WorkflowDsl implements DslScope { } @Operator - @Function(''' + @Description(''' The `flatten` operator flattens each value from a source channel that is a list or other collection, such that each element in each collection is emitted separately. Deeply nested collections are also flattened. [Read more](https://nextflow.io/docs/latest/reference/operator.html#flatten) @@ -167,7 +167,7 @@ class WorkflowDsl implements DslScope { } @Operator - @Function(''' + @Description(''' The `groupTuple` operator collects tuples from a source channel into groups based on a grouping key. A new tuple is emitted for each distinct key. [Read more](https://nextflow.io/docs/latest/reference/operator.html#grouptuple) @@ -176,7 +176,7 @@ class WorkflowDsl implements DslScope { } @Operator - @Function(''' + @Description(''' The `ifEmpty` operator emits a source channel, or a default value if the source channel is empty. [Read more](https://nextflow.io/docs/latest/reference/operator.html#ifempty) @@ -185,7 +185,7 @@ class WorkflowDsl implements DslScope { } @Operator - @Function(''' + @Description(''' The `join` operator emits the inner product of two source channels using a matching key. [Read more](https://nextflow.io/docs/latest/reference/operator.html#join) @@ -194,7 +194,7 @@ class WorkflowDsl implements DslScope { } @Operator - @Function(''' + @Description(''' The `last` operator emits the last value from a source channel. [Read more](https://nextflow.io/docs/latest/reference/operator.html#last) @@ -203,7 +203,7 @@ class WorkflowDsl implements DslScope { } @Operator - @Function(''' + @Description(''' The `map` operator applies a mapping function to each value from a source channel. [Read more](https://nextflow.io/docs/latest/reference/operator.html#map) @@ -212,7 +212,7 @@ class WorkflowDsl implements DslScope { } @Operator - @Function(''' + @Description(''' The `max` operator emits the item with the greatest value from a source channel. [Read more](https://nextflow.io/docs/latest/reference/operator.html#max) @@ -222,7 +222,7 @@ class WorkflowDsl implements DslScope { @Deprecated @Operator - @Function(''' + @Description(''' The `merge` operator joins the values from two or more channels into a new channel. [Read more](https://nextflow.io/docs/latest/reference/operator.html#merge) @@ -231,7 +231,7 @@ class WorkflowDsl implements DslScope { } @Operator - @Function(''' + @Description(''' The `min` operator emits the item with the lowest value from a source channel. [Read more](https://nextflow.io/docs/latest/reference/operator.html#min) @@ -240,7 +240,7 @@ class WorkflowDsl implements DslScope { } @Operator - @Function(''' + @Description(''' The `mix` operator emits the values from two or more source channels into a single output channel. [Read more](https://nextflow.io/docs/latest/reference/operator.html#mix) @@ -249,7 +249,7 @@ class WorkflowDsl implements DslScope { } @Operator - @Function(''' + @Description(''' The `multiMap` operator applies a set of mapping functions to a source channel, producing a separate output channel for each mapping function. [Read more](https://nextflow.io/docs/latest/reference/operator.html#multimap) @@ -258,7 +258,7 @@ class WorkflowDsl implements DslScope { } @Operator - @Function(''' + @Description(''' The `randomSample` operator emits a randomly-selected subset of values from a source channel. [Read more](https://nextflow.io/docs/latest/reference/operator.html#randomsample) @@ -267,7 +267,7 @@ class WorkflowDsl implements DslScope { } @Operator - @Function(''' + @Description(''' The `reduce` operator applies an accumulator function sequentially to each value from a source channel, and emits the accumulated value. The accumulator function takes two parameters -- the accumulated value and the *i*-th emitted value -- and it should return the accumulated result, which is passed to the next invocation with the *i+1*-th value. This process is repeated for each value in the source channel. [Read more](https://nextflow.io/docs/latest/reference/operator.html#reduce) @@ -276,7 +276,7 @@ class WorkflowDsl implements DslScope { } @Operator - @Function(''' + @Description(''' The `set` operator assigns a source channel to a variable, whose name is specified in a closure. [Read more](https://nextflow.io/docs/latest/reference/operator.html#set) @@ -285,7 +285,7 @@ class WorkflowDsl implements DslScope { } @Operator - @Function(''' + @Description(''' The `splitCsv` operator parses and splits [CSV-formatted](http://en.wikipedia.org/wiki/Comma-separated_values) text from a source channel into records, or groups of records with a given size. [Read more](https://nextflow.io/docs/latest/reference/operator.html#splitcsv) @@ -294,7 +294,7 @@ class WorkflowDsl implements DslScope { } @Operator - @Function(''' + @Description(''' The `splitFasta` operator splits [FASTA formatted](http://en.wikipedia.org/wiki/FASTA_format) text from a source channel into individual sequences. [Read more](https://nextflow.io/docs/latest/reference/operator.html#splitfasta) @@ -303,7 +303,7 @@ class WorkflowDsl implements DslScope { } @Operator - @Function(''' + @Description(''' The `splitFastq` operator splits [FASTQ formatted](http://en.wikipedia.org/wiki/FASTQ_format) text from a source channel into individual sequences. [Read more](https://nextflow.io/docs/latest/reference/operator.html#splitfastq) @@ -312,7 +312,7 @@ class WorkflowDsl implements DslScope { } @Operator - @Function(''' + @Description(''' The `splitText` operator splits multi-line text content from a source channel into chunks of *N* lines. [Read more](https://nextflow.io/docs/latest/reference/operator.html#splittext) @@ -321,7 +321,7 @@ class WorkflowDsl implements DslScope { } @Operator - @Function(''' + @Description(''' The `subscribe` operator invokes a custom function for each value in a source channel. [Read more](https://nextflow.io/docs/latest/reference/operator.html#subscribe) @@ -330,7 +330,7 @@ class WorkflowDsl implements DslScope { } @Operator - @Function(''' + @Description(''' The `sum` operator emits the sum of all values in a source channel. [Read more](https://nextflow.io/docs/latest/reference/operator.html#sum) @@ -339,7 +339,7 @@ class WorkflowDsl implements DslScope { } @Operator - @Function(''' + @Description(''' The `take` operator takes the first *N* values from a source channel. [Read more](https://nextflow.io/docs/latest/reference/operator.html#take) @@ -348,7 +348,7 @@ class WorkflowDsl implements DslScope { } @Operator - @Function(''' + @Description(''' The `toList` operator collects all the values from a source channel into a list and emits the list as a single value. [Read more](https://nextflow.io/docs/latest/reference/operator.html#to;ist) @@ -357,7 +357,7 @@ class WorkflowDsl implements DslScope { } @Operator - @Function(''' + @Description(''' The `toSortedList` operator collects all the values from a source channel into a sorted list and emits the list as a single value. [Read more](https://nextflow.io/docs/latest/reference/operator.html#tosortedlist) @@ -366,7 +366,7 @@ class WorkflowDsl implements DslScope { } @Operator - @Function(''' + @Description(''' The `transpose` operator transposes each tuple from a source channel by flattening any nested list in each tuple, emitting each nested value separately. [Read more](https://nextflow.io/docs/latest/reference/operator.html#transpose) @@ -375,7 +375,7 @@ class WorkflowDsl implements DslScope { } @Operator - @Function(''' + @Description(''' The `unique` operator emits the unique values from a source channel. [Read more](https://nextflow.io/docs/latest/reference/operator.html#unique) @@ -384,7 +384,7 @@ class WorkflowDsl implements DslScope { } @Operator - @Function(''' + @Description(''' The `until` operator emits each value from a source channel until a stopping condition is satisfied. [Read more](https://nextflow.io/docs/latest/reference/operator.html#until) @@ -393,7 +393,7 @@ class WorkflowDsl implements DslScope { } @Operator - @Function(''' + @Description(''' The `view` operator prints each value from a source channel to standard output. [Read more](https://nextflow.io/docs/latest/reference/operator.html#view) @@ -406,12 +406,12 @@ class WorkflowDsl implements DslScope { @CompileStatic class EntryWorkflowDsl extends WorkflowDsl { - @Constant(''' + @Description(''' List of positional arguments specified on the command line. ''') List args - @Constant(''' + @Description(''' Map of workflow parameters specified in the config file or as command line options. ''') Map params diff --git a/src/main/groovy/nextflow/script/types/Channel.java b/src/main/groovy/nextflow/script/types/Channel.java index 737173e..06cee36 100644 --- a/src/main/groovy/nextflow/script/types/Channel.java +++ b/src/main/groovy/nextflow/script/types/Channel.java @@ -22,17 +22,16 @@ import groovy.lang.Closure; import groovyx.gpars.dataflow.DataflowVariable; import groovyx.gpars.dataflow.DataflowWriteChannel; -import nextflow.script.dsl.DslType; -import nextflow.script.dsl.Function; +import nextflow.script.dsl.Description; -@DslType(""" +@Description(""" The `Channel` type provides the channel factory methods. [Read more](https://nextflow.io/docs/latest/reference/channel.html) """) public class Channel { - @Function(""" + @Description(""" Create a channel that emits nothing. [Read more](https://nextflow.io/docs/latest/reference/channel.html#empty) @@ -42,7 +41,7 @@ public static DataflowWriteChannel empty() { } @Deprecated - @Function(""" + @Description(""" Create a channel that emits each argument. [Read more](https://nextflow.io/docs/latest/reference/channel.html#from) @@ -52,7 +51,7 @@ public static DataflowWriteChannel from(T... values) { } @Deprecated - @Function(""" + @Description(""" Create a channel that emits each element in a collection. [Read more](https://nextflow.io/docs/latest/reference/channel.html#from) @@ -61,7 +60,7 @@ public static DataflowWriteChannel from(Collection values) { return null; } - @Function(""" + @Description(""" Create a channel that emits all file pairs matching a glob pattern. An optional closure can be used to customize the grouping strategy. @@ -72,7 +71,7 @@ public static DataflowWriteChannel fromFilePairs(Map opts, String pattern, Closu return null; } - @Function(""" + @Description(""" Create a channel that emits each element in a collection. [Read more](https://nextflow.io/docs/latest/reference/channel.html#fromlist) @@ -81,7 +80,7 @@ public static DataflowWriteChannel fromList(Collection values) { return null; } - @Function(""" + @Description(""" Create a channel that emits all paths matching a name or glob pattern. [Read more](https://nextflow.io/docs/latest/reference/channel.html#frompath) @@ -90,7 +89,7 @@ public static DataflowWriteChannel fromPath(Map opts, String pattern) { return null; } - @Function(""" + @Description(""" Create a channel that queries the [NCBI SRA](https://www.ncbi.nlm.nih.gov/sra) database and emits all FASTQ files matching the given project or accession ids. [Read more](https://nextflow.io/docs/latest/reference/channel.html#fromsra) @@ -99,7 +98,7 @@ public static DataflowWriteChannel fromSRA(Map opts, String query) { return null; } - @Function(""" + @Description(""" Create a channel that emits each argument. [Read more](https://nextflow.io/docs/latest/reference/channel.html#of) @@ -108,7 +107,7 @@ public static DataflowWriteChannel of(T... values) { return null; } - @Function(""" + @Description(""" Create a channel that emits all values in the given topic. [Read more](https://nextflow.io/docs/latest/reference/channel.html#topic) @@ -117,7 +116,7 @@ public static DataflowWriteChannel topic(String name) { return null; } - @Function(""" + @Description(""" Create a value channel. [Read more](https://nextflow.io/docs/latest/reference/channel.html#value) @@ -126,7 +125,7 @@ public static DataflowVariable value(T value) { return null; } - @Function(""" + @Description(""" Create a channel that watches for filesystem events for all files matching the given pattern. [Read more](https://nextflow.io/docs/latest/reference/channel.html#watchpath)