Skip to content

Commit

Permalink
implement suggested changes & add params to schema
Browse files Browse the repository at this point in the history
  • Loading branch information
Joon-Klaps committed Oct 31, 2024
1 parent 34dc6e5 commit 82d97d2
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 9 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
- Update GitHub Actions ([#3237](https://github.com/nf-core/tools/pull/3237))
- add `--dir/-d` option to schema commands ([#3247](https://github.com/nf-core/tools/pull/3247))
- Update pre-commit hook astral-sh/ruff-pre-commit to v0.7.1 ([#3250](https://github.com/nf-core/tools/pull/3250))
- init ([#3261](https://github.com/nf-core/tools/pull/3261))
- Add `downstream_samplesheets` to skip_features and GENERATE_DOWNSTREAM_SAMPLESHEETS to template ([#3261](https://github.com/nf-core/tools/pull/3261))

## [v3.0.2 - Titanium Tapir Patch](https://github.com/nf-core/tools/releases/tag/3.0.2) - [2024-10-11]

Expand Down
4 changes: 2 additions & 2 deletions nf_core/pipeline-template/conf/test.config
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ params {
genome = 'R64-1-1'
{%- endif %}

{% if downstream_samplesheets -%}
{% if downstream_samplesheet -%}
// Downstream samplesheets
generate_downstream_samplesheets = true
generate_pipeline_samplesheets = 'rnaseq'
generate_pipeline_samplesheets = 'rnaseq,sarek'
{%- endif %}
}
4 changes: 2 additions & 2 deletions nf_core/pipeline-template/conf/test_full.config
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ params {
fasta = params.pipelines_testdata_base_path + 'viralrecon/genome/NC_045512.2/GCF_009858895.2_ASM985889v3_genomic.200409.fna.gz'
{%- endif %}

{% if downstream_samplesheets -%}
{% if downstream_samplesheet -%}
// Downstream samplesheets
generate_downstream_samplesheets = true
generate_pipeline_samplesheets = 'rnaseq'
generate_pipeline_samplesheets = 'sarek,rnaseq'
{%- endif %}
}
24 changes: 24 additions & 0 deletions nf_core/pipeline-template/nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,30 @@
}
},
{%- endif %}
{% if downstream_samplesheet %}
"generate_samplesheet_options": {
"title": "Downstream pipeline samplesheet generation options",
"type": "object",
"fa_icon": "fas fa-university",
"description": "Options for generating input samplesheets for complementary downstream pipelines.",
"properties": {
"generate_downstream_samplesheets": {
"type": "boolean",
"description": "Turn on generation of samplesheets for downstream pipelines."
},
"generate_pipeline_samplesheets": {
"type": "string",
"description": "Specify a comma separated string in quotes to specify which pipeline to generate a samplesheet for.",
"pattern": "^(rnaseq|sarek)(?:,(sarek|rnaseq)){0,1}"
},
"generate_pipeline_samplesheets_format": {
"type": "string",
"description": "Specify the output format of the samplesheet.",
"enum": ["txt", "tsv", "csv"],
}
}
},
{%- endif %}
{%- if nf_core_configs %}
"institutional_config_options": {
"title": "Institutional config options",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

// TODO: Update the following workflow to a specific pipeline
// TODO nf-core: Update the following workflow to a specific pipeline
workflow SAMPLESHEET_RNASEQ {
take:
ch_reads
format

main:

//TODO nf-core: customise to your needs
ch_list_for_samplesheet = ch_reads.map { meta, reads ->
//TODO nf-core: Update the path to the published output directory of the reads
def out_path = file(params.outdir).toString() + '/relative/custom/path/'
def sample = meta.id
def fastq_1 = meta.single_end ? out_path + reads.getName() : out_path + reads[0].getName()
Expand All @@ -27,6 +29,35 @@ workflow SAMPLESHEET_RNASEQ {
channelToSamplesheet(ch_list_for_samplesheet, "${params.outdir}/downstream_samplesheets/rnaseq", format)
}

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUBWORKFLOW SPECIFIC FOR SAREK
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

// TODO nf-core: Update the following workflow to a specific pipeline
workflow SAMPLESHEET_SAREK {
take:
ch_reads
format

main:

//TODO nf-core: customise to your needs
ch_list_for_samplesheet = ch_reads.map { meta, reads ->
//TODO nf-core: Update the path to the published output directory of the reads
def out_path = file(params.outdir).toString() + '/relative/custom/path/'
def patient = meta.id
def sample = meta.id
def lane = ""
def fastq_1 = meta.single_end ? out_path + reads.getName() : out_path + reads[0].getName()
def fastq_2 = !meta.single_end ? out_path + reads[1].getName() : ""
[ patient: patient, sample: sample, lane: lane, fastq_1: fastq_1, fastq_2: fastq_2 ]
}

channelToSamplesheet(ch_list_for_samplesheet, "${params.outdir}/downstream_samplesheets/rnaseq", format)
}

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUBWORKFLOW CALLING PIPELINE SPECIFIC SAMPLESHEET GENERATION
Expand All @@ -40,13 +71,20 @@ workflow GENERATE_DOWNSTREAM_SAMPLESHEETS {
main:
def downstreampipeline_names = params.generate_pipeline_samplesheets.split(",")

// TODO: Add more pipelines here
// TODO nf-coee: Add more pipelines here
if (downstreampipeline_names.contains('rnaseq')) {
SAMPLESHEET_RNASEQ(
input,
params.generate_pipeline_samplesheets_format
)
}

if (downstreampipeline_names.contains('rnaseq')) {
SAMPLESHEET_SAREK(
input,
params.generate_pipeline_samplesheets_format
)
}
}

// Input can be any channel with a dictionary
Expand Down
4 changes: 2 additions & 2 deletions nf_core/pipelines/create/template_features.yml
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,9 @@ downstream_samplesheet:
short_description: "Generate downstream samplesheets"
description: "The pipeline will include the generate_downstream_samplesheets subworkflow for the generation of a samplesheet for other downstream pipelines."
help_text: |
The pipeline will include the generate_downstream_samplesheets subworkflow.
The pipeline will include the `GENERATE_DOWNSTREAM_SAMPLESHEETS` subworkflow.
The subworkflow generate_downstream_samplesheets provides a base template for generating samplesheets by taking a specified input channel of i.e. reads or fasta extracts its metadata for generating samplesheets.
The subworkflow `GENERATE_DOWNSTREAM_SAMPLESHEETS` provides a base template for generating samplesheets by taking a specified input channel of reads or fasta and extracts its metadata for generating samplesheets.
nfcore_pipelines: True
custom_pipelines: True
changelog:
Expand Down

0 comments on commit 82d97d2

Please sign in to comment.