diff --git a/modules/nextflow/src/main/groovy/nextflow/NextflowMeta.groovy b/modules/nextflow/src/main/groovy/nextflow/NextflowMeta.groovy index a9749b35ac..caec3aec41 100644 --- a/modules/nextflow/src/main/groovy/nextflow/NextflowMeta.groovy +++ b/modules/nextflow/src/main/groovy/nextflow/NextflowMeta.groovy @@ -23,6 +23,7 @@ import static nextflow.extension.Bolts.DATETIME_FORMAT @EqualsAndHashCode class NextflowMeta { + private static final String DSL1_EOL_MESSAGE = "Nextflow DSL1 is not supported anymore -- Please update your script to DSL2 or use Nextflow 22.10.x or early version" private static final Pattern DSL_DECLARATION = ~/(?m)^\s*(nextflow\.(preview|enable)\.dsl\s*=\s*(\d))\s*(;?\s*)?(;?\/{2}.*)?$/ private static final Pattern DSL1_INPUT = ~/(?m)input:\s*(tuple|file|path|val|env|stdin)\b.*\s.*\bfrom\b.+$/ @@ -44,7 +45,9 @@ class NextflowMeta { boolean recursion void setDsl( float num ) { - if( num != 2 && num != 1 ) + if( num == 1 ) + throw new IllegalArgumentException(DSL1_EOL_MESSAGE) + if( num != 2 ) throw new IllegalArgumentException("Not a valid DSL version number: $num") if( num == 2 && !ignoreWarnDsl2 ) log.warn1 "DSL 2 PREVIEW MODE IS DEPRECATED - USE THE STABLE VERSION INSTEAD -- Read more at https://www.nextflow.io/docs/latest/dsl2.html#dsl2-migration-notes" @@ -145,7 +148,9 @@ class NextflowMeta { } void enableDsl(String value) { - if( value !in ['1','2'] ) { + if( value == '1' ) + throw new AbortOperationException(DSL1_EOL_MESSAGE) + if( value != '2' ) { throw new AbortOperationException("Invalid Nextflow DSL value: $value") } this.enable.dsl = value=='1' ? 1f : 2f diff --git a/tests/ampa.nf b/tests/ampa.nf deleted file mode 100644 index 23d58b9a05..0000000000 --- a/tests/ampa.nf +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env nextflow -/* - * Copyright 2020-2022, Seqera Labs - * Copyright 2013-2019, Centre for Genomic Regulation (CRG) - * - * 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. - */ -nextflow.enable.dsl=1 - -params.in = "$baseDir/data/sample.fa" - -/* - * Splits the input file in chunks containing a single sequences, - * and send each of it over the 'seq' channel - */ -seq = Channel.fromPath(params.in).splitFasta() - -/* - * For each sequence that is sent over the 'seq' channel - * the below task is executed - */ -process ampaTask { - - input: - file seq - - output: - file result - - // The BASH script to be executed - for each - sequence - """ - AMPA.pl -in=${seq} -noplot -rf=result -df=data - """ - -} - -/* - * print out each 'result' produced by the above step - */ -result.subscribe { println it.text } diff --git a/tests/basic.nf b/tests/basic.nf deleted file mode 100644 index 73c3b2e379..0000000000 --- a/tests/basic.nf +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/env nextflow -/* - * Copyright 2020-2022, Seqera Labs - * Copyright 2013-2019, Centre for Genomic Regulation (CRG) - * - * 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. - */ - -/* - * Command line input parameter - */ -params.in = "$baseDir/data/sample.fa" - -/* - * Define the input file - */ -sequences = file(params.in) - - -/* - * split a fasta file in multiple files - */ -process splitSequences { - - input: - file 'input.fa' from sequences - - output: - file 'seq_*' into records - - """ - awk '/^>/{f="seq_"++d} {print > f}' < input.fa - """ - -} - -/* - * Simple reverse the sequences - */ -process reverse { - - input: - file x from records - - output: - stdout result - - """ - cat $x | rev - """ -} - -/* - * print the channel content - */ -result.subscribe { println it } diff --git a/tests/blast-parallel.nf b/tests/blast-parallel.nf deleted file mode 100644 index 89461c6edb..0000000000 --- a/tests/blast-parallel.nf +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/env nextflow -/* - * Copyright 2020-2022, Seqera Labs - * Copyright 2013-2019, Centre for Genomic Regulation (CRG) - * - * 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. - */ - -params.db = "$baseDir/blast-db/tiny" -params.query = "$baseDir/data/sample.fa" -params.chunk = 1 - -db = file(params.db) -chunks = Channel - .fromPath(params.query) - .splitFasta(by: params.chunk) - -/* - * Extends a BLAST query for each entry in the 'chunks' channel - */ -process blast { - input: - file 'query.fa' from chunks - - output: - file top_hits - - """ - blastp -db ${db} -query query.fa -outfmt 6 > blast_result - cat blast_result | head -n 10 | cut -f 2 > top_hits - """ -} - -/* - * Find out the top 10 matches returned by the BLAST query - */ -process extract { - input: - file top_hits - - output: - file sequences - - "blastdbcmd -db ${db} -entry_batch top_hits | head -n 10 > sequences" -} - -/* - * Collect all hits to a single file called 'all_seq' - */ -all_seq = sequences.collectFile(name:'all_seq') - -/* - * Aligns a T-Coffee MSA and print it - */ -process align { - debug true - - input: - file all_seq - - "t_coffee $all_seq 2>/dev/null | tee align_result" -} - diff --git a/tests/blast.nf b/tests/blast.nf deleted file mode 100644 index bbfa79b59f..0000000000 --- a/tests/blast.nf +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env nextflow -/* - * Copyright 2020-2022, Seqera Labs - * Copyright 2013-2019, Centre for Genomic Regulation (CRG) - * - * 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. - */ - -params.db = "$baseDir/blast-db/tiny" -params.query = "$baseDir/data/sample.fa" -params.chunkSize = 1 - -DB = file(params.db) - -seq = Channel .fromPath(params.query) .splitFasta( by: params.chunkSize ) - -process blast { - input: - file 'seq.fa' from seq - - output: - file 'out' into blast_result - - """ - blastp -db $DB -query seq.fa -outfmt 6 > out - """ -} - -process sort { - input: - file 'hits_*' from blast_result.collect() - - output: - stdout result - - """ - sort hits_* - """ -} - - -result.subscribe { println it } diff --git a/tests/buffer.nf b/tests/buffer.nf deleted file mode 100644 index 36ad3a6ae6..0000000000 --- a/tests/buffer.nf +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env nextflow -/* - * Copyright 2020-2022, Seqera Labs - * Copyright 2013-2019, Centre for Genomic Regulation (CRG) - * - * 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. - */ - -Channel - .fromPath("$baseDir/data/p?.fa") - .toSortedList() - .flatten() - .buffer(size:2, remainder: true) - .set { proteins } - - -process blastThemAll { - debug true - - input: - file x from proteins - - "echo $x" - -} diff --git a/tests/checks/ampa.nf/.checks b/tests/checks/ampa.nf/.checks deleted file mode 100644 index 8c005bfaa9..0000000000 --- a/tests/checks/ampa.nf/.checks +++ /dev/null @@ -1,17 +0,0 @@ -# -# run normal mode -# -$NXF_RUN $WITH_DOCKER --out result.txt | tee .stdout - -[[ `grep INFO .nextflow.log | grep -c 'Submitted process'` == 5 ]] || false -cmp .expected <(sort .stdout) || false - - -# -# run resume mode -# -$NXF_RUN $WITH_DOCKER --out result.txt -resume | tee .stdout - -[[ `grep INFO .nextflow.log | grep -c 'Cached process'` == 5 ]] || false -cmp .expected <(sort .stdout) || false - diff --git a/tests/checks/ampa.nf/.expected b/tests/checks/ampa.nf/.expected deleted file mode 100644 index 269724699b..0000000000 --- a/tests/checks/ampa.nf/.expected +++ /dev/null @@ -1,15 +0,0 @@ - - - - - -# This protein has 0 bactericidal stretches -# This protein has 0 bactericidal stretches -# This protein has 0 bactericidal stretches -# This protein has 0 bactericidal stretches -# This protein has 0 bactericidal stretches -# This protein has a mean antimicrobial value of 0.235 -# This protein has a mean antimicrobial value of 0.25 -# This protein has a mean antimicrobial value of 0.251 -# This protein has a mean antimicrobial value of 0.266 -# This protein has a mean antimicrobial value of 0.28 diff --git a/tests/checks/basic.nf/.checks b/tests/checks/basic.nf/.checks deleted file mode 100644 index 9bc500da09..0000000000 --- a/tests/checks/basic.nf/.checks +++ /dev/null @@ -1,19 +0,0 @@ -set -e - -# -# run normal mode -# -$NXF_RUN | tee .stdout - -[[ `grep INFO .nextflow.log | grep -c 'Submitted process'` == 2 ]] || false -diff .expected .stdout || false - - -# -# run resume mode -# -$NXF_RUN -resume | tee .stdout - -[[ `grep INFO .nextflow.log | grep -c 'Cached process'` == 2 ]] || false -diff .expected .stdout || false - diff --git a/tests/checks/basic.nf/.expected b/tests/checks/basic.nf/.expected deleted file mode 100644 index 4bdebcb47e..0000000000 --- a/tests/checks/basic.nf/.expected +++ /dev/null @@ -1,15 +0,0 @@ -Aoba1> -SPVWGQGNKTQAECWEGNHNYGLVRLKEGKTISLTNDGSAVFDYLAVFLN -NVPTIYN -Bscy1> -YGEKDNLRAWWWEIEDEDERHIITMCDGEKMPLEDDNQPEYDWLAYIVGK -PYLGLLNRPV -thp1> -GIEEPRAEQGDSFGLAVLSGKNVTLIDGLHLDIDEEREKKYDYLARYQYG -PSIKKRGIYEVYTGPFDGREGTTENYGNLW -eiv1> -IRELAAVPYIQVSGPHAESEVAYGEPTLNTCYWGVIQGQWAAGSKKRVRD -N -Avhi1> -DRIIKAKRRPVVKIDSNDQIVVAGEGKWLLKAPGKWVPDRSDRYYVRFN - diff --git a/tests/checks/blast-parallel.nf/.checks b/tests/checks/blast-parallel.nf/.checks deleted file mode 100644 index 95fd0b11fc..0000000000 --- a/tests/checks/blast-parallel.nf/.checks +++ /dev/null @@ -1,19 +0,0 @@ -set -e - -# -# run normal mode -# -$NXF_RUN $WITH_DOCKER > stdout - -[[ `grep INFO .nextflow.log | grep -c 'Submitted process > blast'` == 5 ]] || false -[[ `grep INFO .nextflow.log | grep -c 'Submitted process > extract'` == 5 ]] || false -[[ `grep INFO .nextflow.log | grep -c 'Submitted process > align'` == 1 ]] || false - -# -# run resume mode -# -$NXF_RUN $WITH_DOCKER -resume > stdout - -[[ `grep INFO .nextflow.log | grep -c 'Cached process > blast'` == 5 ]] || false -[[ `grep INFO .nextflow.log | grep -c 'Cached process > extract'` == 5 ]] || false -[[ `grep INFO .nextflow.log | grep -c 'Cached process > align'` == 1 ]] || false diff --git a/tests/checks/blast-parallel.nf/.expected b/tests/checks/blast-parallel.nf/.expected deleted file mode 100644 index aed44b018d..0000000000 --- a/tests/checks/blast-parallel.nf/.expected +++ /dev/null @@ -1,284 +0,0 @@ -CLUSTAL FORMAT for T-COFFEE Version_11.00.8cbe486 [http://www.tcoffee.org] [MODE: ], CPU=0.00 sec, SCORE=338, Nseq=18, Len=694 - -lcl|1VIE_A VF-------PS----NA---------------------------T----- -lcl|1IHU_A MQFL-----QNIPPY-LFFTGKGGVGKTSISCATAIRLAEQGKRVLLVST -lcl|1ABO_B MND------PN-----L--------------------------------- -lcl|1ABO_A MND------PN-----L--------------------------------- -lcl|1YCS_B PEITGQVSLPP---GKR---------------------------TNL--- -lcl|1IHD_C LPN-------------I--------------------------------- -lcl|1IHW_B MIQ----------------------------------------------- -lcl|1IHW_A MIQ----------------------------------------------- -lcl|1IHV_B MIQ----------------------------------------------- -lcl|1IHV_A MIQ----------------------------------------------- -lcl|1YCS_A SS-----SVPS----QK---------------------------T----- -lcl|1PHT_A MS------------------------------------------------ -lcl|1YCS_B_1 PEITGQVSLPP---GKR---------------------------TNL--- -lcl|1YCS_B_2 PEITGQVSLPP---GKR---------------------------TNL--- -lcl|1YCS_B_3 PEITGQVSLPP---GKR---------------------------TNL--- -lcl|1ABO_B_1 MND------PN-----L--------------------------------- -lcl|1ABO_A_1 MND------PN-----L--------------------------------- -lcl|1PHT_A_1 MS------------------------------------------------ - - -lcl|1VIE_A -----------F------------------------GM-GDRVR------ -lcl|1IHU_A DPASNVGQVFSQTIGNTIQAIASVPGLSALEIDPQAAAQQYRARIVDPIK -lcl|1ABO_B ----------------------------------------FVA------- -lcl|1ABO_A ----------------------------------------FVA------- -lcl|1YCS_B ------RKTGSER-----------------------IAHGMRVKF----- -lcl|1IHD_C ------------------------------------------------T- -lcl|1IHW_B ---------------------------------------NFRVYY----- -lcl|1IHW_A ---------------------------------------NFRVYY----- -lcl|1IHV_B ---------------------------------------NFRVYY----- -lcl|1IHV_A ---------------------------------------NFRVYY----- -lcl|1YCS_A -----------YQ-----------------------GSYGFRLGF----- -lcl|1PHT_A -------------------------------------------------- -lcl|1YCS_B_1 ------RKTGSER-----------------------IAHGMRVKF----- -lcl|1YCS_B_2 ------RKTGSER-----------------------IAHGMRVKF----- -lcl|1YCS_B_3 ------RKTGSER-----------------------IAHGMRVKF----- -lcl|1ABO_B_1 ----------------------------------------FVA------- -lcl|1ABO_A_1 ----------------------------------------FVA------- -lcl|1PHT_A_1 -------------------------------------------------- - - -lcl|1VIE_A --------------------------KKSGA------------------- -lcl|1IHU_A GVLPDDVVSSINEQLSGACTTEIAAFDE-FTGLLTDASLLTRFDHIIFDT -lcl|1ABO_B -------------------------------------------------- -lcl|1ABO_A -------------------------------------------------- -lcl|1YCS_B --------------------------NPLPLALLLDSSLEGEFDLV---- -lcl|1IHD_C -------------------------------ILATGGTIAGGGDSA---- -lcl|1IHW_B -------------------------------------------------- -lcl|1IHW_A -------------------------------------------------- -lcl|1IHV_B -------------------------------------------------- -lcl|1IHV_A -------------------------------------------------- -lcl|1YCS_A --------------------------LHSGTA------------------ -lcl|1PHT_A -------------------------------------------------- -lcl|1YCS_B_1 --------------------------NPLPLALLLDSSLEGEFDLV---- -lcl|1YCS_B_2 --------------------------NPLPLALLLDSSLEGEFDLV---- -lcl|1YCS_B_3 --------------------------NPLPLALLLDSSLEGEFDLV---- -lcl|1ABO_B_1 -------------------------------------------------- -lcl|1ABO_A_1 -------------------------------------------------- -lcl|1PHT_A_1 -------------------------------------------------- - - -lcl|1VIE_A -------------------------------------------------- -lcl|1IHU_A APTGHTIRLLQLPGAWSSFIDSNPEGASCLGPMAGLEKQREQYAYAVEAL -lcl|1ABO_B -------------------------------------------------- -lcl|1ABO_A -------------------------------------------------- -lcl|1YCS_B -------------------------------------------------- -lcl|1IHD_C -------------------------------------------------- -lcl|1IHW_B -------------------------------------------------- -lcl|1IHW_A -------------------------------------------------- -lcl|1IHV_B -------------------------------------------------- -lcl|1IHV_A -------------------------------------------------- -lcl|1YCS_A -------------------------------------------------- -lcl|1PHT_A -------------------------------------------------- -lcl|1YCS_B_1 -------------------------------------------------- -lcl|1YCS_B_2 -------------------------------------------------- -lcl|1YCS_B_3 -------------------------------------------------- -lcl|1ABO_B_1 -------------------------------------------------- -lcl|1ABO_A_1 -------------------------------------------------- -lcl|1PHT_A_1 -------------------------------------------------- - - -lcl|1VIE_A -------------------------------------------------- -lcl|1IHU_A SDPKRTRLVLVARLQKSTLQEVARTHLELAAIGLKNQYLVINGVLPKTEA -lcl|1ABO_B -------------------------------------------------- -lcl|1ABO_A -------------------------------------------------- -lcl|1YCS_B -------------------------------------------------- -lcl|1IHD_C -------------------------------------------------- -lcl|1IHW_B -------------------------------------------------- -lcl|1IHW_A -------------------------------------------------- -lcl|1IHV_B -------------------------------------------------- -lcl|1IHV_A -------------------------------------------------- -lcl|1YCS_A -------------------------------------------------- -lcl|1PHT_A -------------------------------------------------- -lcl|1YCS_B_1 -------------------------------------------------- -lcl|1YCS_B_2 -------------------------------------------------- -lcl|1YCS_B_3 -------------------------------------------------- -lcl|1ABO_B_1 -------------------------------------------------- -lcl|1ABO_A_1 -------------------------------------------------- -lcl|1PHT_A_1 -------------------------------------------------- - - -lcl|1VIE_A -------------------------------------------------- -lcl|1IHU_A ANDTLAAAI----------WEREQEALANLPADLAGLPTDTLFLQPVNMV -lcl|1ABO_B -------------------------------------------------- -lcl|1ABO_A -------------------------------------------------- -lcl|1YCS_B -----QRIIYEVDDPSLPND-----------------------------E -lcl|1IHD_C -----TKSN----------YTVG-------------------------KV -lcl|1IHW_B -------------------------------------------------- -lcl|1IHW_A -------------------------------------------------- -lcl|1IHV_B -------------------------------------------------- -lcl|1IHV_A -------------------------------------------------- -lcl|1YCS_A -------------------------------------------------- -lcl|1PHT_A -------------A------------------------------------ -lcl|1YCS_B_1 -----QRIIYEVDDPSLPND-----------------------------E -lcl|1YCS_B_2 -----QRIIYEVDDPSLPND-----------------------------E -lcl|1YCS_B_3 -----QRIIYEVDDPSLPND-----------------------------E -lcl|1ABO_B_1 -------------------------------------------------- -lcl|1ABO_A_1 -------------------------------------------------- -lcl|1PHT_A_1 -------------A------------------------------------ - - -lcl|1VIE_A -------------------------------------------------- -lcl|1IHU_A GVSALSRLLSTQPVASPSSDEYLQQRPDIPSLSALVDDIARNEHGLI--- -lcl|1ABO_B -------------------------------------------------- -lcl|1ABO_A -------------------------------------------------- -lcl|1YCS_B GITALHN------------------------------AVCAGHTEIVKFL -lcl|1IHD_C GVE----------------------------------------------- -lcl|1IHW_B -------------------------------------------------- -lcl|1IHW_A -------------------------------------------------- -lcl|1IHV_B -------------------------------------------------- -lcl|1IHV_A -------------------------------------------------- -lcl|1YCS_A -----KS------------------------------VTC---------- -lcl|1PHT_A -------------------------------------------------- -lcl|1YCS_B_1 GITALHN------------------------------AVCAGHTEIVKFL -lcl|1YCS_B_2 GITALHN------------------------------AVCAGHTEIVKFL -lcl|1YCS_B_3 GITALHN------------------------------AVCAGHTEIVKFL -lcl|1ABO_B_1 -------------------------------------------------- -lcl|1ABO_A_1 -------------------------------------------------- -lcl|1PHT_A_1 -------------------------------------------------- - - -lcl|1VIE_A -------------AWQGQIVGWYCTNLTPE--GYAVES----EAHPGSVQ -lcl|1IHU_A ----------------------------------M--------------- -lcl|1ABO_B -------------------------------------------------- -lcl|1ABO_A -------------------------------------------------- -lcl|1YCS_B VQFGVNVNAADSDGWTPLHCAASCNNVQVC--KFLVES----GAAVFAMT -lcl|1IHD_C ----------------------------------N--------------- -lcl|1IHW_B -------R------------------------------------------ -lcl|1IHW_A -------R------------------------------------------ -lcl|1IHV_B -------R------------------------------------------ -lcl|1IHV_A -------R------------------------------------------ -lcl|1YCS_A -------------TYSPALNKMFCQLAKTCPVQLWVDSTPPPGTRVRAMA -lcl|1PHT_A -------------------------------------------------- -lcl|1YCS_B_1 VQFGVNVNAADSDGWTPLHCAASCNNVQVC--KFLVES----GAAVFAMT -lcl|1YCS_B_2 VQFGVNVNAADSDGWTPLHCAASCNNVQVC--KFLVES----GAAVFAMT -lcl|1YCS_B_3 VQFGVNVNAADSDGWTPLHCAASCNNVQVC--KFLVES----GAAVFAMT -lcl|1ABO_B_1 -------------------------------------------------- -lcl|1ABO_A_1 -------------------------------------------------- -lcl|1PHT_A_1 -------------------------------------------------- - - -lcl|1VIE_A -----I-------------------------------------------- -lcl|1IHU_A -------------------------------------------LMGKGGV -lcl|1ABO_B -------------------------------------------LYDFVAS -lcl|1ABO_A -------------------------------------------LYDFVAS -lcl|1YCS_B YSDMQTAADKCEEMEEGYTQCSQFLYGVQEKMGIMNKGV-IYALWDYEPQ -lcl|1IHD_C -------------------------------------------LVNAVPQ -lcl|1IHW_B ------------------------------------------DSRDPVWK -lcl|1IHW_A ------------------------------------------DSRDPVWK -lcl|1IHV_B ------------------------------------------DSRDPVWK -lcl|1IHV_A ------------------------------------------DSRDPVWK -lcl|1YCS_A -----I-------------------------------------------- -lcl|1PHT_A ------------------------------------EGYQYRALYDYKKE -lcl|1YCS_B_1 YSDMQTAADKCEEMEEGYTQCSQFLYGVQEKMGIMNKGV-IYALWDYEPQ -lcl|1YCS_B_2 YSDMQTAADKCEEMEEGYTQCSQFLYG----------------------- -lcl|1YCS_B_3 YSDMQTAADKCEEMEEGYTQCSQFLYGVQEKMGIMNKGV-IYALWDYEPQ -lcl|1ABO_B_1 -------------------------------------------LYDFVAS -lcl|1ABO_A_1 -------------------------------------------LYDFVAS -lcl|1PHT_A_1 ------------------------------------EGYQYRALYDYKKE - - -lcl|1VIE_A -------------------------------------------------- -lcl|1IHU_A GKTTMAAAIAVRLADMGFD------VHLTTSDP-------AAHLS-MTLN -lcl|1ABO_B GDNTLS----ITKGEKLRV--------LGYNH-------NGEWCE---AQ -lcl|1ABO_A GDNTLS----ITKGEKLRV--------LGYNH-------NGEWCE---AQ -lcl|1YCS_B NDDELPM----KEGDCMTI--------IHREDED-----EIEWWW---AR -lcl|1IHD_C -LKDIA----NVKGEQVVN--------IGSQDMN-----DNVWLT---LA -lcl|1IHW_B GPAKL-----LWKGEGAVV--------IQDNS-------DIK-------- -lcl|1IHW_A GPAKL-----LWKGEGAVV--------IQDNS-------DIK-------- -lcl|1IHV_B GPAKL-----LWKGEGAVV--------IQDNS-------DIK-------- -lcl|1IHV_A GPAKL-----LWKGEGAVV--------IQDNS-------DIK-------- -lcl|1YCS_A -------------------------------------------------- -lcl|1PHT_A REEDIDL----HLGDILTVNKGSLVA-LGFSDGQEARPEEIGWLNGY-NE -lcl|1YCS_B_1 NDDELPM----KEGDCMTI--------IHREDED-----EIEWWW---AR -lcl|1YCS_B_2 -------------------------------------------------- -lcl|1YCS_B_3 NDDELPM----KEGDCMTI--------IHREDED-----EIEWWW---AR -lcl|1ABO_B_1 GDNTLS----ITKGEKLRV--------LGYNH-------NGEWCE---AQ -lcl|1ABO_A_1 GDNTLS----ITKGEKLRV--------LGYNH-------NGEWCE---AQ -lcl|1PHT_A_1 REEDIDL----HLGDILTVNKGSLVA-LGFSDGQEARPEEIGWLNGY-NE - - -lcl|1VIE_A -------------------------------------------------- -lcl|1IHU_A GSLNNLQVSRIDPHEETERYRQHVLETKGKELDEAGKRLLEEDLRSPCTE -lcl|1ABO_B --TK---------------------------------------------- -lcl|1ABO_A --TK---------------------------------------------- -lcl|1YCS_B -L-N---------------------------------------------- -lcl|1IHD_C KKIN---------------------------------------------- -lcl|1IHW_B -------------------------------------------------- -lcl|1IHW_A -------------------------------------------------- -lcl|1IHV_B -------------------------------------------------- -lcl|1IHV_A -------------------------------------------------- -lcl|1YCS_A -------------------------------------------------- -lcl|1PHT_A -T-T---------------------------------------------- -lcl|1YCS_B_1 -L-N---------------------------------------------- -lcl|1YCS_B_2 -------------------------------------------------- -lcl|1YCS_B_3 -L-N---------------------------------------------- -lcl|1ABO_B_1 --TK---------------------------------------------- -lcl|1ABO_A_1 --TK---------------------------------------------- -lcl|1PHT_A_1 -T-T---------------------------------------------- - - -lcl|1VIE_A -------------------------------------------------- -lcl|1IHU_A EIAVFQAFSRVIREAGKRFVVMDTAPTGHTLLLLDATGAYHREIAKKMGE -lcl|1ABO_B -------------------------------------------------- -lcl|1ABO_A -------------------------------------------------- -lcl|1YCS_B -------------------------------------------------- -lcl|1IHD_C -------------TDCDKT------------------------------- -lcl|1IHW_B -------------------------------------------------- -lcl|1IHW_A -------------------------------------------------- -lcl|1IHV_B -------------------------------------------------- -lcl|1IHV_A -------------------------------------------------- -lcl|1YCS_A -------------------------------------------------- -lcl|1PHT_A -------------------------------------------------- -lcl|1YCS_B_1 -------------------------------------------------- -lcl|1YCS_B_2 -------------------------------------------------- -lcl|1YCS_B_3 -------------------------------------------------- -lcl|1ABO_B_1 -------------------------------------------------- -lcl|1ABO_A_1 -------------------------------------------------- -lcl|1PHT_A_1 -------------------------------------------------- - - -lcl|1VIE_A -------------------------------------------------- -lcl|1IHU_A KGHFTTPMMLLQDPERTKVLLVTLPETTPVLEAANLQADLERAGIHPWGW -lcl|1ABO_B ---------------------------------------------NGQGW -lcl|1ABO_A ---------------------------------------------NGQGW -lcl|1YCS_B ---------------------------------------------DKEGY -lcl|1IHD_C -------------------------------------------------- -lcl|1IHW_B -------------------------------------------------V -lcl|1IHW_A -------------------------------------------------V -lcl|1IHV_B -------------------------------------------------V -lcl|1IHV_A -------------------------------------------------V -lcl|1YCS_A -------------------------------------------------- -lcl|1PHT_A ---------------------------------------------GERGD -lcl|1YCS_B_1 ---------------------------------------------DKEGY -lcl|1YCS_B_2 -------------------------------------------------- -lcl|1YCS_B_3 ---------------------------------------------DKEGY -lcl|1ABO_B_1 ---------------------------------------------NGQGW -lcl|1ABO_A_1 ---------------------------------------------NGQGW -lcl|1PHT_A_1 ---------------------------------------------GERGD - - -lcl|1VIE_A Y-PVAA-LERI---------------------N----------- -lcl|1IHU_A I-INNS-LSIADTRSPLLRMRAQQELPQIESVKR----QHAS-- -lcl|1ABO_B V-PSNY-ITPV---------------------NS---------- -lcl|1ABO_A V-PSNY-ITPV---------------------NS---------- -lcl|1YCS_B V-PRNL-LGLY---------------------PRIKPRQRSL-A -lcl|1IHD_C -------------------------------------------- -lcl|1IHW_B V-PRRKA-KII----------------------RD--------- -lcl|1IHW_A V-PRRKA-KII----------------------RD--------- -lcl|1IHV_B V-PRRKA-KII----------------------RD--------- -lcl|1IHV_A V-PRRKA-KII----------------------RD--------- -lcl|1YCS_A YKQSQHMTEV----------------------V----------- -lcl|1PHT_A F-PGTY-VEYI---------------------GR----KKISPP -lcl|1YCS_B_1 V-PRNL-LGLY---------------------PRIKPRQRSL-A -lcl|1YCS_B_2 -------------------------------------------- -lcl|1YCS_B_3 V-PRNL-LGLY---------------------PRIKPRQRSL-A -lcl|1ABO_B_1 V-PSNY-ITPV---------------------NS---------- -lcl|1ABO_A_1 V-PSNY-ITPV---------------------NS---------- -lcl|1PHT_A_1 F-PGTY-VEYI---------------------GR---------K - - - - diff --git a/tests/checks/blast.nf/.checks b/tests/checks/blast.nf/.checks deleted file mode 100644 index bb5360b4c4..0000000000 --- a/tests/checks/blast.nf/.checks +++ /dev/null @@ -1,20 +0,0 @@ -set -e - -# -# run normal mode -# -$NXF_RUN $WITH_DOCKER | tee .stdout - -[[ `grep INFO .nextflow.log | grep -c 'Submitted process > blast'` == 5 ]] || false -[[ `grep INFO .nextflow.log | grep -c 'Submitted process > sort'` == 1 ]] || false -diff .expected .stdout || false - -# -# run resume mode -# -$NXF_RUN $WITH_DOCKER -resume | tee .stdout - -[[ `grep INFO .nextflow.log | grep -c 'Cached process > blast'` == 5 ]] || false -[[ `grep INFO .nextflow.log | grep -c 'Cached process > sort'` == 1 ]] || false -diff .expected .stdout || false - diff --git a/tests/checks/blast.nf/.expected b/tests/checks/blast.nf/.expected deleted file mode 100644 index c42aae847b..0000000000 --- a/tests/checks/blast.nf/.expected +++ /dev/null @@ -1,34 +0,0 @@ -1aboA 1ABO:A 100.00 57 0 0 1 57 5 61 2e-40 120 -1aboA 1ABO:B 100.00 57 0 0 1 57 5 61 2e-40 120 -1aboA 1IHD:A 36.11 36 21 1 5 40 287 320 0.62 18.1 -1aboA 1IHD:A 75.00 8 2 0 28 35 179 186 0.69 17.7 -1aboA 1IHD:C 36.11 36 21 1 5 40 287 320 0.62 18.1 -1aboA 1IHD:C 75.00 8 2 0 28 35 179 186 0.69 17.7 -1aboA 1YCS:B 25.49 51 36 1 5 53 175 225 3e-04 27.3 -1ihvA 1IHN:A 35.00 20 13 0 25 44 72 91 7.0 14.6 -1ihvA 1IHN:A 66.67 9 3 0 35 43 28 36 3.7 15.4 -1ihvA 1IHN:B 35.00 20 13 0 25 44 72 91 7.0 14.6 -1ihvA 1IHN:B 66.67 9 3 0 35 43 28 36 3.7 15.4 -1ihvA 1IHU:A 27.27 33 24 0 8 40 534 566 5.5 15.0 -1ihvA 1IHV:A 100.00 49 0 0 1 49 4 52 3e-32 99.8 -1ihvA 1IHV:B 100.00 49 0 0 1 49 4 52 3e-32 99.8 -1ihvA 1IHW:A 100.00 49 0 0 1 49 4 52 3e-32 99.8 -1ihvA 1IHW:B 100.00 49 0 0 1 49 4 52 3e-32 99.8 -1ihvA 1YCS:A 54.55 11 5 0 1 11 107 117 0.88 17.3 -1pht 1IHF:B 33.33 21 14 0 53 73 60 80 0.75 18.1 -1pht 1IHS:H 32.00 25 17 0 40 64 175 199 4.0 16.5 -1pht 1IHT:H 32.00 25 17 0 40 64 175 199 4.0 16.5 -1pht 1PHT:A 100.00 80 0 0 1 80 5 84 1e-56 164 -1pht 1YCS:B 23.08 26 20 0 19 44 115 140 3.4 16.5 -1pht 1YCS:B 30.43 23 16 0 6 28 175 197 0.015 23.5 -1vie 1IHM:A 31.82 22 11 1 19 40 343 360 9.0 14.6 -1vie 1IHM:B 31.82 22 11 1 19 40 343 360 9.0 14.6 -1vie 1IHM:C 31.82 22 11 1 19 40 343 360 9.0 14.6 -1vie 1IHU:A 26.92 26 18 1 25 49 156 181 8.5 14.6 -1vie 1VIE:A 100.00 51 0 0 1 51 12 62 1e-35 108 -1ycsB 1ABO:A 24.07 54 39 1 3 56 6 57 4e-05 28.5 -1ycsB 1ABO:B 24.07 54 39 1 3 56 6 57 4e-05 28.5 -1ycsB 1IHU:A 35.71 14 9 0 6 19 251 264 6.9 15.4 -1ycsB 1PHT:A 30.43 23 16 0 6 28 10 32 0.013 22.3 -1ycsB 1YCS:B 100.00 60 0 0 1 60 170 229 3e-42 131 - diff --git a/tests/checks/buffer.nf/.checks b/tests/checks/buffer.nf/.checks deleted file mode 100644 index fec020da59..0000000000 --- a/tests/checks/buffer.nf/.checks +++ /dev/null @@ -1,21 +0,0 @@ -set -e - -# -# run normal mode -# -$NXF_RUN | tee .stdout - -[[ `grep -c 'Submitted process > blastThemAll' .nextflow.log` == 3 ]] || false -[[ `grep -c 'p1.fa p2.fa' .stdout` == 1 ]] || false -[[ `grep -c 'p3.fa p4.fa' .stdout` == 1 ]] || false -[[ `grep -c 'p5.fa' .stdout` == 1 ]] || false - -# -# run resume mode -# -$NXF_RUN -resume | tee .stdout - -[[ `grep -c 'Cached process > blastThemAll' .nextflow.log` == 3 ]] || false -[[ `grep -c 'p1.fa p2.fa' .stdout` == 1 ]] || false -[[ `grep -c 'p3.fa p4.fa' .stdout` == 1 ]] || false -[[ `grep -c 'p5.fa' .stdout` == 1 ]] || false diff --git a/tests/checks/demo.nf/.checks b/tests/checks/demo.nf/.checks deleted file mode 100644 index c037819494..0000000000 --- a/tests/checks/demo.nf/.checks +++ /dev/null @@ -1,32 +0,0 @@ -set -e - -# -# run normal mode -# -echo '' -echo \$ $NXF_RUN -$NXF_RUN | tee stdout - -[[ `grep 'INFO' .nextflow.log | grep -c 'Submitted process > sayHello'` == 5 ]] || false - -[[ `grep 'Hola world!' stdout` ]] || false -[[ `grep 'Γεια σου world!' stdout` ]] || false -[[ `grep 'Hello world!' stdout` ]] || false -[[ `grep 'Bojour world!' stdout` ]] || false -[[ `grep 'Ciao world!' stdout` ]] || false - - -# -# RESUME mode -# -echo '' -echo \$ $NXF_RUN -resume -$NXF_RUN -resume | tee stdout - -[[ `grep 'INFO' .nextflow.log | grep -c 'Cached process > sayHello'` == 5 ]] || false - -[[ `grep 'Hola world!' stdout` ]] || false -[[ `grep 'Γεια σου world!' stdout` ]] || false -[[ `grep 'Hello world!' stdout` ]] || false -[[ `grep 'Bojour world!' stdout` ]] || false -[[ `grep 'Ciao world!' stdout` ]] || false diff --git a/tests/checks/env-container.nf/.checks b/tests/checks/env-container.nf/.checks index a3e54840d5..d10f378da2 100644 --- a/tests/checks/env-container.nf/.checks +++ b/tests/checks/env-container.nf/.checks @@ -12,7 +12,6 @@ chmod +x bin/hello.sh # create the nextflow config file # cat << EOF > nextflow.config -nextflow.enable.dsl=1 env.FOO = 'HOLA' process.container = 'quay.io/nextflow/bash' EOF @@ -24,12 +23,16 @@ cat << EOF > foo.nf process foo { echo true input: - env BAR from Channel.value('Hello World!') + env BAR ''' env | sort hello.sh ''' } + +workflow { + channel.value('Hello World!') | foo +} EOF # diff --git a/tests/checks/env.nf/.checks b/tests/checks/env.nf/.checks deleted file mode 100644 index c7f680a877..0000000000 --- a/tests/checks/env.nf/.checks +++ /dev/null @@ -1,31 +0,0 @@ -set -e - -# -# run normal mode -# -echo '' -$NXF_RUN | tee stdout - -[[ `grep 'INFO' .nextflow.log | grep -c 'Submitted process > printEnv'` == 3 ]] || false - -[[ `grep -c 'HELLO_1=1' stdout` == 3 ]] || false -[[ `grep -c 'HELLO_2=2' stdout` == 3 ]] || false -[[ `grep -c 'HELLO_X=a' stdout` == 1 ]] || false -[[ `grep -c 'HELLO_X=b' stdout` == 1 ]] || false -[[ `grep -c 'HELLO_X=c' stdout` == 1 ]] || false - - -# -# RESUME mode -# -echo '' -$NXF_RUN -resume | tee stdout - -[[ `grep 'INFO' .nextflow.log | grep -c 'Cached process > printEnv'` == 3 ]] || false - -[[ `grep -c 'HELLO_1=1' stdout` == 3 ]] || false -[[ `grep -c 'HELLO_2=2' stdout` == 3 ]] || false -[[ `grep -c 'HELLO_X=a' stdout` == 1 ]] || false -[[ `grep -c 'HELLO_X=b' stdout` == 1 ]] || false -[[ `grep -c 'HELLO_X=c' stdout` == 1 ]] || false - diff --git a/tests/checks/env.nf/.exptected b/tests/checks/env.nf/.exptected deleted file mode 100644 index 2f431816a3..0000000000 --- a/tests/checks/env.nf/.exptected +++ /dev/null @@ -1,9 +0,0 @@ -HELLO_1=1 -HELLO_2=2 -HELLO_X=c -HELLO_1=1 -HELLO_2=2 -HELLO_X=b -HELLO_1=1 -HELLO_2=2 -HELLO_X=a diff --git a/tests/checks/multi-into.nf/.checks b/tests/checks/multi-into.nf/.checks deleted file mode 100644 index 90cb398fe8..0000000000 --- a/tests/checks/multi-into.nf/.checks +++ /dev/null @@ -1,33 +0,0 @@ -set -e - -# -# run normal mode -# -echo '' -$NXF_RUN | tee stdout - -[[ `< .nextflow.log grep -c 'Submitted process > foo'` == 1 ]] || false -[[ `< .nextflow.log grep -c 'Submitted process > bar1'` == 1 ]] || false -[[ `< .nextflow.log grep -c 'Submitted process > bar2'` == 1 ]] || false -[[ `< .nextflow.log grep -c 'Submitted process > bar3'` == 1 ]] || false - -[[ `< stdout grep 'Ciao A'` ]] || false -[[ `< stdout grep 'Ciao B'` ]] || false -[[ `< stdout grep 'Ciao C'` ]] || false -[[ `< stdout grep 'Hello 2'` ]] || false - -# -# run resume mode -# -echo '' -$NXF_RUN -resume | tee stdout - -[[ `< .nextflow.log grep -c 'Cached process > foo'` == 1 ]] || false -[[ `< .nextflow.log grep -c 'Cached process > bar1'` == 1 ]] || false -[[ `< .nextflow.log grep -c 'Cached process > bar2'` == 1 ]] || false -[[ `< .nextflow.log grep -c 'Cached process > bar3'` == 1 ]] || false - -[[ `< stdout grep 'Ciao A'` ]] || false -[[ `< stdout grep 'Ciao A'` ]] || false -[[ `< stdout grep 'Ciao C'` ]] || false -[[ `< stdout grep 'Hello 2'` ]] || false \ No newline at end of file diff --git a/tests/checks/publish-dir.nf/.checks b/tests/checks/publish-dir.nf/.checks index a909da03ee..692ef38ae7 100644 --- a/tests/checks/publish-dir.nf/.checks +++ b/tests/checks/publish-dir.nf/.checks @@ -5,7 +5,7 @@ echo First run $NXF_RUN | tee stdout [[ `grep INFO .nextflow.log | grep -c 'Submitted process > align'` == 3 ]] || false -[[ `grep INFO .nextflow.log | grep -c 'Submitted process > combine'` == 1 ]] || false +[[ `grep INFO .nextflow.log | grep -c 'Submitted process > my_combine'` == 1 ]] || false cmp stdout .expected || false [[ -f data/alpha.bai ]] || false @@ -28,7 +28,7 @@ echo Second run $NXF_RUN | tee stdout [[ `grep INFO .nextflow.log | grep -c 'Submitted process > align'` == 3 ]] || false -[[ `grep INFO .nextflow.log | grep -c 'Submitted process > combine'` == 1 ]] || false +[[ `grep INFO .nextflow.log | grep -c 'Submitted process > my_combine'` == 1 ]] || false cmp stdout .expected || false [[ -f data/alpha.bai ]] || false @@ -54,7 +54,7 @@ rm -rf more/data $NXF_RUN -resume | tee stdout [[ `grep INFO .nextflow.log | grep -c 'Cached process > align'` == 3 ]] || false -[[ `grep INFO .nextflow.log | grep -c 'Cached process > combine'` == 1 ]] || false +[[ `grep INFO .nextflow.log | grep -c 'Cached process > my_combine'` == 1 ]] || false cmp stdout .expected || false [[ -f data/alpha.bai ]] || false [[ -f data/alpha.bam ]] || false diff --git a/tests/chunk.nf b/tests/chunk.nf deleted file mode 100644 index 97e8efa038..0000000000 --- a/tests/chunk.nf +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env nextflow -/* - * Copyright 2020-2022, Seqera Labs - * Copyright 2013-2019, Centre for Genomic Regulation (CRG) - * - * 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. - */ -nextflow.enable.dsl=1 - -/* - * Show how get data from the 'stdin' virtual file - * - * The data is supposed to be a FASTA file which is splitted - * is chunks containing a single sequence - * - * The number of sequences in each each is controlled by the command - * line parameter '--chunkSize' (--chunk-size is a synonym for the same) - */ - -params.chunkSize = 1 - -Channel - .from(stdin) - .splitFasta( by: params.chunkSize) - .set{ sequences } - -process foo { - debug true - - input: - stdin sequences - - "cat -" -} diff --git a/tests/collect_and_merge.nf b/tests/collect_and_merge.nf index 9ca29cedf0..1d541aea96 100644 --- a/tests/collect_and_merge.nf +++ b/tests/collect_and_merge.nf @@ -15,7 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 + /* * fake alignment step producing a BAM and BAI files @@ -24,51 +24,28 @@ process algn { debug true input: - each barcode from 'alpha', 'gamma' - each seq_id from 'one', 'two', 'three' + each barcode + each seq_id output: - set barcode, seq_id, file('bam'), file('bai') into algn_files + tuple val(barcode), val(seq_id), file('bam'), file('bai') """ echo BAM $seq_id - $barcode > bam echo BAI $seq_id - $barcode > bai """ - } -/* - * aggregation is made by using a 'reduce' operator - * followed by 'flatMap' - */ - -aggregation = algn_files - .reduce([:]) { map, tuple -> // 'map' is used to collect all values; 'tuple' is the record containing four items: barcode, seqid, bam file and bai file - def barcode = tuple[0] // the first item is the 'barcode' - def group = map[barcode] // get the aggregation for current 'barcode' - if( !group ) group = [ barcode, [], [], [] ] // if new, create a new entry - group[1] << tuple[1] // append 'seq_id' to the aggregation list - group[2] << tuple[2] // append 'bam' file to the aggregation list - group[3] << tuple[3] // append 'bai' file to the aggregation list - map[barcode] = group // set back into the map - return map // return it so that it will be used in the next iteration - } - .flatMap { it.values() } // tricky part: get the list of values of in the map, each value is the - // aggregation build above - // the 'flatMap' emits each of these aggregation list as a single item - - .map { it.collect { it instanceof Collection ? it.sort() : it } } /* * Finally merge the BAMs and BAIs with the same 'barcode' */ - process merge { debug true input: - set barcode, seq_id, file(bam: 'bam?'), file(bai: 'bai?') from aggregation + tuple val(barcode), val(seq_id), file(bam: 'bam?'), file(bai: 'bai?') """ echo barcode: $barcode @@ -78,3 +55,34 @@ process merge { """ } + +workflow { + def ch1 = channel.of('alpha', 'gamma') + def ch2 = channel.of('one', 'two', 'three') + + aggregation = algn(ch1, ch2) + + /* + * aggregation is made by using a 'reduce' operator + * followed by 'flatMap' + */ + + aggregation = algn.out + .reduce([:]) { map, tuple -> // 'map' is used to collect all values; 'tuple' is the record containing four items: barcode, seqid, bam file and bai file + def barcode = tuple[0] // the first item is the 'barcode' + def group = map[barcode] // get the aggregation for current 'barcode' + if( !group ) group = [ barcode, [], [], [] ] // if new, create a new entry + group[1] << tuple[1] // append 'seq_id' to the aggregation list + group[2] << tuple[2] // append 'bam' file to the aggregation list + group[3] << tuple[3] // append 'bai' file to the aggregation list + map[barcode] = group // set back into the map + return map // return it so that it will be used in the next iteration + } + .flatMap { it.values() } // tricky part: get the list of values of in the map, each value is the + // aggregation build above + // the 'flatMap' emits each of these aggregation list as a single item + + .map { it.collect { it instanceof Collection ? it.sort() : it } } + + merge(aggregation) +} diff --git a/tests/collect_tuple.nf b/tests/collect_tuple.nf deleted file mode 100644 index 1aa0355c93..0000000000 --- a/tests/collect_tuple.nf +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env nextflow -/* - * Copyright 2020-2022, Seqera Labs - * Copyright 2013-2019, Centre for Genomic Regulation (CRG) - * - * 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. - */ -nextflow.enable.dsl=1 - -/* - * fake alignment step producing a BAM and BAI files - */ -process algn { - debug true - - input: - each barcode from 'alpha', 'gamma' - each seq_id from 'one', 'two', 'three' - - output: - set barcode, seq_id, file('bam'), file('bai') into algn_files - - """ - echo BAM $seq_id - $barcode > bam - echo BAI $seq_id - $barcode > bai - - """ - -} - -/* - * Collect all tuples with the same 'barcode' - */ - -aggregation = algn_files.groupTuple() - -/* - * Finally merge the BAMs and BAIs with the same 'barcode' - */ - -process merge { - debug true - - input: - set barcode, seq_id, file(bam: 'bam?'), file(bai: 'bai?') from aggregation - - """ - echo barcode: $barcode - echo seq_ids: $seq_id - echo bam : $bam - echo bai : $bai - """ - -} diff --git a/tests/complex-names.nf b/tests/complex-names.nf deleted file mode 100644 index 69cc1ed1d1..0000000000 --- a/tests/complex-names.nf +++ /dev/null @@ -1,41 +0,0 @@ -nextflow.enable.dsl=1 - -process foo { - publishDir 'foo', mode: 'copy' - container 'debian:latest' - output: - file '*.fa' into ch1 - file 'hello.txt' into ch2 - file '*.{zip,html}' into ch3 - file '01_A(R{1,2}).fastq' into ch4 - file 'sample_(1 2).vcf' into ch5 - file '.alpha' into ch6 - - script: - $/ - echo A > hello.txt - echo B > sample.zip - echo C > sample.html - echo D > 01_A\(R1\).fastq - echo E > 01_A\(R2\).fastq - echo F > sample_\(1\ 2\).vcf - echo 1 > f1.fa - echo 2 > f2.fa - echo 3 > f3.fa - mkdir .alpha - echo "Hello world!" > .alpha/hello.txt - /$ -} - -process bar { - debug true - container 'debian:latest' - input: - file '*' from ch1.mix(ch2,ch3,ch4,ch5,ch6).collect() - - script: - $/ - cat .alpha/hello.txt - [ `cat * | grep -c ''` == 9 ] || false - /$ -} diff --git a/tests/config-labels.nf b/tests/config-labels.nf index df5abfcc0f..0dfffd43b8 100644 --- a/tests/config-labels.nf +++ b/tests/config-labels.nf @@ -15,7 +15,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 +workflow { + alpha() + beta() + delta() + gamma() +} process alpha { debug true diff --git a/tests/config-vars.nf b/tests/config-vars.nf index f3c1ecd37b..a78551b98a 100644 --- a/tests/config-vars.nf +++ b/tests/config-vars.nf @@ -15,7 +15,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 /* * Verify that variable defined in the configuration file @@ -44,5 +43,9 @@ process bar { ''' echo bar !{t} ''' - +} + +workflow { + foo() + bar() } diff --git a/tests/copy-no-follow.nf b/tests/copy-no-follow.nf index e535b7a97c..9099a8a184 100644 --- a/tests/copy-no-follow.nf +++ b/tests/copy-no-follow.nf @@ -15,16 +15,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 process test { publishDir "outputDir", mode: 'copyNoFollow' output: - file '*' into testOutput + file '*' """ echo "TEST" > testFile.txt ln -s testFile.txt testFileLink.txt """ } + +workflow { + test() +} diff --git a/tests/demo-dsl2.nf b/tests/demo-dsl2.nf index 76084fc333..1ff8692013 100644 --- a/tests/demo-dsl2.nf +++ b/tests/demo-dsl2.nf @@ -10,7 +10,6 @@ process sayHello { """ } - workflow { - Channel.from('Bojour', 'Ciao', 'Hello', 'Hola', 'Γεια σου') | sayHello + Channel.of('Bojour', 'Ciao', 'Hello', 'Hola', 'Γεια σου') | sayHello } diff --git a/tests/demo.nf b/tests/demo.nf deleted file mode 100644 index 88a8732242..0000000000 --- a/tests/demo.nf +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env nextflow -/* - * Copyright 2020-2022, Seqera Labs - * Copyright 2013-2019, Centre for Genomic Regulation (CRG) - * - * 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. - */ -nextflow.enable.dsl=1 - -cheers = Channel.from 'Bojour', 'Ciao', 'Hello', 'Hola', 'Γεια σου' - -process sayHello { - debug true - input: - val x from cheers - - """ - echo '$x world!' - """ -} diff --git a/tests/dyn-mem.nf b/tests/dyn-mem.nf index eb9346925d..bdea005819 100644 --- a/tests/dyn-mem.nf +++ b/tests/dyn-mem.nf @@ -15,13 +15,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 +workflow { + channel.fromPath(['.small.txt','.big.txt']) | foo +} process foo { memory { x.size() < 10.B ? 100.MB : 200.MB } input: - file x from Channel.fromPath(['.small.txt','.big.txt']) + file x script: """ diff --git a/tests/dynamic-filename.nf b/tests/dynamic-filename.nf index c236fdba8a..459b1f373a 100644 --- a/tests/dynamic-filename.nf +++ b/tests/dynamic-filename.nf @@ -15,20 +15,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 params.prefix = 'my' data = 'Hello\n' +list = ['alpha', 'delta', 'gamma', 'omega'] process foo { input: - each x from 'alpha', 'delta', 'gamma', 'omega' - file "${params.prefix}_${x}.txt" from data + each x + file "${params.prefix}_${x}.txt" output: - file "${params.prefix}_${x}.txt" into result + file "${params.prefix}_${x}.txt" """ echo World >> ${params.prefix}_${x}.txt @@ -36,7 +36,6 @@ process foo { } -result.subscribe { - println "~ Saving ${it.name}" - it.copyTo('.') +workflow { + foo(list, data) | subscribe { println "~ Saving ${it.name}"; it.copyTo('.') } } diff --git a/tests/dynamic-storedir.nf b/tests/dynamic-storedir.nf index a03435c39c..3a0ce15fc8 100644 --- a/tests/dynamic-storedir.nf +++ b/tests/dynamic-storedir.nf @@ -15,22 +15,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 params.prefix = 'my' -data = 'Hello\n' - process foo { - storeDir "cache/$x" input: - each x from 'alpha', 'delta', 'gamma', 'omega' - file 'result.txt' from data + each x + file 'result.txt' output: - set x, file('result.txt') into result + tuple val(x), file('result.txt') """ echo World >> result.txt @@ -38,7 +34,12 @@ process foo { } -result.subscribe { code, file -> - println "~ Result ${file}" - file.copyTo("my_${code}.txt") +workflow { + def data = 'Hello\n' + def list = ['alpha', 'delta', 'gamma', 'omega'] + foo(list, data) | subscribe { code, file -> + println "~ Result ${file}" + file.copyTo("my_${code}.txt") + } + } diff --git a/tests/each-file-dsl2.nf b/tests/each-file-dsl2.nf index b27c975203..e92055e318 100644 --- a/tests/each-file-dsl2.nf +++ b/tests/each-file-dsl2.nf @@ -1,4 +1,20 @@ #!/usr/bin/env nextflow +/* + * Copyright 2020-2022, Seqera Labs + * Copyright 2013-2019, Centre for Genomic Regulation (CRG) + * + * 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. + */ process foo { debug true diff --git a/tests/each-file.nf b/tests/each-file.nf deleted file mode 100644 index 88671a889a..0000000000 --- a/tests/each-file.nf +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env nextflow -/* - * Copyright 2020-2022, Seqera Labs - * Copyright 2013-2019, Centre for Genomic Regulation (CRG) - * - * 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. - */ -nextflow.enable.dsl=1 - -Channel.fromPath("$baseDir/data/p{1,2,3}.fa").set { data_ch } - - -process foo { - debug true - - tag "$x" - - input: - each file(x) from data_ch - - """ - grep '>' $x - """ - -} diff --git a/tests/env-out.nf b/tests/env-out.nf index 4be8325dad..cf98f8c994 100644 --- a/tests/env-out.nf +++ b/tests/env-out.nf @@ -1,14 +1,35 @@ -nextflow.enable.dsl=1 +#!/usr/bin/env nextflow +/* + * Copyright 2020-2022, Seqera Labs + * Copyright 2013-2019, Centre for Genomic Regulation (CRG) + * + * 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. + */ process foo { output: - env FOO into ch + env FOO /FOO=Hello/ } process bar { debug true input: - env FOO from ch + env FOO 'echo "bar says $FOO"' } + + +workflow { + foo | bar +} diff --git a/tests/env.nf b/tests/env.nf deleted file mode 100644 index 696f380bb7..0000000000 --- a/tests/env.nf +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env nextflow -/* - * Copyright 2020-2022, Seqera Labs - * Copyright 2013-2019, Centre for Genomic Regulation (CRG) - * - * 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. - */ -nextflow.enable.dsl=1 - -/* - * Shows how manipulate the script execution environment - */ - -config.env [ 'HELLO_1' ] = '1' - -process printEnv { - debug true - - input: - env HELLO_2 from '2' - env HELLO_X from ('a','b','c') - - "env | grep HELLO | sort" -} diff --git a/tests/env2.nf b/tests/env2.nf index a64e5280d7..6f2c2d0899 100644 --- a/tests/env2.nf +++ b/tests/env2.nf @@ -15,17 +15,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 - -str = Channel.from('hello', 'hola', 'bonjour', 'ciao') process printEnv { debug true input: - env HELLO from str + env HELLO ''' echo $HELLO world! ''' } + +workflow { + Channel.of('hello', 'hola', 'bonjour', 'ciao') | printEnv +} diff --git a/tests/error-finish.nf b/tests/error-finish.nf index 2e45b25959..a3d56a8b9e 100644 --- a/tests/error-finish.nf +++ b/tests/error-finish.nf @@ -15,13 +15,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 process foo { debug true errorStrategy 'finish' - input: each x from 1,2,3 - output: stdout into results + input: each x + output: stdout script: if( x != 3 ) @@ -36,7 +35,7 @@ process foo { } process bar { - input: file 'x' from results + input: file 'x' script: ''' @@ -49,3 +48,7 @@ workflow.onError { println "success: $workflow.success" println "exitStatus: $workflow.exitStatus" } + +workflow { + foo([1,2,3]) | bar +} diff --git a/tests/error.nf b/tests/error.nf index 5bcf7b0c86..4093558f4c 100644 --- a/tests/error.nf +++ b/tests/error.nf @@ -15,14 +15,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 process task1 { maxForks 4 errorStrategy 'ignore' input: - val x from (1,2,3) + val x script: "echo $x; exit 1" @@ -32,9 +31,13 @@ process task2 { maxForks 4 input: - val x from([4,5,6]) + val x script: "echo $x" - } + +workflow { + channel.of(1,2,3) | task1 + channel.of(4,5,6) | task2 +} diff --git a/tests/escape-globs.nf b/tests/escape-globs.nf deleted file mode 100644 index c9eb7add4a..0000000000 --- a/tests/escape-globs.nf +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env nextflow -/* - * Copyright 2020-2022, Seqera Labs - * Copyright 2013-2019, Centre for Genomic Regulation (CRG) - * - * 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. - */ -nextflow.enable.dsl=1 - -_in1 = Channel.fromPath("$baseDir/data/file\\[a-b\\].txt") - -process foo { - - input: - file x from _in1 - - output: - file x into _out1 - file 'file-\\*.txt' into _out2 - file 'file-?.txt' glob false into _out3 - - ''' - touch file-\\*.txt - touch file-\\?.txt - ''' - -} - -_out1.view { "match: ${it.name}" } -_out2.view { "match: ${it.name}" } -_out3.view { "match: ${it.name}" } diff --git a/tests/exitstatus-fail.nf b/tests/exitstatus-fail.nf index 688cb23d25..c32e42b5be 100644 --- a/tests/exitstatus-fail.nf +++ b/tests/exitstatus-fail.nf @@ -15,7 +15,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 /* * This process terminates with an error since it returns a non-zero exit code @@ -26,3 +25,7 @@ process foo { exit 1 """ } + +workflow { + foo() +} diff --git a/tests/feedback.nf b/tests/feedback.nf deleted file mode 100644 index fdd37189c2..0000000000 --- a/tests/feedback.nf +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env nextflow -/* - * Copyright 2020-2022, Seqera Labs - * Copyright 2013-2019, Centre for Genomic Regulation (CRG) - * - * 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. - */ -nextflow.enable.dsl=1 - -foo = Channel.from('abc') -loop = Channel.create() - -process bar { - input: - file x from foo .mix(loop.take(2)) - output: - file q - - """ - rev $x > q - """ -} - -process baz { - input: - file q from q - output: - file z into loop - file z into result - - """ - cat $q > z - echo 'hello' >> z - """ -} - -result.last().view { it.text } diff --git a/tests/file-with-quote.nf b/tests/file-with-quote.nf index 7d31271f63..68778a8692 100644 --- a/tests/file-with-quote.nf +++ b/tests/file-with-quote.nf @@ -15,16 +15,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 process foo { input: - file 'a b.txt' from file("$baseDir/data/data'3.txt") + path 'a b.txt' output: - file 'x z.txt' into result + path 'x z.txt' ''' cat 'a b.txt' > 'x z.txt' ''' } -result.view { it.text } +workflow { + foo("$baseDir/data/data'3.txt") | view { it.text } +} diff --git a/tests/files.nf b/tests/files.nf index e7a9f9f93b..5f66d31e5c 100644 --- a/tests/files.nf +++ b/tests/files.nf @@ -15,17 +15,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 params.in = "$baseDir/data/sample.fa" SPLIT = (System.properties['os.name'] == 'Mac OS X' ? 'gcsplit' : 'csplit') process split { input: - file 'query.fa' from file(params.in) + path 'query.fa' output: - file 'seq_*' into splits + path 'seq_*' """ $SPLIT query.fa '%^>%' '/^>/' '{*}' -f seq_ @@ -37,10 +36,10 @@ process printTwo { debug true input: - file 'chunk' from splits + path 'chunk' output: - file 'chunk1:chunk3' into two_chunks mode flatten + file 'chunk1:chunk3' """ cat chunk* | rev @@ -52,12 +51,16 @@ process printLast { debug true input: - file 'chunk' from two_chunks + file 'chunk' output: - file 'chunk' into result + file 'chunk' """ cat chunk """ } + +workflow { + split(params.in) | printTwo | flatten | printLast +} diff --git a/tests/glob.nf b/tests/glob.nf index 8e4e2736d2..f61b3b0f3b 100644 --- a/tests/glob.nf +++ b/tests/glob.nf @@ -15,13 +15,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 process recurseDir { output: - file 'folder/**.fa' into result1 - file 'folder/**/*.txt' into result2 + file 'folder/**.fa' + file 'folder/**/*.txt' """ mkdir -p folder/x @@ -32,9 +31,10 @@ process recurseDir { touch folder/y/file4.fa touch folder/y/file5.txt """ - } - -result1.flatten().subscribe { println "result1: " + it.name } -result2.flatten().subscribe { println "result2: " + it.name } +workflow { + recurseDir() + recurseDir.out[0] | flatten | view { "result1: " + it.name } + recurseDir.out[1] | flatten | view { "result2: " + it.name } +} diff --git a/tests/hello.nf b/tests/hello.nf index 7a14350da5..1cbf95b56c 100644 --- a/tests/hello.nf +++ b/tests/hello.nf @@ -15,7 +15,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 process sayhello { debug true @@ -23,3 +22,7 @@ process sayhello { echo 'Hello world!' """ } + +workflow { + sayhello() +} diff --git a/tests/input.nf b/tests/input.nf index 75d09c6f92..931a39a85b 100644 --- a/tests/input.nf +++ b/tests/input.nf @@ -15,10 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 -x = 1 -y = ['a','b'] process foo { debug true @@ -28,9 +25,11 @@ process foo { val y output: - val y into result + val y "echo $x - $y" } -result.view { "foo out: $it" } +workflow { + foo(1, channel.of('a','b')) | view { "foo out: $it" } +} diff --git a/tests/mixing-langs.nf b/tests/mixing-langs.nf index 4c10705658..9e5ef0e8e2 100644 --- a/tests/mixing-langs.nf +++ b/tests/mixing-langs.nf @@ -15,7 +15,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 params.range = 100 @@ -24,7 +23,7 @@ params.range = 100 */ process perlTask { output: - stdout randNums + stdout shell: ''' @@ -40,7 +39,6 @@ process perlTask { ''' } - /* * A Python script task which parses the output of the previous script */ @@ -48,7 +46,7 @@ process pyTask { debug true input: - stdin randNums + stdin ''' #!/usr/bin/env python3 @@ -65,5 +63,8 @@ process pyTask { print("avg: %s - %s" % ( x/lines, y/lines )) ''' +} +workflow { + perlTask | pyTask } diff --git a/tests/modules.nf b/tests/modules.nf index 7aef7d3c49..bfb3e32d25 100644 --- a/tests/modules.nf +++ b/tests/modules.nf @@ -15,15 +15,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 process dotModule { module 'x' module 'y' - beforeScript 'module purge' ''' echo $PATH ''' } + +workflow { + dotModule() +} diff --git a/tests/multi-into.nf b/tests/multi-into.nf deleted file mode 100644 index 57abec8c58..0000000000 --- a/tests/multi-into.nf +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/env nextflow -/* - * Copyright 2020-2022, Seqera Labs - * Copyright 2013-2019, Centre for Genomic Regulation (CRG) - * - * 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. - */ -nextflow.enable.dsl=1 - -process foo { - output: - file 'x' into A,B,C - val 2 into baz - - """ - echo Ciao > x - """ -} - -baz.view { "Hello $it" } - -process bar1 { - debug true - input: - file x from A - - """ - printf "\$(cat $x) A" - """ -} - -process bar2 { - debug true - input: - file x from B - - """ - printf "\$(cat $x) B" - """ -} - -process bar3 { - debug true - input: - file x from C - - """ - printf "\$(cat $x) C" - """ -} diff --git a/tests/nativeCode.nf b/tests/nativeCode.nf index f913470849..c7f345015b 100644 --- a/tests/nativeCode.nf +++ b/tests/nativeCode.nf @@ -15,15 +15,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 process nativeCode { input: - val x from 'world' + val x output: - val y into stream + val y exec: y = "Hello $x" @@ -32,5 +31,7 @@ process nativeCode { } +workflow { + nativeCode('world') | view +} -stream.subscribe { println it } diff --git a/tests/opt-file.nf b/tests/opt-file.nf index 60855e9382..abf5fb2b1f 100644 --- a/tests/opt-file.nf +++ b/tests/opt-file.nf @@ -15,11 +15,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 process foo { output: - file 'missing.txt' optional true into result + path 'missing.txt', optional: true ''' echo miao @@ -28,9 +27,13 @@ process foo { process bar { input: - file x from result + file x ''' echo bau ''' } + +workflow { + foo | bar +} diff --git a/tests/output-file.nf b/tests/output-file.nf index 7b9a813940..f29804ef8a 100644 --- a/tests/output-file.nf +++ b/tests/output-file.nf @@ -15,16 +15,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 process foo { input: - file x from 'dummy' + file x output: - file x into result + file x 'echo foo' } - result.view { it.text } + +workflow { + foo('dummy') | view { it.text } +} diff --git a/tests/output-links.nf b/tests/output-links.nf index ed48ff99b0..faa3cbfab7 100644 --- a/tests/output-links.nf +++ b/tests/output-links.nf @@ -15,7 +15,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 process foo { output: @@ -26,3 +25,7 @@ process foo { ln -s file.txt link.txt ''' } + +workflow { + foo() +} diff --git a/tests/output-val.nf b/tests/output-val.nf deleted file mode 100644 index 8037842c4f..0000000000 --- a/tests/output-val.nf +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env nextflow -/* - * Copyright 2020-2022, Seqera Labs - * Copyright 2013-2019, Centre for Genomic Regulation (CRG) - * - * 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. - */ -nextflow.enable.dsl=1 - -x = 100 -y = 200 - -process foo { - input: - file fastq from 'dummy' - - output: - val 'Hello' into str_channel - val "${fastq.baseName}-${x}.out" into exp_channel - val x into x_channel - val y into y_channel - - script: - y = 'two hundred' - """ - echo bar - """ -} - -x_channel.view { "x: $it" } -y_channel.view { "y: $it" } -str_channel.view { "str: $it" } -exp_channel.view { "exp: $it" } diff --git a/tests/profiles.nf b/tests/profiles.nf index 7bb7b43e7a..44c27c984c 100644 --- a/tests/profiles.nf +++ b/tests/profiles.nf @@ -15,7 +15,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 process foo { debug true @@ -23,3 +22,5 @@ process foo { echo cpus: ${task.cpus} memory: ${task.memory} """ } + +workflow { foo() } diff --git a/tests/property-out-vals.nf b/tests/property-out-vals.nf index 5bdf097269..51fbb0dc64 100644 --- a/tests/property-out-vals.nf +++ b/tests/property-out-vals.nf @@ -15,12 +15,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 process foo { output: - val( task.exitStatus ) into ch1 - set val( record.foo ), val( record.bar ) into ch2 + val( task.exitStatus ) + tuple val( record.foo ), val( record.bar ) script: record = [foo:'aaa', bar: 'bbb'] @@ -29,5 +28,8 @@ process foo { """ } -ch1.view { "exit_status=$it" } -ch2.view { "record=${it[0]}_${it[1]}" } +workflow { + foo() + foo.out[0].view { "exit_status=$it" } + foo.out[1].view { "record=${it[0]}_${it[1]}" } +} diff --git a/tests/publish-dir.nf b/tests/publish-dir.nf index 3c58b696cb..420b640d8e 100644 --- a/tests/publish-dir.nf +++ b/tests/publish-dir.nf @@ -15,19 +15,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 -input = Channel.from('alpha','beta','delta') process align { publishDir 'data', mode: 'copy' input: - val(x) from input + val(x) output: - file("*.bam") into bam - file("${x}.bai") into bai + path("*.bam") + path("${x}.bai") """ echo ${x} > ${x}.bam @@ -35,16 +33,16 @@ process align { """ } -process combine { +process my_combine { publishDir 'data' publishDir 'more/data', mode: 'copy' input: - file(bamfile) from bam.toSortedList { it.name } - file(baifile) from bai.toSortedList { it.name } + path(bamfile) + path(baifile) output: - file 'result.txt' into result + path 'result.txt' """ cat $bamfile > result.txt @@ -52,8 +50,6 @@ process combine { """ } -result.subscribe { println it.text } - process foo { publishDir 'data', mode: 'link' output: @@ -66,3 +62,15 @@ process foo { touch xxx/C ''' } + +workflow { + def input = Channel.of('alpha','beta','delta') + align(input) + + def bam = align.out[0].toSortedList { it.name } + def bai = align.out[1].toSortedList { it.name } + my_combine( bam, bai ) + my_combine.out.view{ it.text } + + foo() +} diff --git a/tests/publish-nested.nf b/tests/publish-nested.nf index 92c1de91ad..d1b160adaf 100644 --- a/tests/publish-nested.nf +++ b/tests/publish-nested.nf @@ -15,7 +15,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 params.x = 'ciao' @@ -23,7 +22,7 @@ process foo { publishDir "data", mode: 'copy', overwrite: true output: - file("a") + path("a") script: """ @@ -31,3 +30,7 @@ process foo { echo -n $params.x > a/b/c/file.txt """ } + +workflow { + foo() +} diff --git a/tests/publish-s3.nf b/tests/publish-s3.nf index 5e6d287247..bded320345 100644 --- a/tests/publish-s3.nf +++ b/tests/publish-s3.nf @@ -1,16 +1,19 @@ -nextflow.enable.dsl=1 process my_process { publishDir "s3://nextflow-ci/work/ci-test/publish-s3" input: - val(param) from Channel.from(1) + val(param) output: - file("HELLO.tsv") into output_ch + file("HELLO.tsv") script: """ echo "Hello, world" > HELLO.tsv """ } + +workflow { + Channel.of(1) | my_process +} diff --git a/tests/publish-saveas.nf b/tests/publish-saveas.nf index fa09c7b01e..947c00ce3f 100644 --- a/tests/publish-saveas.nf +++ b/tests/publish-saveas.nf @@ -15,7 +15,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 def rule( file ) { if( file == 'file_1.txt' ) @@ -32,10 +31,14 @@ def rule( file ) { process foo { publishDir path: 'results', saveAs: this.&rule - input: each x from 1,2,3 - output: file '*.txt' + input: each x + output: path '*.txt' """ touch file_${x}.txt """ } + +workflow { + foo([1,2,3]) +} diff --git a/tests/race.nf b/tests/race.nf index da55a74a7c..a2d887a507 100644 --- a/tests/race.nf +++ b/tests/race.nf @@ -15,22 +15,27 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 -/* - * @author Simon Ye - */ +seqs = channel.fromList(file("$baseDir/data/seqs/*.fastq")) -seqs = file("$baseDir/data/seqs/*.fastq") +workflow { + seqs | proc1 + seqs | proc2 + seqs | proc3 + seqs | proc4 + seqs | proc5 + seqs | proc6 + seqs | proc7 +} process proc1 { storeDir 'results' input: - file fastq from seqs + file fastq output: - set val(baseName), file(outName) into proc1 + tuple val(baseName), file(outName) script: baseName = fastq.baseName @@ -44,10 +49,10 @@ process proc2 { storeDir 'results' input: - file fastq from seqs + file fastq output: - set val(baseName), file(outName) into proc2 + tuple val(baseName), file(outName) script: baseName = fastq.baseName @@ -61,10 +66,10 @@ process proc3 { storeDir 'results' input: - file fastq from seqs + file fastq output: - set val(baseName), file(outName) into proc3 + tuple val(baseName), file(outName) script: baseName = fastq.baseName @@ -78,10 +83,10 @@ process proc4 { storeDir 'results' input: - file fastq from seqs + file fastq output: - set val(baseName), file(outName) into proc4 + tuple val(baseName), file(outName) script: baseName = fastq.baseName @@ -96,10 +101,10 @@ process proc5 { storeDir 'results' input: - file fastq from seqs + file fastq output: - set val(baseName), file(outName) into proc5 + tuple val(baseName), file(outName) script: baseName = fastq.baseName @@ -113,10 +118,10 @@ process proc6 { storeDir 'results' input: - file fastq from seqs + file fastq output: - set val(baseName), file(outName) into proc6 + tuple val(baseName), file(outName) script: baseName = fastq.baseName @@ -130,10 +135,10 @@ process proc7 { storeDir 'results' input: - file fastq from seqs + file fastq output: - set val(baseName), file(outName) into proc7 + tuple val(baseName), file(outName) script: baseName = fastq.baseName diff --git a/tests/repeaters.nf b/tests/repeaters.nf index dc0047bc68..91c0b9f793 100644 --- a/tests/repeaters.nf +++ b/tests/repeaters.nf @@ -15,18 +15,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 -list1 = [1,2] -list2 = ['Hola', 'Ciao'] -list3 = ['alpha','beta','delta'] process hola { debug true input: - val x from list1 - each y from list2 - each z from list3 + val x + each y + each z """ echo 'x: $x; y: $y; z: $z' @@ -38,9 +34,20 @@ process foo { debug true input: - each v from Channel.from([["a","b"],["c","d"]]) + each v """ echo foo $v """ } + +workflow { + def list1 = channel.of(1,2) + def list2 = channel.of('Hola', 'Ciao') + def list3 = channel.of('alpha','beta','delta') + def list4 = channel.of(["a","b"],["c","d"]) + + hola(list1, list2, list3) + + foo(list4) +} diff --git a/tests/resume-retried-task.nf b/tests/resume-retried-task.nf index 814f0c4e16..fdbbee2134 100644 --- a/tests/resume-retried-task.nf +++ b/tests/resume-retried-task.nf @@ -15,7 +15,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 process foo { errorStrategy 'retry' @@ -31,3 +30,7 @@ process foo { echo ciao """ } + +workflow { + foo() +} diff --git a/tests/retry-ignore.nf b/tests/retry-ignore.nf index b0c0ba6320..a425517ce5 100644 --- a/tests/retry-ignore.nf +++ b/tests/retry-ignore.nf @@ -15,10 +15,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 process foo { errorStrategy { task.exitStatus==1 && task.attempt==1 ? 'retry' : 'ignore' } 'exit 1' } + +workflow { + foo() +} diff --git a/tests/rnaseq-toy.nf b/tests/rnaseq-toy.nf deleted file mode 100644 index e7a61de404..0000000000 --- a/tests/rnaseq-toy.nf +++ /dev/null @@ -1,89 +0,0 @@ -#!/usr/bin/env nextflow -/* - * Copyright 2020-2022, Seqera Labs - * Copyright 2013-2019, Centre for Genomic Regulation (CRG) - * - * 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. - */ -nextflow.enable.dsl=1 - -/* - * Defines pipeline parameters in order to specify the refence genomes - * and read pairs by using the command line options - */ -params.reads = "$baseDir/data/ggal/*_{1,2}.fq" -params.genome = "$baseDir/data/ggal/ggal_1_48850000_49020000.Ggal71.500bpflank.fa" - -/* - * The reference genome file - */ -genome_file = file(params.genome) - -/* - * Creates the `read_pairs` channel that emits for each read-pair a tuple containing - * three elements: the pair ID, the first read-pair file and the second read-pair file - */ -Channel - .fromFilePairs( params.reads ) - .ifEmpty { error "Cannot find any reads matching: ${params.reads}" } - .set { read_pairs } - -/* - * Step 1. Builds the genome index required by the mapping process - */ -process buildIndex { - input: - file genome from genome_file - - output: - file 'genome.index*' into genome_index - - """ - bowtie2-build ${genome} genome.index - """ -} - -/* - * Step 2. Maps each read-pair by using Tophat2 mapper tool - */ -process mapping { - input: - file genome from genome_file - file index from genome_index - set pair_id, file(reads) from read_pairs - - output: - set pair_id, "tophat_out/accepted_hits.bam" into bam_files - - """ - tophat2 genome.index ${reads} - """ -} - -/* - * Step 3. Assembles the transcript by using the "cufflinks" - * and publish the transcript output files into the `results` folder - */ -process makeTranscript { - publishDir "results" - - input: - set pair_id, bam_file from bam_files - - output: - set pair_id, 'transcripts.gtf' into transcripts - - """ - cufflinks ${bam_file} - """ -} diff --git a/tests/s3-files.nf b/tests/s3-files.nf index ae088c9752..9dac7b6458 100644 --- a/tests/s3-files.nf +++ b/tests/s3-files.nf @@ -15,20 +15,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 - /* - * Run a process using a S3 file as input - */ - - -s3file = file('s3://rnaseq-nf/data/ggal/transcript.fa') -s3glob = Channel.fromFilePairs('s3://rnaseq-nf/data/ggal/*_{1,2}.fq') process foo { debug true input: - file(obj) from s3file + path(obj) """ cat $obj | head @@ -38,10 +30,17 @@ process foo { process bar { tag "$pair" input: - set pair, file(obj) from s3glob + tuple val(pair), path(obj) """ cat $obj | head """ +} + +workflow { + def s3file = file('s3://rnaseq-nf/data/ggal/transcript.fa') + def s3glob = Channel.fromFilePairs('s3://rnaseq-nf/data/ggal/*_{1,2}.fq') + foo(s3file) + bar(s3glob) } diff --git a/tests/sets.nf b/tests/sets.nf index b8ca424e7e..9b03a9c3a2 100644 --- a/tests/sets.nf +++ b/tests/sets.nf @@ -15,17 +15,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 - -x = Channel.from( ['a', 'file1'], ['b','file2'] ) process touch { - input: - set ( id, fileName ) from x + tuple val(id), val(fileName) output: - set ( id, 'file*' ) into z - + tuple val(id), path('file*') / echo Creating $id @@ -35,16 +30,21 @@ process touch { process makeFiles { input: - set( id, 'file_x' ) from z + tuple val(id), path('file_x') output: - set( id, '*') into q mode flatten + tuple val(id), path('*') / cp file_x copy_$id touch beta_$id / - } -q.subscribe { println it } + +workflow { + def x = Channel.from( ['a', 'file1'], ['b','file2'] ) + touch(x) + makeFiles(touch.out) + makeFiles.out.view() +} diff --git a/tests/shell-script.nf b/tests/shell-script.nf index 843d7013db..403fdd9492 100644 --- a/tests/shell-script.nf +++ b/tests/shell-script.nf @@ -15,16 +15,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 + params.data = 'zzz' process foo { debug true input: - each x from ('alpha','omega') + each x shell: ''' echo Home: $HOME - Input: !{x} !{params.data} ''' } + +workflow { + foo(['alpha','omega']) +} diff --git a/tests/singleton.nf b/tests/singleton.nf index 0afbc2199f..86395a7bee 100644 --- a/tests/singleton.nf +++ b/tests/singleton.nf @@ -15,11 +15,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 process foo { output: - file x into foo_ch + file x ''' echo -n Hello > x @@ -28,8 +27,8 @@ process foo { process bar { input: - file x from foo_ch - val y from (1,2,3) + file x + val y """ cat $x @@ -37,3 +36,8 @@ process bar { """ } + +workflow { + foo() + bar(foo.out, channel.of(1,2,3)) +} diff --git a/tests/splitLetters.nf b/tests/splitLetters.nf index 53525de0d0..922edcfff8 100644 --- a/tests/splitLetters.nf +++ b/tests/splitLetters.nf @@ -15,34 +15,36 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 params.str = 'Hello world!' process splitLetters { output: - file 'chunk_*' into letters mode flatten + file 'chunk_*' """ printf '${params.str}' | split -b 6 - chunk_ """ } - process massage { input: - file x from letters + file x output: - stdout result + stdout """ cat $x | tr '[a-z]' '[A-Z]' """ } -result.subscribe { - println it.trim() +workflow { + splitLetters \ + | flatten \ + | massage \ + | view { it.trim() } } + diff --git a/tests/storeCache.nf b/tests/storeCache.nf index 84bad4eb55..084cdd39f7 100644 --- a/tests/storeCache.nf +++ b/tests/storeCache.nf @@ -15,9 +15,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 - -cheers = Channel.from 'Hello', 'Ciao', 'Hola' process storeCache { storeDir 'cache' @@ -26,10 +23,15 @@ process storeCache { val cheers output: - file "${cheers}.txt" into salut + file "${cheers}.txt" "printf $cheers > ${cheers}.txt" } -salut.subscribe { println it } +workflow { + Channel.of('Hello', 'Ciao', 'Hola') \ + | storeCache \ + | view +} + diff --git a/tests/stress.nf b/tests/stress.nf index 6a3661bef0..b11f4386d1 100644 --- a/tests/stress.nf +++ b/tests/stress.nf @@ -53,3 +53,13 @@ process io_write_200mega { read.pl file2.txt """ } + +workflow { + stress_1cpu + stress_2cpu + stress_100mega + stress_200mega + stress_300mega + io_write_100mega + io_write_200mega +} diff --git a/tests/subdirs.nf b/tests/subdirs.nf index c6380490e7..f47092fc48 100644 --- a/tests/subdirs.nf +++ b/tests/subdirs.nf @@ -15,18 +15,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 - -seqs = Channel.fromPath("$baseDir/data/p{1,2,3}.fa") process foo { debug true input: - file 'dir1/link_*.fasta' from seqs.toList() + file 'dir1/link_*.fasta' output: - file 'dir2/*' into result mode flatten + file 'dir2/*' ''' ls dir1 | sort @@ -36,4 +33,10 @@ process foo { ''' } -result.view { it.name } +workflow { + Channel.fromPath("$baseDir/data/p{1,2,3}.fa") \ + | toList \ + | foo \ + | flatten \ + | view { it.name } +} diff --git a/tests/tag-resume.nf b/tests/tag-resume.nf index 0e9941da7f..1cea8c02da 100644 --- a/tests/tag-resume.nf +++ b/tests/tag-resume.nf @@ -15,7 +15,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 process test { debug true @@ -25,3 +24,7 @@ process test { echo Hola """ } + +workflow { + test() +} diff --git a/tests/tagging-lazy.nf b/tests/tagging-lazy.nf index 7a463e0d89..ab571b10e8 100644 --- a/tests/tagging-lazy.nf +++ b/tests/tagging-lazy.nf @@ -15,7 +15,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 params.ext = 'fastq' @@ -24,10 +23,13 @@ process foo { tag "${barcode}.${params.ext}" input: - each barcode from 'alpha', 'delta', 'gamma', 'omega' + each barcode """ echo $barcode """ +} +workflow { + channel.of('alpha', 'delta', 'gamma', 'omega') | foo } diff --git a/tests/tagging.nf b/tests/tagging.nf index d6e8f496f7..b4bf5c1e90 100644 --- a/tests/tagging.nf +++ b/tests/tagging.nf @@ -15,17 +15,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 process foo { debug true - tag { barcode } + tag "$barcode" input: - each barcode from 'alpha', 'delta', 'gamma', 'omega' + each barcode """ echo $barcode """ +} +workflow { + channel.of('alpha', 'delta', 'gamma', 'omega') | foo } diff --git a/tests/task-attempts.nf b/tests/task-attempts.nf index 39aafd51f3..6cac94aa7c 100644 --- a/tests/task-attempts.nf +++ b/tests/task-attempts.nf @@ -15,7 +15,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 +workflow { + foo() +} process foo { diff --git a/tests/task-retry.nf b/tests/task-retry.nf index 58cd031238..52dab00678 100644 --- a/tests/task-retry.nf +++ b/tests/task-retry.nf @@ -15,7 +15,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 + +workflow { + foo() +} process foo { debug true diff --git a/tests/task-vars.nf b/tests/task-vars.nf index db519d4898..eea0feb630 100644 --- a/tests/task-vars.nf +++ b/tests/task-vars.nf @@ -15,7 +15,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 +workflow { + channel.of(1,2,3) | printVars +} process printVars { @@ -26,7 +28,7 @@ process printVars { memory '1GB' input: - each x from 1,2,3 + each x """ echo indx: ${task.index} diff --git a/tests/template-dyn.nf b/tests/template-dyn.nf index 66edf9d55e..0d3774535d 100644 --- a/tests/template-dyn.nf +++ b/tests/template-dyn.nf @@ -15,25 +15,28 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 list = 'alpha,delta,gamma'.tokenize(',') +workflow { + foo(list) + bar(list) +} + process foo { debug true input: - each x from list + each x script: template(task.command) } - process bar { debug true input: - each x from list + each x script: template(task.command) diff --git a/tests/template-shell.nf b/tests/template-shell.nf index 7cf7cbd22c..15f5df3ace 100644 --- a/tests/template-shell.nf +++ b/tests/template-shell.nf @@ -15,18 +15,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 params.data = 'zzz' +workflow { + channel.of('PF00389', 'PF03061', 'PF02826') | foo | view { it.text } +} + process foo { input: - val family from 'PF00389', 'PF03061', 'PF02826' + val family output: - file 'file.out' into results + file 'file.out' shell: template 'shell-script.txt' } -results.view { it.text } diff --git a/tests/template-simple.nf b/tests/template-simple.nf index a87c42ae12..2164414409 100644 --- a/tests/template-simple.nf +++ b/tests/template-simple.nf @@ -15,16 +15,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 + +workflow { + channel.of( 'PF00389', 'PF03061', 'PF02826') | foo | view { it.text } +} process foo { input: - val family from 'PF00389', 'PF03061', 'PF02826' + val family output: - file 'file.out' into results + file 'file.out' script: template 'bash-script.txt' } -results.view { it.text } diff --git a/tests/watch.nf b/tests/watch.nf deleted file mode 100644 index ee78abd41d..0000000000 --- a/tests/watch.nf +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env nextflow -/* - * Copyright 2020-2022, Seqera Labs - * Copyright 2013-2019, Centre for Genomic Regulation (CRG) - * - * 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. - */ -nextflow.enable.dsl=1 -params.events = 'create' -params.files = 'examples/data/*.fa' - -fasta = Channel.watchPath(params.files, params.events); - -process align { - input: - file fasta - - output: - file aln - - """ - t_coffee -in $fasta 1> aln - """ - -} - - -aln.subscribe { - println '------' - println it.text -} diff --git a/tests/when-block.nf b/tests/when-block.nf index 645eee0ce9..f45194c5d1 100644 --- a/tests/when-block.nf +++ b/tests/when-block.nf @@ -15,17 +15,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 items = [0,1,2,3,4] decode = ['zero','one','two','three','fourth'] +workflow { + channel.fromList(items) | foo + channel.fromList(items) | bar +} + process foo { debug true tag "${decode[x]}" input: - val x from items + val x when: x >= 3 @@ -36,13 +40,12 @@ process foo { """ } - process bar { debug true tag "${decode[x]}" input: - val x from items + val x when: x < 3 diff --git a/tests/workdir-with-blank.nf b/tests/workdir-with-blank.nf index 2f135b6b02..40be76c199 100644 --- a/tests/workdir-with-blank.nf +++ b/tests/workdir-with-blank.nf @@ -15,11 +15,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 process foo { input: - each x from 1,2,3 + each x output: file result_data @@ -28,3 +27,7 @@ process foo { echo Hello $x > result_data """ } + +workflow { + channel.of(1,2,3) | foo +} diff --git a/tests/workflow-oncomplete.nf b/tests/workflow-oncomplete.nf index 4965711fe9..caca812aab 100644 --- a/tests/workflow-oncomplete.nf +++ b/tests/workflow-oncomplete.nf @@ -22,17 +22,19 @@ * * See file `$PWD/checks/workflow-oncomplete.nf/.config` for details */ -nextflow.enable.dsl=1 params.command = 'echo' -cheers = Channel.from 'Bojour', 'Ciao', 'Hello', 'Hola', 'Γεια σου' process sayHello { debug true input: - val x from cheers + val x """ ${params.command} '$x world!' """ } + +workflow { + Channel.of('Bojour', 'Ciao', 'Hello', 'Hola', 'Γεια σου') | sayHello +} diff --git a/tests/yesOrNo.nf b/tests/yesOrNo.nf index d9343eb799..044bb69f5a 100644 --- a/tests/yesOrNo.nf +++ b/tests/yesOrNo.nf @@ -15,13 +15,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -nextflow.enable.dsl=1 +workflow { + channel.of(1,2) | yesOrNo +} process yesOrNo { debug true input: - val x from 1,2 + val x script: if( x == 1 ) { diff --git a/validation/test-complexpaths.nf b/validation/test-complexpaths.nf index 67be0423f6..2050313196 100644 --- a/validation/test-complexpaths.nf +++ b/validation/test-complexpaths.nf @@ -1,15 +1,17 @@ -nextflow.enable.dsl=1 +workflow { + foo | mix | collect | bar +} process foo { publishDir 'foo' container 'debian:latest' output: - file '*.fa' into ch1 - file 'hello.txt' into ch2 - file '*.{zip,html}' into ch3 - file '01_A(R{1,2}).fastq' into ch4 - file 'sample_(1 2).vcf' into ch5 - file '.alpha' into ch6 + file '*.fa' + file 'hello.txt' + file '*.{zip,html}' + file '01_A(R{1,2}).fastq' + file 'sample_(1 2).vcf' + file '.alpha' script: $/ @@ -31,7 +33,7 @@ process bar { debug true container 'debian:latest' input: - file '*' from ch1.mix(ch2,ch3,ch4,ch5,ch6).collect() + file '*' script: $/ diff --git a/validation/test-overwrite.nf b/validation/test-overwrite.nf index f21cf3693a..db4ab02b00 100644 --- a/validation/test-overwrite.nf +++ b/validation/test-overwrite.nf @@ -1,4 +1,6 @@ -nextflow.enable.dsl=1 +workflow { + foo() +} process foo { container = 'quay.io/nextflow/bash' diff --git a/validation/test-readspair.nf b/validation/test-readspair.nf index 52f61a9fe6..4e12c7fda2 100644 --- a/validation/test-readspair.nf +++ b/validation/test-readspair.nf @@ -1,8 +1,14 @@ -nextflow.enable.dsl=1 +workflow { + reads_pair() + reads_pair + .out.view() + .collect() + .subscribe { assert it.name == ['test.R1.fastq','test.R2.fastq'] } +} process reads_pair { output: - file("reads/*") into ch_out + file("reads/*") script: """ @@ -11,4 +17,3 @@ process reads_pair { """ } -assert ch_out.view().val.collect { it.name } == ['test.R1.fastq','test.R2.fastq'] diff --git a/validation/test-subdirs.nf b/validation/test-subdirs.nf index 2ced81c702..19762c11eb 100644 --- a/validation/test-subdirs.nf +++ b/validation/test-subdirs.nf @@ -1,15 +1,17 @@ -nextflow.enable.dsl=1 +workflow { + foo | bar +} process foo { output: - path 'gsfolder/' into ch1 - path 'gsfolder2' into ch2 - path 'gsfolder3' into ch3 - path 'gsfolder4' into ch4 - path 'test5.txt' into ch5 - path 'test6.txt' into ch6 - path 'test7.txt' into ch7 - path 'gsfolder5/sub' into ch8 + path 'gsfolder/' + path 'gsfolder2' + path 'gsfolder3' + path 'gsfolder4' + path 'test5.txt' + path 'test6.txt' + path 'test7.txt' + path 'gsfolder5/sub' """ mkdir -p gsfolder/sub @@ -36,13 +38,14 @@ process foo { process bar { input: - path test_folder from ch1 - path test_folder2 from ch2 - path 'test-folder3' from ch3 - path 'test-folder4/*' from ch4 - path test5 from ch5 - path 'this-is-test-6.txt' from ch6 - path 'test7/foo/*' from ch7 + path test_folder + path test_folder2 + path 'test-folder3' + path 'test-folder4/*' + path test5 + path 'this-is-test-6.txt' + path 'test7/foo/*' + path 'test8/*' """ set -x diff --git a/validation/test.sh b/validation/test.sh index 677885d137..b63e18f4b0 100755 --- a/validation/test.sh +++ b/validation/test.sh @@ -37,17 +37,6 @@ if [[ $TEST_MODE == 'test_integration' ]]; then $NXF_CMD run . -resume ) - # - # AMPA-NF - # - git clone https://github.com/cbcrg/ampa-nf - docker pull cbcrg/ampa-nf - ( - cd ampa-nf; - $NXF_CMD run . -with-docker - $NXF_CMD run . -with-docker -resume - ) - # # RNASEQ-NF #