askimed/nf-test

bug: "The current scope already contains a variable of the name x"

Closed this issue ยท 2 comments

I tried to add a test for the Sarek main workflow and was greeted with this error message:

> nf-test test --verbose workflows/sarek.nf --profile test,docker

๐Ÿš€ nf-test 0.8.2
https://code.askimed.com/nf-test
(c) 2021 - 2023 Lukas Forer and Sebastian Schoenherr

Error: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
/Users/adam.talbot/sarek/workflows/sarek.nf: 302: The current scope already contains a variable of the name it
 @ line 302, column 73.
   nel.fromPath(params.dict).map { it -> [ 
                                 ^

/Users/adam.talbot/sarek/workflows/sarek.nf: 354: The current scope already contains a variable of the name it
 @ line 354, column 35.
           intervals_bed_combined.map{it -> [ [ id:it.baseName ], it ]}.collect() :
                                     ^

/Users/adam.talbot/sarek/workflows/sarek.nf: 906: The current scope already contains a variable of the name it
 @ line 906, column 87.
   nt_calling_tumor_joined.filter{ it ->  !
                                 ^

/Users/adam.talbot/sarek/workflows/sarek.nf: 910: The current scope already contains a variable of the name it
 @ line 910, column 94.
   tumor_filtered.transpose().map{ it -> [i
                                 ^

/Users/adam.talbot/sarek/workflows/sarek.nf: 919: The current scope already contains a variable of the name it
 @ line 919, column 93.
   t_calling_normal_joined.filter{ it ->  !
                                 ^

/Users/adam.talbot/sarek/workflows/sarek.nf: 922: The current scope already contains a variable of the name it
 @ line 922, column 90.
   nt_calling_normal_filtered.map{ it -> [i
                                 ^

/Users/adam.talbot/sarek/workflows/sarek.nf: 160: unable to resolve class CONVERT_FASTQ_INPUT
 @ line 160, column 11.
   include { BAM_CONVERT_SAMTOOLS as CONVERT_FASTQ_INPUT } from '../subworkflows/local/bam_convert_samtools/main'
             ^

/Users/adam.talbot/sarek/workflows/sarek.nf: 161: unable to resolve class CONVERT_FASTQ_UMI
 @ line 161, column 11.
   include { BAM_CONVERT_SAMTOOLS as CONVERT_FASTQ_UMI   } from '../subworkflows/local/bam_convert_samtools/main'
             ^

/Users/adam.talbot/sarek/workflows/sarek.nf: 179: unable to resolve class BAM_TO_CRAM
 @ line 179, column 11.
   include { SAMTOOLS_CONVERT as BAM_TO_CRAM             } from '../modules/nf-core/samtools/convert/main'
             ^

/Users/adam.talbot/sarek/workflows/sarek.nf: 180: unable to resolve class BAM_TO_CRAM_MAPPING
 @ line 180, column 11.
   include { SAMTOOLS_CONVERT as BAM_TO_CRAM_MAPPING     } from '../modules/nf-core/samtools/convert/main'
             ^

/Users/adam.talbot/sarek/workflows/sarek.nf: 183: unable to resolve class CRAM_TO_BAM
 @ line 183, column 11.
   include { SAMTOOLS_CONVERT as CRAM_TO_BAM             } from '../modules/nf-core/samtools/convert/main'
             ^

/Users/adam.talbot/sarek/workflows/sarek.nf: 184: unable to resolve class CRAM_TO_BAM_RECAL
 @ line 184, column 11.
   include { SAMTOOLS_CONVERT as CRAM_TO_BAM_RECAL       } from '../modules/nf-core/samtools/convert/main'
             ^

/Users/adam.talbot/sarek/workflows/sarek.nf: 192: unable to resolve class CRAM_QC_NO_MD
 @ line 192, column 11.
   include { CRAM_QC_MOSDEPTH_SAMTOOLS as CRAM_QC_NO_MD  } from '../subworkflows/local/cram_qc_mosdepth_samtools/main'
             ^

/Users/adam.talbot/sarek/workflows/sarek.nf: 193: unable to resolve class CRAM_QC_RECAL
 @ line 193, column 11.
   include { CRAM_QC_MOSDEPTH_SAMTOOLS as CRAM_QC_RECAL  } from '../subworkflows/local/cram_qc_mosdepth_samtools/main'
             ^

14 errors

Here is my main.nf.test file:

nextflow_workflow {

    name "Test workflow: sarek"
    script "sarek.nf"
    workflow "SAREK"
    tag "workflows"
    tag "workflows_sarek"

    test("Sarek default") {

        when {
            workflow {
                """
                input[0] = null
                """
            }
            params {
                outdir = "results"
            }
        }

        then {
            assertAll(
                { assert workflow.success },
                { assert snapshot(workflow.out).match() }
            )
        }
    }
}

Attached it the .nf-test.log
nf-test.log

Hi Adam,

It seems to me that you run the nextflow file (workflows/sarek.nf) and no the testcase (main.nf.test)?

Dec-21 17:23:28.448 [main] INFO  com.askimed.nf.test.App - nf-test 0.8.2
Dec-21 17:23:28.457 [main] INFO  com.askimed.nf.test.App - Arguments: [test, --verbose, workflows/sarek.nf, --profile, test,docker]

Oh what a wally I am. Sorry!