Nextflow ERROR ~ Cannot read write-only property: from

I am trying to download using my custom python script located in a location and output to a directory of my choice. However, I encountered

ERROR ~ Cannot read write-only property: from.

I have tried multiple ways to tell nextflow, here is my input script and I want the output of that script in my desired folder.

When I comment out input and output, it runs fine. And my python script runs and downloads fine in a terminal.

Any help or suggestion in appreciated. Thanks.

Here is my code.

#!/usr/bin/env nextflow

nextflow.enable.dsl=2

// Pipeline parameters
params.uri_file = "./data/zinc/zn_test_uri.uri"
params.output_dir = "./data/zinc/test_fold/"

// Channel for the URI file
uri_channel = Channel.fromPath(params.uri_file)

// Process to download PDBQT files from given URLs
process znDownload {

    input:
    path uri_file from uri_channel

    output:
    path "${params.output_dir}/*" into separated_files

    script:
    """
    python3 ./scripts/zinc_download_pdbqt_from_url.py --uri_file ${uri_file} --output_dir ${params.output_dir}
    """
}

// Workflow
workflow {
    znDownload()
    separated_files.view()
}

Hi @Janaksunuwar. Welcome to the community forum :smiley:

This code you shared is DSL1, an older version of the Nextflow language syntax that is no longer supported by recent versions of Nextflow. I’d recommend you to convert your pipeline to DSL2 so that you can benefit from newer version (and features) of Nextflow.

There’s a Migrating from DSL1 section in the Nextflow official docs. Seqera AI can also help with that.

1 Like
#!/usr/bin/env nextflow
nextflow.enable.dsl=2

// Pipeline parameters
params.uri_file = "./data/zinc/zn_test_uri.uri"
params.output_dir = "./data/zinc/test_fold/"


// Process to download PDBQT files from given URLs
process znDownload {
    
    publishDir ("${params.output_dir}", mode: 'copy')
    
    input:
    path uri_file

    output:
    path "*.pdbqt", emit: downloaded_files 

    script:
    """
        python3 ./scripts/zinc_download_pdbqt_from_url.py --uri_file ${uri_file} 
        """

}
workflow {
    def uri_channel = Channel.fromPath(params.uri_file)
    znDownload(uri_channel)
}

Great! Another tip is that from version 22.03.0-edge on, it’s no longer required to explicitly set nextflow.enable.dsl=2. It’s the default and only supported Nextflow Domain-Specific Language (DSL) version.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.