Skip to content

Commit 9a2a2cb

Browse files
authored
Update Nextflow
1 parent 2409807 commit 9a2a2cb

File tree

5 files changed

+104
-86
lines changed

5 files changed

+104
-86
lines changed

.gitmodules

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,9 +317,9 @@
317317
[submodule "vendor/grammars/atom-language-julia"]
318318
path = vendor/grammars/atom-language-julia
319319
url = https://github.com/JuliaEditorSupport/atom-language-julia
320-
[submodule "vendor/grammars/atom-language-nextflow"]
321-
path = vendor/grammars/atom-language-nextflow
322-
url = https://github.com/nextflow-io/atom-language-nextflow
320+
[submodule "vendor/grammars/vscode-language-nextflow"]
321+
path = vendor/grammars/vscode-language-nextflow
322+
url = https://github.com/nextflow-io/vscode-language-nextflow
323323
[submodule "vendor/grammars/atom-language-p4"]
324324
path = vendor/grammars/atom-language-p4
325325
url = https://github.com/TakeshiTseng/atom-language-p4

lib/linguist/languages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4943,7 +4943,7 @@ Nextflow:
49434943
type: programming
49444944
ace_mode: groovy
49454945
tm_scope: source.nextflow
4946-
color: "#3ac486"
4946+
color: "#0DC09D"
49474947
extensions:
49484948
- ".nf"
49494949
filenames:

samples/Nextflow/blast.nf

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
11
#!/usr/bin/env nextflow
22
/*
33
* This is free and unencumbered software released into the public domain.
4-
*
4+
*
55
* Anyone is free to copy, modify, publish, use, compile, sell, or
66
* distribute this software, either in source code form or as a compiled
77
* binary, for any purpose, commercial or non-commercial, and by any
88
* means.
9-
*
9+
*
1010
* In jurisdictions that recognize copyright laws, the author or authors
1111
* of this software dedicate any and all copyright interest in the
1212
* software to the public domain. We make this dedication for the benefit
1313
* of the public at large and to the detriment of our heirs and
1414
* successors. We intend this dedication to be an overt act of
1515
* relinquishment in perpetuity of all present and future rights to this
1616
* software under copyright law.
17-
*
17+
*
1818
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
1919
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2020
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
2121
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
2222
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
2323
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2424
* OTHER DEALINGS IN THE SOFTWARE.
25-
*
25+
*
2626
* For more information, please refer to <http://unlicense.org/>
2727
*/
28-
29-
/*
28+
29+
/*
3030
* Author Paolo Di Tommaso <[email protected]>
3131
*/
3232

@@ -35,33 +35,55 @@ params.query = "$HOME/sample.fa"
3535
params.db = "$HOME/tools/blast-db/pdb/pdb"
3636

3737
process blast {
38+
input:
39+
path query
40+
path db
41+
3842
output:
39-
file top_hits
43+
path 'top_hits'
4044

45+
script:
4146
"""
42-
blastp -query ${params.query} -db ${params.db} -outfmt 6 \
47+
blastp -query ${query} -db ${db} -outfmt 6 \
4348
| head -n 10 \
4449
| cut -f 2 > top_hits
4550
"""
4651
}
4752

4853
process extract {
4954
input:
50-
file top_hits
55+
path top_hits
56+
path db
57+
5158
output:
52-
file sequences
59+
path 'sequences'
5360

61+
script:
5462
"""
55-
blastdbcmd -db ${params.db} -entry_batch $top_hits > sequences
63+
blastdbcmd -db ${db} -entry_batch ${top_hits} > sequences
5664
"""
5765
}
5866

5967
process align {
68+
debug true
69+
6070
input:
61-
file sequences
62-
echo true
71+
path sequences
6372

73+
output:
74+
path 'align_result'
75+
76+
script:
6477
"""
65-
t_coffee $sequences 2>&- | tee align_result
78+
t_coffee ${sequences} 2>&- | tee align_result
6679
"""
6780
}
81+
82+
workflow {
83+
query = file(params.query)
84+
db = file(params.db)
85+
86+
ch_hits = blast(query, db)
87+
ch_sequences = extract(ch_hits, db)
88+
align(ch_sequences)
89+
}

samples/Nextflow/rnaseq.nf

Lines changed: 63 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,135 +1,131 @@
11
#!/usr/bin/env nextflow
22
/*
33
* This is free and unencumbered software released into the public domain.
4-
*
4+
*
55
* Anyone is free to copy, modify, publish, use, compile, sell, or
66
* distribute this software, either in source code form or as a compiled
77
* binary, for any purpose, commercial or non-commercial, and by any
88
* means.
9-
*
9+
*
1010
* In jurisdictions that recognize copyright laws, the author or authors
1111
* of this software dedicate any and all copyright interest in the
1212
* software to the public domain. We make this dedication for the benefit
1313
* of the public at large and to the detriment of our heirs and
1414
* successors. We intend this dedication to be an overt act of
1515
* relinquishment in perpetuity of all present and future rights to this
1616
* software under copyright law.
17-
*
17+
*
1818
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
1919
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2020
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
2121
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
2222
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
2323
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2424
* OTHER DEALINGS IN THE SOFTWARE.
25-
*
25+
*
2626
* For more information, please refer to <http://unlicense.org/>
2727
*/
28-
29-
30-
/*
28+
29+
30+
/*
3131
* Proof of concept of a RNAseq pipeline implemented with Nextflow
32-
*
32+
*
3333
* Authors:
3434
* - Paolo Di Tommaso <[email protected]>
35-
* - Emilio Palumbo <[email protected]>
36-
* - Evan Floden <[email protected]>
37-
*/
35+
* - Emilio Palumbo <[email protected]>
36+
* - Evan Floden <[email protected]>
37+
*/
38+
3839

39-
4040
params.reads = "$baseDir/data/ggal/*_{1,2}.fq"
4141
params.transcriptome = "$baseDir/data/ggal/ggal_1_48850000_49020000.Ggal71.500bpflank.fa"
4242
params.outdir = "."
4343
params.multiqc = "$baseDir/multiqc"
4444

45-
log.info """\
46-
R N A S E Q - N F P I P E L I N E
47-
===================================
48-
transcriptome: ${params.transcriptome}
49-
reads : ${params.reads}
50-
outdir : ${params.outdir}
51-
"""
52-
.stripIndent()
45+
workflow {
46+
log.info """\
47+
R N A S E Q - N F P I P E L I N E
48+
===================================
49+
transcriptome: ${params.transcriptome}
50+
reads : ${params.reads}
51+
outdir : ${params.outdir}
52+
""".stripIndent()
5353

54+
read_pairs_ch = channel.fromFilePairs( params.reads )
5455

55-
transcriptome_file = file(params.transcriptome)
56-
multiqc_file = file(params.multiqc)
57-
56+
index_ch = index( file(params.transcriptome) )
57+
fastqc_ch = fastqc( read_pairs_ch )
58+
quant_ch = quant( index_ch, read_pairs_ch )
59+
60+
multiqc_files_ch = quant_ch.mix(fastqc_ch).collect()
61+
multiqc( multiqc_files_ch, file(params.multiqc) )
62+
}
5863

59-
Channel
60-
.fromFilePairs( params.reads )
61-
.ifEmpty { error "Cannot find any reads matching: ${params.reads}" }
62-
.into { read_pairs_ch; read_pairs2_ch }
63-
6464

6565
process index {
6666
tag "$transcriptome_file.simpleName"
67-
67+
6868
input:
69-
file transcriptome from transcriptome_file
70-
69+
path transcriptome
70+
7171
output:
72-
file 'index' into index_ch
72+
path 'index'
7373

74-
script:
74+
script:
7575
"""
7676
salmon index --threads $task.cpus -t $transcriptome -i index
7777
"""
7878
}
79-
80-
81-
process quant {
82-
tag "$pair_id"
83-
79+
80+
81+
process fastqc {
82+
tag "FASTQC on $sample_id"
83+
8484
input:
85-
file index from index_ch
86-
set pair_id, file(reads) from read_pairs_ch
87-
85+
tuple val(sample_id), path(reads)
86+
8887
output:
89-
file(pair_id) into quant_ch
90-
88+
path("fastqc_${sample_id}_logs")
89+
9190
script:
9291
"""
93-
salmon quant --threads $task.cpus --libType=U -i index -1 ${reads[0]} -2 ${reads[1]} -o $pair_id
92+
mkdir fastqc_${sample_id}_logs
93+
fastqc -o fastqc_${sample_id}_logs -f fastq -q ${reads}
9494
"""
9595
}
96-
97-
process fastqc {
98-
tag "FASTQC on $sample_id"
96+
97+
98+
process quant {
99+
tag "$pair_id"
99100

100101
input:
101-
set sample_id, file(reads) from read_pairs2_ch
102+
path index
103+
tuple val(pair_id), path(reads)
102104

103105
output:
104-
file("fastqc_${sample_id}_logs") into fastqc_ch
105-
106+
path(pair_id)
106107

107108
script:
108109
"""
109-
mkdir fastqc_${sample_id}_logs
110-
fastqc -o fastqc_${sample_id}_logs -f fastq -q ${reads}
111-
"""
112-
}
113-
114-
110+
salmon quant --threads $task.cpus --libType=U -i index -1 ${reads[0]} -2 ${reads[1]} -o $pair_id
111+
"""
112+
}
113+
114+
115115
process multiqc {
116116
publishDir params.outdir, mode:'copy'
117-
117+
118118
input:
119-
file('*') from quant_ch.mix(fastqc_ch).collect()
120-
file(config) from multiqc_file
121-
119+
path('*')
120+
path(config)
121+
122122
output:
123-
file('multiqc_report.html')
124-
123+
path('multiqc_report.html')
124+
125125
script:
126126
"""
127127
cp $config/* .
128128
echo "custom_logo: \$PWD/logo.png" >> multiqc_config.yaml
129-
multiqc .
129+
multiqc .
130130
"""
131131
}
132-
133-
workflow.onComplete {
134-
println ( workflow.success ? "\nDone! Open the following report in your browser --> $params.outdir/multiqc_report.html\n" : "Oops .. something went wrong" )
135-
}

vendor/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ This is a list of grammars that Linguist selects to provide syntax highlighting
407407
- **NetLinx+ERB:** [amclain/sublime-netlinx](https://github.com/amclain/sublime-netlinx)
408408
- **NetLogo:** [textmate/lisp.tmbundle](https://github.com/textmate/lisp.tmbundle)
409409
- **NewLisp:** [textmate/lisp.tmbundle](https://github.com/textmate/lisp.tmbundle)
410-
- **Nextflow:** [nextflow-io/atom-language-nextflow](https://github.com/nextflow-io/atom-language-nextflow)
410+
- **Nextflow:** [nextflow-io/vscode-language-nextflow](https://github.com/nextflow-io/vscode-language-nextflow)
411411
- **Nginx:** [william-voyek/vscode-nginx](https://github.com/william-voyek/vscode-nginx)
412412
- **Nickel:** [tweag/nickel](https://github.com/tweag/nickel)
413413
- **Nim:** [nim-lang/NimLime](https://github.com/nim-lang/NimLime)

0 commit comments

Comments
 (0)