Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Remove import statements from pipeline template #3165

Closed
ewels opened this issue Sep 11, 2024 · 1 comment
Closed

Remove import statements from pipeline template #3165

ewels opened this issue Sep 11, 2024 · 1 comment
Labels
high-priority template nf-core pipeline/component template
Milestone

Comments

@ewels
Copy link
Member

ewels commented Sep 11, 2024

We should not use Groovy import statements in Nextflow files:

import org.yaml.snakeyaml.Yaml
import groovy.json.JsonOutput
import nextflow.extension.FilesEx

import org.yaml.snakeyaml.Yaml
import nextflow.extension.FilesEx

Instead, use fully qualified names. So instead of:

Do this:

    Yaml parser = new org.yaml.snakeyaml.Yaml()

These are subworkflows, so need changing upstream. But adding the issue here because we need to make sure that the updated modules are pulled back into the template.

@ewels ewels added template nf-core pipeline/component template high-priority labels Sep 11, 2024
@ewels ewels added this to the 3.0 milestone Sep 11, 2024
@ewels
Copy link
Member Author

ewels commented Sep 11, 2024

Related - these additional fixes are also needed to get ahead of upcoming Nextflow syntax changes:

diff --git a/subworkflows/local/utils_nfcore_test_pipeline/main.nf b/subworkflows/local/utils_nfcore_test_pipeline/main.nf
index 12c3177..ad046d5 100644
--- a/subworkflows/local/utils_nfcore_test_pipeline/main.nf
+++ b/subworkflows/local/utils_nfcore_test_pipeline/main.nf
@@ -84,8 +84,8 @@ workflow PIPELINE_INITIALISATION {
                 }
         }
         .groupTuple()
-        .map {
-            validateInputSamplesheet(it)
+        .map {samplesheet ->
+            validateInputSamplesheet(samplesheet)
         }
         .map {
             meta, fastqs ->
@@ -165,7 +165,7 @@ def validateInputSamplesheet(input) {
     def (metas, fastqs) = input[1..2]
 
     // Check that multiple runs of the same sample are of the same datatype i.e. single-end / paired-end
-    def endedness_ok = metas.collect{ it.single_end }.unique().size == 1
+    def endedness_ok = metas.collect{meta -> meta.single_end }.unique().size == 1
     if (!endedness_ok) {
         error("Please check input samplesheet -> Multiple runs of a sample must be of the same datatype i.e. single-end or paired-end: ${metas[0].id}")
     }
@@ -238,8 +238,10 @@ def methodsDescriptionText(mqc_methods_yaml) {
         // Removing `https://doi.org/` to handle pipelines using DOIs vs DOI resolvers
         // Removing ` ` since the manifest.doi is a string and not a proper list
         def temp_doi_ref = ""
-        String[] manifest_doi = meta.manifest_map.doi.tokenize(",")
-        for (String doi_ref: manifest_doi) temp_doi_ref += "(doi: <a href=\'https://doi.org/${doi_ref.replace("https://doi.org/", "").replace(" ", "")}\'>${doi_ref.replace("https://doi.org/", "").replace(" ", "")}</a>), "
+        def manifest_doi = meta.manifest_map.doi.tokenize(",")
+        manifest_doi.each { doi_ref ->
+            temp_doi_ref += "(doi: <a href=\'https://doi.org/${doi_ref.replace("https://doi.org/", "").replace(" ", "")}\'>${doi_ref.replace("https://doi.org/", "").replace(" ", "")}</a>), "
+        }
         meta["doi_text"] = temp_doi_ref.substring(0, temp_doi_ref.length() - 2)
     } else meta["doi_text"] = ""
     meta["nodoi_text"] = meta.manifest_map.doi ? "" : "<li>If available, make sure to update the text to include the Zenodo DOI of version of the pipeline used. </li>"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
high-priority template nf-core pipeline/component template
Projects
None yet
Development

No branches or pull requests

2 participants