From dae190c45ccff2c92165425a271365676e2cd281 Mon Sep 17 00:00:00 2001 From: Aaron Petkau Date: Thu, 7 Dec 2023 12:58:49 -0600 Subject: [PATCH 01/11] Updated files to get it to compile --- gradle/wrapper/gradle-wrapper.properties | 2 +- plugins/nf-hello/src/test/nextflow/hello/HelloDslTest.groovy | 1 - settings.gradle | 1 + 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 2e6e589..774fae8 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/plugins/nf-hello/src/test/nextflow/hello/HelloDslTest.groovy b/plugins/nf-hello/src/test/nextflow/hello/HelloDslTest.groovy index d958680..56f8b19 100644 --- a/plugins/nf-hello/src/test/nextflow/hello/HelloDslTest.groovy +++ b/plugins/nf-hello/src/test/nextflow/hello/HelloDslTest.groovy @@ -35,7 +35,6 @@ class HelloDslTest extends Dsl2Spec{ @Override protected PluginDescriptorFinder createPluginDescriptorFinder() { return new TestPluginDescriptorFinder(){ - @Override protected Path getManifestPath(Path pluginPath) { return pluginPath.resolve('build/resources/main/META-INF/MANIFEST.MF') } diff --git a/settings.gradle b/settings.gradle index 1c98ac6..558dd1f 100644 --- a/settings.gradle +++ b/settings.gradle @@ -17,3 +17,4 @@ rootProject.name = 'nf-hello' include('plugins') include('plugins:nf-hello') +includeBuild('../nextflow') From 91cf8ccc5742776ac514172b670f42c1b888f031 Mon Sep 17 00:00:00 2001 From: Aaron Petkau Date: Fri, 8 Dec 2023 17:51:22 -0600 Subject: [PATCH 02/11] Separate out files --- .../main/nextflow/hello/HelloObserver.groovy | 82 +++++++++++++++++++ .../nextflow/hello/IridaNextOutput.groovy | 52 ++++++++++++ 2 files changed, 134 insertions(+) create mode 100644 plugins/nf-hello/src/main/nextflow/hello/IridaNextOutput.groovy diff --git a/plugins/nf-hello/src/main/nextflow/hello/HelloObserver.groovy b/plugins/nf-hello/src/main/nextflow/hello/HelloObserver.groovy index 68bffbc..44d0ef9 100644 --- a/plugins/nf-hello/src/main/nextflow/hello/HelloObserver.groovy +++ b/plugins/nf-hello/src/main/nextflow/hello/HelloObserver.groovy @@ -16,10 +16,20 @@ package nextflow.hello +import java.nio.file.Path +import java.nio.file.Paths + import groovy.transform.CompileStatic import groovy.util.logging.Slf4j +import groovy.json.JsonOutput import nextflow.Session import nextflow.trace.TraceObserver +import nextflow.processor.TaskHandler +import nextflow.trace.TraceRecord +import nextflow.processor.TaskRun +import nextflow.script.params.FileOutParam + +import nextflow.hello.IridaNextOutput /** * Example workflow events observer @@ -30,13 +40,85 @@ import nextflow.trace.TraceObserver @CompileStatic class HelloObserver implements TraceObserver { + private List publishedFiles = [] + private List tasks = [] + private List traces = [] + private IridaNextOutput iridaNextOutput = new IridaNextOutput() + + private String outputSectionName(FileOutParam outParam) { + if (outParam.getName() == "meta") { + return "samples" + } else { + return "global" + } + } + + @Override + void onProcessComplete(TaskHandler handler, TraceRecord trace) { + final task = handler.task + tasks << task + traces << trace + } + @Override void onFlowCreate(Session session) { log.info "Pipeline is starting! 🚀" + log.info "session: ${session}" + log.info "params: ${session.getParams()}" + } + + @Override + void onFilePublish(Path destination, Path source) { + publishedFiles.push(["destination": destination, "source": source]) } @Override void onFlowComplete() { log.info "Pipeline complete! 👋" + log.info "Published files: ${publishedFiles}" + log.info "Traces: ${traces[0]}" + + // Some of this code derived from https://github.com/nextflow-io/nf-prov/blob/master/plugins/nf-prov + // def outputs = tasks.findResults { task -> + // task.outputs.findResults { outParam, object -> + // def outputMap = [ + // 'task': task, + // 'output_name': outParam.getName(), + // 'output_object': object, + // ] + // outputMap['name'] != '$' ? outputMap : null + // } + // } + tasks.each { task -> + def currSubscope = null + def currScope = "global" + task.outputs.each { outParam, object -> + log.info "object class: ${object.getClass()}, instanceof map ${object instanceof Map}" + log.info "object ${object}" + if (object instanceof Map) { + Map objectMap = (Map)object + log.info "object=${object} is map, name=${outParam.getName()}, id in map ${'id' in objectMap}" + if (outParam.getName() == "meta" && "id" in objectMap) { + currSubscope = objectMap["id"].toString() + currScope = "samples" + log.info "currSubscope=${currSubscope}" + } + } else if (object instanceof Path) { + Path path = (Path)object + iridaNextOutput.addFile(currScope, currSubscope, path) + } + // def outputMap = [ + // 'task': task, + // 'output_name': outParam.getName(), + // 'output_object': object, + // ] + // outputMap['name'] != '$' ? outputMap : null + } + } + + log.info "Tasks: ${tasks[0]}" + log.info "JSON: ${JsonOutput.prettyPrint(iridaNextOutput.toJson())}" + // log.info "Outputs: ${outputs[0]}" + // log.info "Tasks.outputs: ${tasks[0].outputs}" } } diff --git a/plugins/nf-hello/src/main/nextflow/hello/IridaNextOutput.groovy b/plugins/nf-hello/src/main/nextflow/hello/IridaNextOutput.groovy new file mode 100644 index 0000000..16f0a08 --- /dev/null +++ b/plugins/nf-hello/src/main/nextflow/hello/IridaNextOutput.groovy @@ -0,0 +1,52 @@ +package nextflow.hello + +import java.nio.file.Path +import java.nio.file.Paths + +import java.util.List +import java.util.Map +import java.nio.file.Path +import groovy.transform.CompileStatic +import groovy.json.JsonOutput +import groovy.util.logging.Slf4j + +@Slf4j +@CompileStatic +class IridaNextOutput { + private Map files = ["global": [], "samples": [:]] + private Map metadata = ["samples": [:]] + // private final Map>> files = ["global": [], "samples": []] + // private final Map> metadata = ["samples": []] + + public void addFile(String scope, String subscope, Path path) { + if (!(scope in files.keySet())) { + throw new Exception("scope=${scope} not in valid set of scopes: ${files.keySet()}") + } + + log.info "Calling addFile(${scope}, ${subscope}, ${path})" + def files_scope = files[scope] + if (scope == "samples" && subscope == null) { + throw new Exception("scope=${scope} but subscope is null") + } else if (scope == "samples" && subscope != null) { + def files_scope_map = (Map)files_scope + if (!files_scope_map.containsKey(subscope)) { + files_scope_map[subscope] = [] + } + log.info "before" + ((List)files_scope_map[subscope]).push(["path": path.toString()]) + } else if (scope == "global") { + def files_scope_list = (List)files_scope + files_scope_list.push(["path": path.toString()]) + } else { + throw new Exception("scope=${scope} is not valid") + } + } + + public void addFile(String scope, Path path) { + addFile(scope, null, path) + } + + public String toJson() { + return JsonOutput.toJson(["files": files, "metadata": metadata]) + } +} \ No newline at end of file From 4a65c682c950f465ab5d4bf390ea8166c8d3e00a Mon Sep 17 00:00:00 2001 From: Aaron Petkau Date: Sat, 9 Dec 2023 19:39:45 -0600 Subject: [PATCH 03/11] Better matching of sample identifiers to outputs --- .../main/nextflow/hello/HelloObserver.groovy | 71 +++++++++++-------- .../nextflow/hello/IridaNextOutput.groovy | 6 +- 2 files changed, 45 insertions(+), 32 deletions(-) diff --git a/plugins/nf-hello/src/main/nextflow/hello/HelloObserver.groovy b/plugins/nf-hello/src/main/nextflow/hello/HelloObserver.groovy index 44d0ef9..e652cd8 100644 --- a/plugins/nf-hello/src/main/nextflow/hello/HelloObserver.groovy +++ b/plugins/nf-hello/src/main/nextflow/hello/HelloObserver.groovy @@ -18,6 +18,8 @@ package nextflow.hello import java.nio.file.Path import java.nio.file.Paths +import java.nio.file.FileSystems +import java.nio.file.PathMatcher import groovy.transform.CompileStatic import groovy.util.logging.Slf4j @@ -28,6 +30,7 @@ import nextflow.processor.TaskHandler import nextflow.trace.TraceRecord import nextflow.processor.TaskRun import nextflow.script.params.FileOutParam +import nextflow.script.params.ValueOutParam import nextflow.hello.IridaNextOutput @@ -44,6 +47,12 @@ class HelloObserver implements TraceObserver { private List tasks = [] private List traces = [] private IridaNextOutput iridaNextOutput = new IridaNextOutput() + private List samplesMatchers + private List globalMatchers + + public HelloObserver() { + samplesMatchers = [FileSystems.getDefault().getPathMatcher("glob:**/*.assembly.fa.gz")] + } private String outputSectionName(FileOutParam outParam) { if (outParam.getName() == "meta") { @@ -74,51 +83,51 @@ class HelloObserver implements TraceObserver { @Override void onFlowComplete() { - log.info "Pipeline complete! 👋" - log.info "Published files: ${publishedFiles}" - log.info "Traces: ${traces[0]}" + log.info "Pipeline complete!" // Some of this code derived from https://github.com/nextflow-io/nf-prov/blob/master/plugins/nf-prov - // def outputs = tasks.findResults { task -> - // task.outputs.findResults { outParam, object -> - // def outputMap = [ - // 'task': task, - // 'output_name': outParam.getName(), - // 'output_object': object, - // ] - // outputMap['name'] != '$' ? outputMap : null - // } - // } tasks.each { task -> + Map> outParamInfo = [:] def currSubscope = null def currScope = "global" + log.info "\n****\ntask: ${task.getName()}" + log.info "task.outputs (${task.outputs.getClass()}): ${task.outputs}" task.outputs.each { outParam, object -> + log.info "outParam (${outParam.getClass()}): ${outParam}" + log.info "outParm info: name=${outParam.getName()}, index=${outParam.getIndex()}, emitName=${outParam.getChannelEmitName()}" log.info "object class: ${object.getClass()}, instanceof map ${object instanceof Map}" log.info "object ${object}" - if (object instanceof Map) { - Map objectMap = (Map)object - log.info "object=${object} is map, name=${outParam.getName()}, id in map ${'id' in objectMap}" - if (outParam.getName() == "meta" && "id" in objectMap) { - currSubscope = objectMap["id"].toString() - currScope = "samples" - log.info "currSubscope=${currSubscope}" + Short paramIndex = outParam.getIndex() + if (!outParamInfo.containsKey(paramIndex)) { + Map currIndexInfo = [:] + outParamInfo[paramIndex] = currIndexInfo + + // case meta map + if (outParam instanceof ValueOutParam && object instanceof Map) { + Map objectMap = (Map)object + if (outParam.getName() == "meta" && "id" in objectMap) { + currIndexInfo["scope"] = "samples" + currIndexInfo["subscope"] = objectMap["id"].toString() + } else { + throw new Exception("Found value channel output that doesn't have meta.id: ${objectMap}") + } + } else { + currIndexInfo["scope"] = "global" + currIndexInfo["subscope"] = "" } - } else if (object instanceof Path) { + } + + Map currIndexInfo = outParamInfo[paramIndex] + + if (object instanceof Path) { Path path = (Path)object - iridaNextOutput.addFile(currScope, currSubscope, path) + if (samplesMatchers.any {it.matches(path)}) { + iridaNextOutput.addFile(currIndexInfo["scope"], currIndexInfo["subscope"], path) + } } - // def outputMap = [ - // 'task': task, - // 'output_name': outParam.getName(), - // 'output_object': object, - // ] - // outputMap['name'] != '$' ? outputMap : null } } - log.info "Tasks: ${tasks[0]}" log.info "JSON: ${JsonOutput.prettyPrint(iridaNextOutput.toJson())}" - // log.info "Outputs: ${outputs[0]}" - // log.info "Tasks.outputs: ${tasks[0].outputs}" } } diff --git a/plugins/nf-hello/src/main/nextflow/hello/IridaNextOutput.groovy b/plugins/nf-hello/src/main/nextflow/hello/IridaNextOutput.groovy index 16f0a08..21cc882 100644 --- a/plugins/nf-hello/src/main/nextflow/hello/IridaNextOutput.groovy +++ b/plugins/nf-hello/src/main/nextflow/hello/IridaNextOutput.groovy @@ -23,7 +23,11 @@ class IridaNextOutput { throw new Exception("scope=${scope} not in valid set of scopes: ${files.keySet()}") } - log.info "Calling addFile(${scope}, ${subscope}, ${path})" + // Treat empty string and null as same + if (subscope == "") { + subscope = null + } + def files_scope = files[scope] if (scope == "samples" && subscope == null) { throw new Exception("scope=${scope} but subscope is null") From 83af692e781d535a0bbe7e0cd9b56a125377a019 Mon Sep 17 00:00:00 2001 From: Aaron Petkau Date: Sat, 9 Dec 2023 20:11:01 -0600 Subject: [PATCH 04/11] Updated path matchers --- .../main/nextflow/hello/HelloObserver.groovy | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/plugins/nf-hello/src/main/nextflow/hello/HelloObserver.groovy b/plugins/nf-hello/src/main/nextflow/hello/HelloObserver.groovy index e652cd8..93df568 100644 --- a/plugins/nf-hello/src/main/nextflow/hello/HelloObserver.groovy +++ b/plugins/nf-hello/src/main/nextflow/hello/HelloObserver.groovy @@ -47,11 +47,22 @@ class HelloObserver implements TraceObserver { private List tasks = [] private List traces = [] private IridaNextOutput iridaNextOutput = new IridaNextOutput() + private Map> pathMatchers private List samplesMatchers private List globalMatchers public HelloObserver() { - samplesMatchers = [FileSystems.getDefault().getPathMatcher("glob:**/*.assembly.fa.gz")] + pathMatchers = [:] + addPathMatchers("global", [FileSystems.getDefault().getPathMatcher("glob:**/summary.txt.gz")]) + addPathMatchers("samples", [FileSystems.getDefault().getPathMatcher("glob:**/*.assembly.fa.gz")]) + } + + public addPathMatchers(String scope, List matchers) { + if (pathMatchers.containsKey(scope)) { + pathMatchers[scope].addAll(matchers) + } else { + pathMatchers[scope] = matchers + } } private String outputSectionName(FileOutParam outParam) { @@ -121,8 +132,9 @@ class HelloObserver implements TraceObserver { if (object instanceof Path) { Path path = (Path)object - if (samplesMatchers.any {it.matches(path)}) { - iridaNextOutput.addFile(currIndexInfo["scope"], currIndexInfo["subscope"], path) + currScope = currIndexInfo["scope"] + if (pathMatchers[currScope].any {it.matches(path)}) { + iridaNextOutput.addFile(currScope, currIndexInfo["subscope"], path) } } } From 359df274001d8cb4989990195ae8803fbc3ed34d Mon Sep 17 00:00:00 2001 From: Aaron Petkau Date: Sat, 9 Dec 2023 20:21:03 -0600 Subject: [PATCH 05/11] Switched to published paths --- .../main/nextflow/hello/HelloObserver.groovy | 39 +++++++++---------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/plugins/nf-hello/src/main/nextflow/hello/HelloObserver.groovy b/plugins/nf-hello/src/main/nextflow/hello/HelloObserver.groovy index 93df568..e245432 100644 --- a/plugins/nf-hello/src/main/nextflow/hello/HelloObserver.groovy +++ b/plugins/nf-hello/src/main/nextflow/hello/HelloObserver.groovy @@ -43,7 +43,7 @@ import nextflow.hello.IridaNextOutput @CompileStatic class HelloObserver implements TraceObserver { - private List publishedFiles = [] + private Map publishedFiles = [:] private List tasks = [] private List traces = [] private IridaNextOutput iridaNextOutput = new IridaNextOutput() @@ -53,8 +53,8 @@ class HelloObserver implements TraceObserver { public HelloObserver() { pathMatchers = [:] - addPathMatchers("global", [FileSystems.getDefault().getPathMatcher("glob:**/summary.txt.gz")]) - addPathMatchers("samples", [FileSystems.getDefault().getPathMatcher("glob:**/*.assembly.fa.gz")]) + addPathMatchers("global", [FileSystems.getDefault().getPathMatcher("glob:**/summary/summary.txt.gz")]) + addPathMatchers("samples", [FileSystems.getDefault().getPathMatcher("glob:**/assembly/*.assembly.fa.gz")]) } public addPathMatchers(String scope, List matchers) { @@ -65,14 +65,6 @@ class HelloObserver implements TraceObserver { } } - private String outputSectionName(FileOutParam outParam) { - if (outParam.getName() == "meta") { - return "samples" - } else { - return "global" - } - } - @Override void onProcessComplete(TaskHandler handler, TraceRecord trace) { final task = handler.task @@ -82,25 +74,25 @@ class HelloObserver implements TraceObserver { @Override void onFlowCreate(Session session) { - log.info "Pipeline is starting! 🚀" - log.info "session: ${session}" + log.info "Pipeline is starting!" log.info "params: ${session.getParams()}" } @Override void onFilePublish(Path destination, Path source) { - publishedFiles.push(["destination": destination, "source": source]) + if (publishedFiles.containsKey(source)) { + throw new Exception("Error: file with source=${source} was already published") + } + + publishedFiles[source] = destination } @Override void onFlowComplete() { - log.info "Pipeline complete!" - // Some of this code derived from https://github.com/nextflow-io/nf-prov/blob/master/plugins/nf-prov tasks.each { task -> Map> outParamInfo = [:] def currSubscope = null - def currScope = "global" log.info "\n****\ntask: ${task.getName()}" log.info "task.outputs (${task.outputs.getClass()}): ${task.outputs}" task.outputs.each { outParam, object -> @@ -131,10 +123,15 @@ class HelloObserver implements TraceObserver { Map currIndexInfo = outParamInfo[paramIndex] if (object instanceof Path) { - Path path = (Path)object - currScope = currIndexInfo["scope"] - if (pathMatchers[currScope].any {it.matches(path)}) { - iridaNextOutput.addFile(currScope, currIndexInfo["subscope"], path) + Path processPath = (Path)object + + if (publishedFiles.containsKey(processPath)) { + Path publishedPath = publishedFiles[processPath] + def currScope = currIndexInfo["scope"] + + if (pathMatchers[currScope].any {it.matches(publishedPath)}) { + iridaNextOutput.addFile(currScope, currIndexInfo["subscope"], publishedPath) + } } } } From 0dcd4ff6707073b50fad5012a54fc956ed1f4833 Mon Sep 17 00:00:00 2001 From: Aaron Petkau Date: Sat, 9 Dec 2023 20:43:30 -0600 Subject: [PATCH 06/11] Parsing path matchers from config file --- .../main/nextflow/hello/HelloObserver.groovy | 34 +++++++++++++------ .../nextflow/hello/IridaNextOutput.groovy | 1 - 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/plugins/nf-hello/src/main/nextflow/hello/HelloObserver.groovy b/plugins/nf-hello/src/main/nextflow/hello/HelloObserver.groovy index e245432..bb9b535 100644 --- a/plugins/nf-hello/src/main/nextflow/hello/HelloObserver.groovy +++ b/plugins/nf-hello/src/main/nextflow/hello/HelloObserver.groovy @@ -53,8 +53,8 @@ class HelloObserver implements TraceObserver { public HelloObserver() { pathMatchers = [:] - addPathMatchers("global", [FileSystems.getDefault().getPathMatcher("glob:**/summary/summary.txt.gz")]) - addPathMatchers("samples", [FileSystems.getDefault().getPathMatcher("glob:**/assembly/*.assembly.fa.gz")]) + addPathMatchers("global", []) + addPathMatchers("samples", []) } public addPathMatchers(String scope, List matchers) { @@ -74,8 +74,26 @@ class HelloObserver implements TraceObserver { @Override void onFlowCreate(Session session) { - log.info "Pipeline is starting!" - log.info "params: ${session.getParams()}" + def iridaNextFiles = session.config.navigate('iridanext.files') + if (iridaNextFiles != null) { + if (!iridaNextFiles instanceof Map) { + throw new Exception("Expected a map in config for iridanext.files=${iridaNextFiles}") + } + + iridaNextFiles = (Map)iridaNextFiles + iridaNextFiles.each {scope, matchers -> + if (matchers instanceof String) { + matchers = [matchers] + } + + if (!(matchers instanceof List)) { + throw new Exception("Invalid configuration for iridanext.files=${iridaNextFiles}") + } + + List matchersGlob = matchers.collect {FileSystems.getDefault().getPathMatcher("glob:${it}")} + addPathMatchers(scope, matchersGlob) + } + } } @Override @@ -93,13 +111,7 @@ class HelloObserver implements TraceObserver { tasks.each { task -> Map> outParamInfo = [:] def currSubscope = null - log.info "\n****\ntask: ${task.getName()}" - log.info "task.outputs (${task.outputs.getClass()}): ${task.outputs}" task.outputs.each { outParam, object -> - log.info "outParam (${outParam.getClass()}): ${outParam}" - log.info "outParm info: name=${outParam.getName()}, index=${outParam.getIndex()}, emitName=${outParam.getChannelEmitName()}" - log.info "object class: ${object.getClass()}, instanceof map ${object instanceof Map}" - log.info "object ${object}" Short paramIndex = outParam.getIndex() if (!outParamInfo.containsKey(paramIndex)) { Map currIndexInfo = [:] @@ -137,6 +149,6 @@ class HelloObserver implements TraceObserver { } } - log.info "JSON: ${JsonOutput.prettyPrint(iridaNextOutput.toJson())}" + log.info "${JsonOutput.prettyPrint(iridaNextOutput.toJson())}" } } diff --git a/plugins/nf-hello/src/main/nextflow/hello/IridaNextOutput.groovy b/plugins/nf-hello/src/main/nextflow/hello/IridaNextOutput.groovy index 21cc882..5eaf591 100644 --- a/plugins/nf-hello/src/main/nextflow/hello/IridaNextOutput.groovy +++ b/plugins/nf-hello/src/main/nextflow/hello/IridaNextOutput.groovy @@ -36,7 +36,6 @@ class IridaNextOutput { if (!files_scope_map.containsKey(subscope)) { files_scope_map[subscope] = [] } - log.info "before" ((List)files_scope_map[subscope]).push(["path": path.toString()]) } else if (scope == "global") { def files_scope_list = (List)files_scope From 839fb25d0d216063b48040a876075806ef48b85d Mon Sep 17 00:00:00 2001 From: Aaron Petkau Date: Sun, 10 Dec 2023 19:32:51 -0600 Subject: [PATCH 07/11] Renamed folder --- plugins/{nf-hello => iridanext}/build.gradle | 0 .../src/main/nextflow/hello/HelloConfig.groovy | 0 .../src/main/nextflow/hello/HelloExtension.groovy | 0 .../src/main/nextflow/hello/HelloFactory.groovy | 0 .../src/main/nextflow/hello/HelloObserver.groovy | 0 .../src/main/nextflow/hello/HelloPlugin.groovy | 0 .../src/main/nextflow/hello/IridaNextOutput.groovy | 0 .../{nf-hello => iridanext}/src/resources/META-INF/MANIFEST.MF | 0 .../{nf-hello => iridanext}/src/resources/META-INF/extensions.idx | 0 .../src/test/nextflow/hello/HelloDslTest.groovy | 0 .../src/test/nextflow/hello/HelloFactoryTest.groovy | 0 .../src/test/nextflow/hello/MockHelpers.groovy | 0 .../src/test/nextflow/hello/TestHelper.groovy | 0 13 files changed, 0 insertions(+), 0 deletions(-) rename plugins/{nf-hello => iridanext}/build.gradle (100%) rename plugins/{nf-hello => iridanext}/src/main/nextflow/hello/HelloConfig.groovy (100%) rename plugins/{nf-hello => iridanext}/src/main/nextflow/hello/HelloExtension.groovy (100%) rename plugins/{nf-hello => iridanext}/src/main/nextflow/hello/HelloFactory.groovy (100%) rename plugins/{nf-hello => iridanext}/src/main/nextflow/hello/HelloObserver.groovy (100%) rename plugins/{nf-hello => iridanext}/src/main/nextflow/hello/HelloPlugin.groovy (100%) rename plugins/{nf-hello => iridanext}/src/main/nextflow/hello/IridaNextOutput.groovy (100%) rename plugins/{nf-hello => iridanext}/src/resources/META-INF/MANIFEST.MF (100%) rename plugins/{nf-hello => iridanext}/src/resources/META-INF/extensions.idx (100%) rename plugins/{nf-hello => iridanext}/src/test/nextflow/hello/HelloDslTest.groovy (100%) rename plugins/{nf-hello => iridanext}/src/test/nextflow/hello/HelloFactoryTest.groovy (100%) rename plugins/{nf-hello => iridanext}/src/test/nextflow/hello/MockHelpers.groovy (100%) rename plugins/{nf-hello => iridanext}/src/test/nextflow/hello/TestHelper.groovy (100%) diff --git a/plugins/nf-hello/build.gradle b/plugins/iridanext/build.gradle similarity index 100% rename from plugins/nf-hello/build.gradle rename to plugins/iridanext/build.gradle diff --git a/plugins/nf-hello/src/main/nextflow/hello/HelloConfig.groovy b/plugins/iridanext/src/main/nextflow/hello/HelloConfig.groovy similarity index 100% rename from plugins/nf-hello/src/main/nextflow/hello/HelloConfig.groovy rename to plugins/iridanext/src/main/nextflow/hello/HelloConfig.groovy diff --git a/plugins/nf-hello/src/main/nextflow/hello/HelloExtension.groovy b/plugins/iridanext/src/main/nextflow/hello/HelloExtension.groovy similarity index 100% rename from plugins/nf-hello/src/main/nextflow/hello/HelloExtension.groovy rename to plugins/iridanext/src/main/nextflow/hello/HelloExtension.groovy diff --git a/plugins/nf-hello/src/main/nextflow/hello/HelloFactory.groovy b/plugins/iridanext/src/main/nextflow/hello/HelloFactory.groovy similarity index 100% rename from plugins/nf-hello/src/main/nextflow/hello/HelloFactory.groovy rename to plugins/iridanext/src/main/nextflow/hello/HelloFactory.groovy diff --git a/plugins/nf-hello/src/main/nextflow/hello/HelloObserver.groovy b/plugins/iridanext/src/main/nextflow/hello/HelloObserver.groovy similarity index 100% rename from plugins/nf-hello/src/main/nextflow/hello/HelloObserver.groovy rename to plugins/iridanext/src/main/nextflow/hello/HelloObserver.groovy diff --git a/plugins/nf-hello/src/main/nextflow/hello/HelloPlugin.groovy b/plugins/iridanext/src/main/nextflow/hello/HelloPlugin.groovy similarity index 100% rename from plugins/nf-hello/src/main/nextflow/hello/HelloPlugin.groovy rename to plugins/iridanext/src/main/nextflow/hello/HelloPlugin.groovy diff --git a/plugins/nf-hello/src/main/nextflow/hello/IridaNextOutput.groovy b/plugins/iridanext/src/main/nextflow/hello/IridaNextOutput.groovy similarity index 100% rename from plugins/nf-hello/src/main/nextflow/hello/IridaNextOutput.groovy rename to plugins/iridanext/src/main/nextflow/hello/IridaNextOutput.groovy diff --git a/plugins/nf-hello/src/resources/META-INF/MANIFEST.MF b/plugins/iridanext/src/resources/META-INF/MANIFEST.MF similarity index 100% rename from plugins/nf-hello/src/resources/META-INF/MANIFEST.MF rename to plugins/iridanext/src/resources/META-INF/MANIFEST.MF diff --git a/plugins/nf-hello/src/resources/META-INF/extensions.idx b/plugins/iridanext/src/resources/META-INF/extensions.idx similarity index 100% rename from plugins/nf-hello/src/resources/META-INF/extensions.idx rename to plugins/iridanext/src/resources/META-INF/extensions.idx diff --git a/plugins/nf-hello/src/test/nextflow/hello/HelloDslTest.groovy b/plugins/iridanext/src/test/nextflow/hello/HelloDslTest.groovy similarity index 100% rename from plugins/nf-hello/src/test/nextflow/hello/HelloDslTest.groovy rename to plugins/iridanext/src/test/nextflow/hello/HelloDslTest.groovy diff --git a/plugins/nf-hello/src/test/nextflow/hello/HelloFactoryTest.groovy b/plugins/iridanext/src/test/nextflow/hello/HelloFactoryTest.groovy similarity index 100% rename from plugins/nf-hello/src/test/nextflow/hello/HelloFactoryTest.groovy rename to plugins/iridanext/src/test/nextflow/hello/HelloFactoryTest.groovy diff --git a/plugins/nf-hello/src/test/nextflow/hello/MockHelpers.groovy b/plugins/iridanext/src/test/nextflow/hello/MockHelpers.groovy similarity index 100% rename from plugins/nf-hello/src/test/nextflow/hello/MockHelpers.groovy rename to plugins/iridanext/src/test/nextflow/hello/MockHelpers.groovy diff --git a/plugins/nf-hello/src/test/nextflow/hello/TestHelper.groovy b/plugins/iridanext/src/test/nextflow/hello/TestHelper.groovy similarity index 100% rename from plugins/nf-hello/src/test/nextflow/hello/TestHelper.groovy rename to plugins/iridanext/src/test/nextflow/hello/TestHelper.groovy From 3bf1fe0b8c0104d68ba3f3a5f92bc03d5bdfbf5e Mon Sep 17 00:00:00 2001 From: Aaron Petkau Date: Sun, 10 Dec 2023 19:38:28 -0600 Subject: [PATCH 08/11] Better rename --- nextflow.config | 2 +- plugins/{iridanext => nf-iridanext}/build.gradle | 0 .../src/main/nextflow/iridanext}/HelloConfig.groovy | 0 .../src/main/nextflow/iridanext}/HelloExtension.groovy | 0 .../src/main/nextflow/iridanext}/HelloFactory.groovy | 0 .../src/main/nextflow/iridanext}/HelloObserver.groovy | 0 .../src/main/nextflow/iridanext}/HelloPlugin.groovy | 0 .../src/main/nextflow/iridanext}/IridaNextOutput.groovy | 0 .../src/resources/META-INF/MANIFEST.MF | 0 .../src/resources/META-INF/extensions.idx | 0 .../src/test/nextflow/hello/HelloDslTest.groovy | 0 .../src/test/nextflow/hello/HelloFactoryTest.groovy | 0 .../src/test/nextflow/hello/MockHelpers.groovy | 0 .../src/test/nextflow/hello/TestHelper.groovy | 0 14 files changed, 1 insertion(+), 1 deletion(-) rename plugins/{iridanext => nf-iridanext}/build.gradle (100%) rename plugins/{iridanext/src/main/nextflow/hello => nf-iridanext/src/main/nextflow/iridanext}/HelloConfig.groovy (100%) rename plugins/{iridanext/src/main/nextflow/hello => nf-iridanext/src/main/nextflow/iridanext}/HelloExtension.groovy (100%) rename plugins/{iridanext/src/main/nextflow/hello => nf-iridanext/src/main/nextflow/iridanext}/HelloFactory.groovy (100%) rename plugins/{iridanext/src/main/nextflow/hello => nf-iridanext/src/main/nextflow/iridanext}/HelloObserver.groovy (100%) rename plugins/{iridanext/src/main/nextflow/hello => nf-iridanext/src/main/nextflow/iridanext}/HelloPlugin.groovy (100%) rename plugins/{iridanext/src/main/nextflow/hello => nf-iridanext/src/main/nextflow/iridanext}/IridaNextOutput.groovy (100%) rename plugins/{iridanext => nf-iridanext}/src/resources/META-INF/MANIFEST.MF (100%) rename plugins/{iridanext => nf-iridanext}/src/resources/META-INF/extensions.idx (100%) rename plugins/{iridanext => nf-iridanext}/src/test/nextflow/hello/HelloDslTest.groovy (100%) rename plugins/{iridanext => nf-iridanext}/src/test/nextflow/hello/HelloFactoryTest.groovy (100%) rename plugins/{iridanext => nf-iridanext}/src/test/nextflow/hello/MockHelpers.groovy (100%) rename plugins/{iridanext => nf-iridanext}/src/test/nextflow/hello/TestHelper.groovy (100%) diff --git a/nextflow.config b/nextflow.config index 3084913..82b7ae2 100644 --- a/nextflow.config +++ b/nextflow.config @@ -1,3 +1,3 @@ plugins { - id 'nf-hello' + id 'nf-iridanext' } \ No newline at end of file diff --git a/plugins/iridanext/build.gradle b/plugins/nf-iridanext/build.gradle similarity index 100% rename from plugins/iridanext/build.gradle rename to plugins/nf-iridanext/build.gradle diff --git a/plugins/iridanext/src/main/nextflow/hello/HelloConfig.groovy b/plugins/nf-iridanext/src/main/nextflow/iridanext/HelloConfig.groovy similarity index 100% rename from plugins/iridanext/src/main/nextflow/hello/HelloConfig.groovy rename to plugins/nf-iridanext/src/main/nextflow/iridanext/HelloConfig.groovy diff --git a/plugins/iridanext/src/main/nextflow/hello/HelloExtension.groovy b/plugins/nf-iridanext/src/main/nextflow/iridanext/HelloExtension.groovy similarity index 100% rename from plugins/iridanext/src/main/nextflow/hello/HelloExtension.groovy rename to plugins/nf-iridanext/src/main/nextflow/iridanext/HelloExtension.groovy diff --git a/plugins/iridanext/src/main/nextflow/hello/HelloFactory.groovy b/plugins/nf-iridanext/src/main/nextflow/iridanext/HelloFactory.groovy similarity index 100% rename from plugins/iridanext/src/main/nextflow/hello/HelloFactory.groovy rename to plugins/nf-iridanext/src/main/nextflow/iridanext/HelloFactory.groovy diff --git a/plugins/iridanext/src/main/nextflow/hello/HelloObserver.groovy b/plugins/nf-iridanext/src/main/nextflow/iridanext/HelloObserver.groovy similarity index 100% rename from plugins/iridanext/src/main/nextflow/hello/HelloObserver.groovy rename to plugins/nf-iridanext/src/main/nextflow/iridanext/HelloObserver.groovy diff --git a/plugins/iridanext/src/main/nextflow/hello/HelloPlugin.groovy b/plugins/nf-iridanext/src/main/nextflow/iridanext/HelloPlugin.groovy similarity index 100% rename from plugins/iridanext/src/main/nextflow/hello/HelloPlugin.groovy rename to plugins/nf-iridanext/src/main/nextflow/iridanext/HelloPlugin.groovy diff --git a/plugins/iridanext/src/main/nextflow/hello/IridaNextOutput.groovy b/plugins/nf-iridanext/src/main/nextflow/iridanext/IridaNextOutput.groovy similarity index 100% rename from plugins/iridanext/src/main/nextflow/hello/IridaNextOutput.groovy rename to plugins/nf-iridanext/src/main/nextflow/iridanext/IridaNextOutput.groovy diff --git a/plugins/iridanext/src/resources/META-INF/MANIFEST.MF b/plugins/nf-iridanext/src/resources/META-INF/MANIFEST.MF similarity index 100% rename from plugins/iridanext/src/resources/META-INF/MANIFEST.MF rename to plugins/nf-iridanext/src/resources/META-INF/MANIFEST.MF diff --git a/plugins/iridanext/src/resources/META-INF/extensions.idx b/plugins/nf-iridanext/src/resources/META-INF/extensions.idx similarity index 100% rename from plugins/iridanext/src/resources/META-INF/extensions.idx rename to plugins/nf-iridanext/src/resources/META-INF/extensions.idx diff --git a/plugins/iridanext/src/test/nextflow/hello/HelloDslTest.groovy b/plugins/nf-iridanext/src/test/nextflow/hello/HelloDslTest.groovy similarity index 100% rename from plugins/iridanext/src/test/nextflow/hello/HelloDslTest.groovy rename to plugins/nf-iridanext/src/test/nextflow/hello/HelloDslTest.groovy diff --git a/plugins/iridanext/src/test/nextflow/hello/HelloFactoryTest.groovy b/plugins/nf-iridanext/src/test/nextflow/hello/HelloFactoryTest.groovy similarity index 100% rename from plugins/iridanext/src/test/nextflow/hello/HelloFactoryTest.groovy rename to plugins/nf-iridanext/src/test/nextflow/hello/HelloFactoryTest.groovy diff --git a/plugins/iridanext/src/test/nextflow/hello/MockHelpers.groovy b/plugins/nf-iridanext/src/test/nextflow/hello/MockHelpers.groovy similarity index 100% rename from plugins/iridanext/src/test/nextflow/hello/MockHelpers.groovy rename to plugins/nf-iridanext/src/test/nextflow/hello/MockHelpers.groovy diff --git a/plugins/iridanext/src/test/nextflow/hello/TestHelper.groovy b/plugins/nf-iridanext/src/test/nextflow/hello/TestHelper.groovy similarity index 100% rename from plugins/iridanext/src/test/nextflow/hello/TestHelper.groovy rename to plugins/nf-iridanext/src/test/nextflow/hello/TestHelper.groovy From 48d9555d9cebaa340de60a310ef86b6e57635093 Mon Sep 17 00:00:00 2001 From: Aaron Petkau Date: Sun, 10 Dec 2023 19:50:31 -0600 Subject: [PATCH 09/11] Fixed up/renamed plugin groovy code --- .../nextflow/iridanext/HelloConfig.groovy | 35 ------ .../nextflow/iridanext/HelloExtension.groovy | 114 ------------------ ...Factory.groovy => IridaNextFactory.groovy} | 12 +- ...server.groovy => IridaNextObserver.groovy} | 10 +- .../nextflow/iridanext/IridaNextOutput.groovy | 18 ++- ...loPlugin.groovy => IridaNextPlugin.groovy} | 13 +- .../src/resources/META-INF/MANIFEST.MF | 4 +- 7 files changed, 38 insertions(+), 168 deletions(-) delete mode 100644 plugins/nf-iridanext/src/main/nextflow/iridanext/HelloConfig.groovy delete mode 100644 plugins/nf-iridanext/src/main/nextflow/iridanext/HelloExtension.groovy rename plugins/nf-iridanext/src/main/nextflow/iridanext/{HelloFactory.groovy => IridaNextFactory.groovy} (71%) rename plugins/nf-iridanext/src/main/nextflow/iridanext/{HelloObserver.groovy => IridaNextObserver.groovy} (94%) rename plugins/nf-iridanext/src/main/nextflow/iridanext/{HelloPlugin.groovy => IridaNextPlugin.groovy} (71%) diff --git a/plugins/nf-iridanext/src/main/nextflow/iridanext/HelloConfig.groovy b/plugins/nf-iridanext/src/main/nextflow/iridanext/HelloConfig.groovy deleted file mode 100644 index 414aa2b..0000000 --- a/plugins/nf-iridanext/src/main/nextflow/iridanext/HelloConfig.groovy +++ /dev/null @@ -1,35 +0,0 @@ -package nextflow.hello - -import groovy.transform.PackageScope - - -/** - * This class allows model an specific configuration, extracting values from a map and converting - * - * In this plugin, the user can configure how the messages are prefixed with a String, i.e. - * due a nextflow.config - * - * hello { - * prefix = '>>' - * } - * - * when the plugin reverse a String it will append '>>' at the beginning instead the default 'Mr.' - * - * We anotate this class as @PackageScope to restrict the access of their methods only to class in the - * same package - * - * @author : jorge - * - */ -@PackageScope -class HelloConfig { - - final private String prefix - - HelloConfig(Map map){ - def config = map ?: Collections.emptyMap() - prefix = config.prefix ?: 'Mr.' - } - - String getPrefix() { prefix } -} diff --git a/plugins/nf-iridanext/src/main/nextflow/iridanext/HelloExtension.groovy b/plugins/nf-iridanext/src/main/nextflow/iridanext/HelloExtension.groovy deleted file mode 100644 index 51090dc..0000000 --- a/plugins/nf-iridanext/src/main/nextflow/iridanext/HelloExtension.groovy +++ /dev/null @@ -1,114 +0,0 @@ -package nextflow.hello - - -import groovy.transform.CompileStatic -import groovy.util.logging.Slf4j -import groovyx.gpars.dataflow.DataflowReadChannel -import groovyx.gpars.dataflow.DataflowWriteChannel -import nextflow.Channel -import nextflow.Session -import nextflow.extension.CH -import nextflow.extension.DataflowHelper -import nextflow.plugin.extension.Factory -import nextflow.plugin.extension.Function -import nextflow.plugin.extension.Operator -import nextflow.plugin.extension.PluginExtensionPoint - -/** - * Example plugin extension showing how to implement a basic - * channel factory method, a channel operator and a custom function. - * - * @author : jorge - * - */ -@Slf4j -@CompileStatic -class HelloExtension extends PluginExtensionPoint { - - /* - * A session hold information about current execution of the script - */ - private Session session - - /* - * A Custom config extracted from nextflow.config under hello tag - * nextflow.config - * --------------- - * docker{ - * enabled = true - * } - * ... - * hello{ - * prefix = 'Mrs' - * } - */ - private HelloConfig config - - /* - * nf-core initializes the plugin once loaded and session is ready - * @param session - */ - @Override - protected void init(Session session) { - this.session = session - this.config = new HelloConfig(session.config.navigate('hello') as Map) - } - - /* - * {@code reverse} is a `producer` method and will be available to the script because: - * - * - it's public - * - it returns a DataflowWriteChannel - * - it's marked with the @Factory annotation - * - * The method can require arguments but it's not mandatory, it depends of the business logic of the method. - * - */ - @Factory - DataflowWriteChannel reverse(String message) { - final channel = CH.create() - session.addIgniter((action) -> reverseImpl(channel, message)) - return channel - } - - private void reverseImpl(DataflowWriteChannel channel, String message) { - channel.bind(message.reverse()); - channel.bind(Channel.STOP) - } - - /* - * {@code goodbye} is a *consumer* method as it receives values from a channel to perform some logic. - * - * Consumer methods are introspected by nextflow-core and include into the DSL if the method: - * - * - it's public - * - it returns a DataflowWriteChannel - * - it has only one arguments of DataflowReadChannel class - * - it's marked with the @Operator annotation - * - * a consumer method needs to proportionate 2 closures: - * - a closure to consume items (one by one) - * - a finalizer closure - * - * in this case `goodbye` will consume a message and will store it as an upper case - */ - @Operator - DataflowWriteChannel goodbye(DataflowReadChannel source) { - final target = CH.createBy(source) - final next = { target.bind("Goodbye $it".toString()) } - final done = { target.bind(Channel.STOP) } - DataflowHelper.subscribeImpl(source, [onNext: next, onComplete: done]) - return target - } - - /* - * Generate a random string - * - * Using @Function annotation we allow this function can be imported from the pipeline script - */ - @Function - String randomString(int length=9){ - new Random().with {(1..length).collect {(('a'..'z')).join(null)[ nextInt((('a'..'z')).join(null).length())]}.join(null)} - } - -} diff --git a/plugins/nf-iridanext/src/main/nextflow/iridanext/HelloFactory.groovy b/plugins/nf-iridanext/src/main/nextflow/iridanext/IridaNextFactory.groovy similarity index 71% rename from plugins/nf-iridanext/src/main/nextflow/iridanext/HelloFactory.groovy rename to plugins/nf-iridanext/src/main/nextflow/iridanext/IridaNextFactory.groovy index 432199c..a246f3e 100644 --- a/plugins/nf-iridanext/src/main/nextflow/iridanext/HelloFactory.groovy +++ b/plugins/nf-iridanext/src/main/nextflow/iridanext/IridaNextFactory.groovy @@ -1,5 +1,6 @@ /* - * Copyright 2021, Seqera Labs + * Original file Copyright 2021, Seqera Labs (from nf-hello plugin template) + * Modifications Copyright 2023, Government of Canada * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,24 +15,25 @@ * limitations under the License. */ -package nextflow.hello +package nextflow.iridanext import groovy.transform.CompileStatic import nextflow.Session import nextflow.trace.TraceObserver import nextflow.trace.TraceObserverFactory /** - * Implements the validation observer factory + * Factory for building the IridaNextObserver * + * @author Aaron Petkau * @author Paolo Di Tommaso */ @CompileStatic -class HelloFactory implements TraceObserverFactory { +class IridaNextFactory implements TraceObserverFactory { @Override Collection create(Session session) { final result = new ArrayList() - result.add( new HelloObserver() ) + result.add( new IridaNextObserver() ) return result } } diff --git a/plugins/nf-iridanext/src/main/nextflow/iridanext/HelloObserver.groovy b/plugins/nf-iridanext/src/main/nextflow/iridanext/IridaNextObserver.groovy similarity index 94% rename from plugins/nf-iridanext/src/main/nextflow/iridanext/HelloObserver.groovy rename to plugins/nf-iridanext/src/main/nextflow/iridanext/IridaNextObserver.groovy index bb9b535..a48065a 100644 --- a/plugins/nf-iridanext/src/main/nextflow/iridanext/HelloObserver.groovy +++ b/plugins/nf-iridanext/src/main/nextflow/iridanext/IridaNextObserver.groovy @@ -1,5 +1,6 @@ /* - * Copyright 2021, Seqera Labs + * Original file Copyright 2021, Seqera Labs (from nf-hello plugin template) + * Modifications Copyright 2023, Government of Canada * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +15,7 @@ * limitations under the License. */ -package nextflow.hello +package nextflow.iridanext import java.nio.file.Path import java.nio.file.Paths @@ -35,13 +36,14 @@ import nextflow.script.params.ValueOutParam import nextflow.hello.IridaNextOutput /** - * Example workflow events observer + * IridaNext workflow observer * + * @author Aaron Petkau * @author Paolo Di Tommaso */ @Slf4j @CompileStatic -class HelloObserver implements TraceObserver { +class IridaNextObserver implements TraceObserver { private Map publishedFiles = [:] private List tasks = [] diff --git a/plugins/nf-iridanext/src/main/nextflow/iridanext/IridaNextOutput.groovy b/plugins/nf-iridanext/src/main/nextflow/iridanext/IridaNextOutput.groovy index 5eaf591..75e52d0 100644 --- a/plugins/nf-iridanext/src/main/nextflow/iridanext/IridaNextOutput.groovy +++ b/plugins/nf-iridanext/src/main/nextflow/iridanext/IridaNextOutput.groovy @@ -1,4 +1,20 @@ -package nextflow.hello +/* + * Copyright 2023, Government of Canada + * + * 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.iridanext import java.nio.file.Path import java.nio.file.Paths diff --git a/plugins/nf-iridanext/src/main/nextflow/iridanext/HelloPlugin.groovy b/plugins/nf-iridanext/src/main/nextflow/iridanext/IridaNextPlugin.groovy similarity index 71% rename from plugins/nf-iridanext/src/main/nextflow/iridanext/HelloPlugin.groovy rename to plugins/nf-iridanext/src/main/nextflow/iridanext/IridaNextPlugin.groovy index e096ceb..22b2210 100644 --- a/plugins/nf-iridanext/src/main/nextflow/iridanext/HelloPlugin.groovy +++ b/plugins/nf-iridanext/src/main/nextflow/iridanext/IridaNextPlugin.groovy @@ -1,5 +1,6 @@ /* - * Copyright 2021, Seqera Labs + * Original file Copyright 2021, Seqera Labs (from nf-hello plugin template) + * Modifications Copyright 2023, Government of Canada * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +15,7 @@ * limitations under the License. */ -package nextflow.hello +package nextflow.iridanext import groovy.transform.CompileStatic import nextflow.plugin.BasePlugin @@ -22,14 +23,12 @@ import nextflow.plugin.Scoped import org.pf4j.PluginWrapper /** - * Implements the Hello plugins entry point - * - * @author Paolo Di Tommaso + * Implements the IRIDA Next plugins entry point */ @CompileStatic -class HelloPlugin extends BasePlugin { +class IridaNextPlugin extends BasePlugin { - HelloPlugin(PluginWrapper wrapper) { + IridaNextPlugin(PluginWrapper wrapper) { super(wrapper) } } diff --git a/plugins/nf-iridanext/src/resources/META-INF/MANIFEST.MF b/plugins/nf-iridanext/src/resources/META-INF/MANIFEST.MF index c4b8f7f..bef79c5 100644 --- a/plugins/nf-iridanext/src/resources/META-INF/MANIFEST.MF +++ b/plugins/nf-iridanext/src/resources/META-INF/MANIFEST.MF @@ -1,6 +1,6 @@ Manifest-Version: 1.0 -Plugin-Id: nf-hello -Plugin-Version: 0.4.0 +Plugin-Id: nf-iridanext +Plugin-Version: 0.1.0 Plugin-Class: nextflow.hello.HelloPlugin Plugin-Provider: nextflow Plugin-Requires: >=22.10.0 From aaa01adfb30ce754571d5240550e0351c54a4b5b Mon Sep 17 00:00:00 2001 From: Aaron Petkau Date: Sun, 10 Dec 2023 20:06:53 -0600 Subject: [PATCH 10/11] Updating readme and other files --- LICENSE | 201 ++++++++++++++++++ README.md | 120 ++--------- .../src/resources/META-INF/MANIFEST.MF | 2 +- .../src/resources/META-INF/extensions.idx | 3 +- settings.gradle | 7 +- 5 files changed, 224 insertions(+), 109 deletions(-) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. diff --git a/README.md b/README.md index 402d8eb..6eec958 100644 --- a/README.md +++ b/README.md @@ -1,112 +1,26 @@ -# nf-hello plugin +# nf-iridanext plugin -This project contains a simple Nextflow plugin called `nf-hello` which provides examples of different plugin extensions: +This project contains a plugin for integrating Nextflow pipelines with [IRIDA Next][irida-next]. In particular, it will enable a pipeline to produce output consistent with the IRIDA Next [pipeline standards][]. -- A custom trace observer that prints a message when the workflow starts and when the workflow completes -- A custom channel factory called `reverse` -- A custom operator called `goodbye` -- A custom function called `randomString` +# Credits -NOTE: If you want to use this project as a starting point for a custom plugin, you must rename the `plugins/nf-hello` folder and update `settings.gradle` with your plugin name. +This plugin was developed based on the `nf-hello` Nextflow plugin template . -## Plugin structure - -- `settings.gradle` - - Gradle project settings. +# Legal -- `plugins/nf-hello` - - The plugin implementation base directory. +Copyright 2023 Government of Canada +Original nf-hello project Copyright to respective authors -- `plugins/nf-hello/build.gradle` - - Plugin Gradle build file. Project dependencies should be added here. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this work except in compliance with the License. You may obtain a copy of the +License at: -- `plugins/nf-hello/src/resources/META-INF/MANIFEST.MF` - - Manifest file defining the plugin attributes e.g. name, version, etc. The attribute `Plugin-Class` declares the plugin main class. This class should extend the base class `nextflow.plugin.BasePlugin` e.g. `nextflow.hello.HelloPlugin`. +http://www.apache.org/licenses/LICENSE-2.0 -- `plugins/nf-hello/src/resources/META-INF/extensions.idx` - - This file declares one or more extension classes provided by the plugin. Each line should contain the fully qualified name of a Java class that implements the `org.pf4j.ExtensionPoint` interface (or a sub-interface). +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. -- `plugins/nf-hello/src/main` - - The plugin implementation sources. - -- `plugins/nf-hello/src/test` - - The plugin unit tests. - -## Plugin classes - -- `HelloConfig`: shows how to handle options from the Nextflow configuration - -- `HelloExtension`: shows how to create custom channel factories, operators, and fuctions that can be included into pipeline scripts - -- `HelloFactory` and `HelloObserver`: shows how to react to workflow events with custom behavior - -- `HelloPlugin`: the plugin entry point - -## Unit testing - -To run your unit tests, run the following command in the project root directory (ie. where the file `settings.gradle` is located): - -```bash -./gradlew check -``` - -## Testing and debugging - -To build and test the plugin during development, configure a local Nextflow build with the following steps: - -1. Clone the Nextflow repository in your computer into a sibling directory: - ```bash - git clone --depth 1 https://github.com/nextflow-io/nextflow ../nextflow - ``` - -2. Configure the plugin build to use the local Nextflow code: - ```bash - echo "includeBuild('../nextflow')" >> settings.gradle - ``` - - (Make sure to not add it more than once!) - -3. Compile the plugin alongside the Nextflow code: - ```bash - make compile - ``` - -4. Run Nextflow with the plugin, using `./launch.sh` as a drop-in replacement for the `nextflow` command, and adding the option `-plugins nf-hello` to load the plugin: - ```bash - ./launch.sh run nextflow-io/hello -plugins nf-hello - ``` - -## Testing without Nextflow build - -The plugin can be tested without using a local Nextflow build using the following steps: - -1. Build the plugin: `make buildPlugins` -2. Copy `build/plugins/` to `$HOME/.nextflow/plugins` -3. Create a pipeline that uses your plugin and run it: `nextflow run ./my-pipeline-script.nf` - -## Package, upload, and publish - -The project should be hosted in a GitHub repository whose name matches the name of the plugin, that is the name of the directory in the `plugins` folder (e.g. `nf-hello`). - -Follow these steps to package, upload and publish the plugin: - -1. Create a file named `gradle.properties` in the project root containing the following attributes (this file should not be committed to Git): - - * `github_organization`: the GitHub organisation where the plugin repository is hosted. - * `github_username`: The GitHub username granting access to the plugin repository. - * `github_access_token`: The GitHub access token required to upload and commit changes to the plugin repository. - * `github_commit_email`: The email address associated with your GitHub account. - -2. Use the following command to package and create a release for your plugin on GitHub: - ```bash - ./gradlew :plugins:nf-hello:upload - ``` - -3. Create a pull request against [nextflow-io/plugins](https://github.com/nextflow-io/plugins/blob/main/plugins.json) to make the plugin accessible to Nextflow. +[irida-next]: https://github.com/phac-nml/irida-next +[pipeline standards]: https://github.com/phac-nml/pipeline-standards diff --git a/plugins/nf-iridanext/src/resources/META-INF/MANIFEST.MF b/plugins/nf-iridanext/src/resources/META-INF/MANIFEST.MF index bef79c5..b834af9 100644 --- a/plugins/nf-iridanext/src/resources/META-INF/MANIFEST.MF +++ b/plugins/nf-iridanext/src/resources/META-INF/MANIFEST.MF @@ -1,6 +1,6 @@ Manifest-Version: 1.0 Plugin-Id: nf-iridanext Plugin-Version: 0.1.0 -Plugin-Class: nextflow.hello.HelloPlugin +Plugin-Class: nextflow.iridanext.IridaNextPlugin Plugin-Provider: nextflow Plugin-Requires: >=22.10.0 diff --git a/plugins/nf-iridanext/src/resources/META-INF/extensions.idx b/plugins/nf-iridanext/src/resources/META-INF/extensions.idx index 29d93e9..d635867 100644 --- a/plugins/nf-iridanext/src/resources/META-INF/extensions.idx +++ b/plugins/nf-iridanext/src/resources/META-INF/extensions.idx @@ -1,2 +1 @@ -nextflow.hello.HelloFactory -nextflow.hello.HelloExtension \ No newline at end of file +nextflow.iridanext.IridaNextFactory \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 558dd1f..6d35336 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,5 +1,6 @@ /* - * Copyright 2021, Seqera Labs + * Original file Copyright 2021, Seqera Labs (from nf-hello plugin template) + * Modifications Copyright 2023, Government of Canada * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +15,7 @@ * limitations under the License. */ -rootProject.name = 'nf-hello' +rootProject.name = 'nf-iridanext' include('plugins') -include('plugins:nf-hello') +include('plugins:nf-iridanext') includeBuild('../nextflow') From e6c4c62268c7b8f5deaa974ab56f448e9f1cb777 Mon Sep 17 00:00:00 2001 From: Aaron Petkau Date: Sun, 10 Dec 2023 20:16:09 -0600 Subject: [PATCH 11/11] Some fixes --- .github/workflows/build.yml | 4 ++-- .../src/main/nextflow/iridanext/IridaNextObserver.groovy | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5989117..6fb37a9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: nf-hello CI +name: nf-iridanext CI on: push: branches: @@ -10,7 +10,7 @@ on: - '*' jobs: build: - name: Build nf-hello + name: Build nf-iridanext if: "!contains(github.event.head_commit.message, '[ci skip]')" runs-on: ubuntu-latest timeout-minutes: 10 diff --git a/plugins/nf-iridanext/src/main/nextflow/iridanext/IridaNextObserver.groovy b/plugins/nf-iridanext/src/main/nextflow/iridanext/IridaNextObserver.groovy index a48065a..7630682 100644 --- a/plugins/nf-iridanext/src/main/nextflow/iridanext/IridaNextObserver.groovy +++ b/plugins/nf-iridanext/src/main/nextflow/iridanext/IridaNextObserver.groovy @@ -33,7 +33,7 @@ import nextflow.processor.TaskRun import nextflow.script.params.FileOutParam import nextflow.script.params.ValueOutParam -import nextflow.hello.IridaNextOutput +import nextflow.iridanext.IridaNextOutput /** * IridaNext workflow observer @@ -53,7 +53,7 @@ class IridaNextObserver implements TraceObserver { private List samplesMatchers private List globalMatchers - public HelloObserver() { + public IridaNextObserver() { pathMatchers = [:] addPathMatchers("global", []) addPathMatchers("samples", [])