22nextflow. enable. dsl= 2
33
44//
5- params. input_spectra = " $baseDir /data/"
5+ params. input_libraries = " $baseDir /data/"
66
77// This publish dir is mostly useful when we want to import modules in other workflows, keep it here usually don't change it
88params. publishdir = " $launchDir "
@@ -29,70 +29,11 @@ _publishdir = "${_publishdir}/nf_output"
2929// the publishdir is a key word that we're using around all our modules to control where the output files will be saved
3030include {summaryLibrary} from " $MODULES_FOLDER /nf_library_search_modules.nf" addParams(publishdir : _publishdir)
3131
32- process processDataPython {
33- /* This is a sample process that runs a python script.
34-
35- For each process, you can specify the publishDir, which is the directory where the output files will be saved.
36- You can also specify the conda environment that will be used to run the process.
37- The input and output blocks define the input and output files for the process.
38- The script block contains the command that will be run in the process.
39- */
40-
41- publishDir " $_publishdir " , mode: ' copy'
42-
43- conda " $TOOL_FOLDER /conda_env.yml"
44-
45- input:
46- file input
47-
48- output:
49- file ' python_output.tsv'
50-
51- script:
52- """
53- python $TOOL_FOLDER /python_script.py --input_filename $input --output_filename python_output.tsv
54- """
55- }
56-
57- workflow Main {
58- // ------- -------
59- /*
60- For each named workflow, add 'take' and 'main' blocks.
61-
62- --take--
63- For the take block, you can specify the input parameters that will be passed to the workflow.
64- Another option instead of passing all the values, is to use a map, which is a dictionary of key-value pairs.
65-
66- --main--
67- The main block is where the workflow is defined. You can call other processes and workflows from here.
68-
69- --emit--
70- This is an optional block and if you are new to nextflow you can ignore it.
71- This is can be useful in future generations of nextflow, replacing the need for the 'publishDir' directive.
72- */
73-
74- take :
75- input_map
76-
77- main :
78- libraries_ch = Channel . fromPath(input_map. input_spectra + " /*.mgf" )
79- // summaryLibrary(libraries_ch)
80- library_summary_ch = summaryLibrary(libraries_ch)
81- processDataPython(library_summary_ch)
82-
83- emit :
84- library_summary_ch // doesn't need .out as it is already the output of summaryLibrary, assigned to library_summary_ch
85- py_out = processDataPython. out
86- }
87-
8832workflow {
89- /*
90- The input map is created to reduce the dependency of the other workflows to the `params`
91- */
92- input_map = [
93- input_spectra : params. input_spectra
94- ]
95- out = Main (input_map)
96- out[0 ]. view() // library_summary_ch
97- out. py_out. view()
33+ libraries_ch = Channel . fromPath(params. input_libraries + " /*.mgf" )
34+ // Get the first one
35+ library_summary_ch = summaryLibrary(libraries_ch. first())
36+
37+ // merge summary files as tsv
38+ library_summary_ch. collectFile(name : ' librarysummary.tsv' , keepHeader : true , storeDir : _publishdir + " /librarysummary" )
9839}
0 commit comments