How to access the samplesheet in the seqera Pre-run script

I am doing my first seqera platform pipeline. I need to execute a script before the pipeline that would do some reformatting of the samplesheet. I understand that can I use the Pre-run script on th Advanced settings section:

prePipelineScript.R ${params.input}

but it doesn’t like it:

${params.input}: bad substitution.

How do I specify a parameter (such as $params.input) as parameter of the pre script?

The pre-run script is a bash script and it doesn’t have access to the params yet because Nextflow hasn’t started yet and so params doesn’t exist.

Is there any reason you don’t put prePipelineScript.R as your first process in your pipeline?

Thank you @Adam_Talbot, thank you. The thing is that the sample sheet is going to be modified. The full story is that I can get one of four different types sample sheets (coming from four different instruments). My script will take the samplesheet and change it to another samplesheet with the correct format for the pipeline to work with. So far I have been doing.

prePipelineScript.R instrumentSampleSheet.csv

With creates another samplesheet: pipelineSampleSheet.csv, which I then use on my pipeline.

What can I do?

I would put them in your pipeline:

workflow {
    // Get all samplesheets into separate channels
    a = Channel.fromPath(params.samplesheet_type_a)
    b = Channel.fromPath(params.samplesheet_type_b)

    // Parse each samplesheet as a process
    PARSE_A(a)
    PARSE_B(b)

    // Mix them all into a single channel
    all_samplesheets = Channel.empty()
        .mix(PARSE_A.out)
        .mix(PARSE_B.out)
        .ifEmpty {
            error "No valid samplesheet found!"
        }

    // Continue with your pipeline!
    DO_STUFF(all_samplesheets)
}