nf-core / tools

Python package with helper tools for the nf-core community.
https://nf-co.re
MIT License
232 stars 187 forks source link

`modules update` with `patch` deletes files in `templates` #3157

Open FriederikeHanssen opened 2 weeks ago

FriederikeHanssen commented 2 weeks ago

Description of the bug

I customised the multiqc module to have a templates folder. I then applied nf-core modules patch which generates a diff file for the main.nf If I then run nf-core modules update multiqc the templates folder is removed.

Command used and terminal output

1. Add templates folder to module
2. nf-core modules patch
3. nf-core modules update multiqc
4. "Preview diff in terminal, choose whether to update files":

INFO     'modules/nf-core/multiqc/tests/tags.yml' is unchanged                                                                                                                                                                                                                                            
INFO     'modules/nf-core/multiqc/templates/custom.ipynb' was removed                                                                                                                                                                                                                                     
INFO     'modules/nf-core/multiqc/templates/custom_multiqc.py' was removed

System information

nf-core/tools version 2.14.2.dev0

FriederikeHanssen commented 2 weeks ago

Adding the diff file, which contains the template files:


Changes in module 'nf-core/multiqc'
'modules/nf-core/multiqc/meta.yml' is unchanged
Changes in 'multiqc/main.nf':
--- modules/nf-core/multiqc/main.nf
+++ modules/nf-core/multiqc/main.nf
@@ -30,32 +30,6 @@
     def logo = multiqc_logo ? /--cl-config 'custom_logo: "${multiqc_logo}"'/ : ''
     def replace = replace_names ? "--replace-names ${replace_names}" : ''
     def samples = sample_names ? "--sample-names ${sample_names}" : ''
-    """
-    multiqc \\
-        --force \\
-        $args \\
-        $config \\
-        $extra_config \\
-        $logo \\
-        $replace \\
-        $samples \\
-        .

-    cat <<-END_VERSIONS > versions.yml
-    "${task.process}":
-        multiqc: \$( multiqc --version | sed -e "s/multiqc, version //g" )
-    END_VERSIONS
-    """
-
-    stub:
-    """
-    mkdir multiqc_data
-    touch multiqc_plots
-    touch multiqc_report.html
-
-    cat <<-END_VERSIONS > versions.yml
-    "${task.process}":
-        multiqc: \$( multiqc --version | sed -e "s/multiqc, version //g" )
-    END_VERSIONS
-    """
+    template "custom_multiqc.py"
 }

'modules/nf-core/multiqc/environment.yml' is unchanged
'modules/nf-core/multiqc/templates/custom.ipynb' was created
'modules/nf-core/multiqc/templates/custom_multiqc.py' was created
'modules/nf-core/multiqc/tests/main.nf.test' is unchanged
'modules/nf-core/multiqc/tests/main.nf.test.snap' is unchanged
'modules/nf-core/multiqc/tests/tags.yml' is unchanged
************************************************************