Skip to content

Commit

Permalink
Merge pull request #364 from nf-core/move-protocols-to-profiles
Browse files Browse the repository at this point in the history
Move protocols to config profile(s)
  • Loading branch information
apeltzer authored Jul 31, 2024
2 parents 7e503f8 + d908088 commit 374ec02
Show file tree
Hide file tree
Showing 18 changed files with 60 additions and 70 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/awstest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
{
"outdir": "s3://${{ secrets.AWS_S3_BUCKET }}/smrnaseq/results-test-${{ github.sha }}"
}
profiles: test
profiles: test,illumina

- uses: actions/upload-artifact@v4
with:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ jobs:
- "23.04.0"
- "latest-everything"
profile:
- "test"
- "test_no_genome"
- "test_umi"
- "test_index"
- "test,illumina"
- "test_no_genome,illumina"
- "test_umi,illumina"
- "test_index,illumina"
steps:
- name: Check out pipeline code
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/download_pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
env:
NXF_SINGULARITY_CACHEDIR: ./
NXF_SINGULARITY_HOME_MOUNT: true
run: nextflow run ./${{ env.REPOTITLE_LOWERCASE }}/$( sed 's/\W/_/g' <<< ${{ env.REPO_BRANCH }}) -stub -profile test,singularity --outdir ./results
run: nextflow run ./${{ env.REPOTITLE_LOWERCASE }}/$( sed 's/\W/_/g' <<< ${{ env.REPO_BRANCH }}) -stub -profile test,singularity,illumina --outdir ./results
- name: Run the downloaded pipeline (stub run not supported)
id: run_pipeline
if: ${{ job.steps.stub_run_pipeline.status == failure() }}
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## v2.3.2dev - 2024-XX-XX - X
## v2.4.0dev - 2024-XX-XX - X

- [[#332]](https://github.com/nf-core/smrnaseq/issues/332) by [[#361]](https://github.com/nf-core/smrnaseq/pull/361) - Fix documentation to use only single-end
- [[#349]](https://github.com/nf-core/smrnaseq/pull/349) - Fix [MIRTOP_QUANT conda issue](https://github.com/nf-core/smrnaseq/issues/347), change conda-base to conda-forge channel
- [[#350]](https://github.com/nf-core/smrnaseq/pull/350) - Fix [MIRTOP_QUANT conda issue](https://github.com/nf-core/smrnaseq/issues/347), set python version to 3.7 to fix pysam issue
- [[#351]](https://github.com/nf-core/smrnaseq/issues/351) - Fix [Protocol inheritance issue](https://github.com/nf-core/smrnaseq/pull/364) - fixing protocol inheritance from subworkflow with move to config profile(s) for different protocols

## v2.3.1 - 2024-04-18 - Gray Zinc Dalmation Patch

Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,10 @@ Now, you can run the pipeline using:

```bash
nextflow run nf-core/smrnaseq \
-profile <docker/singularity/.../institute> \
-profile <docker/singularity/.../institute>,illumina \
--input samplesheet.csv \
--genome 'GRCh37' \
--mirtrace_species 'hsa' \
--protocol 'illumina' \
--outdir <OUTDIR>
```

Expand Down
7 changes: 7 additions & 0 deletions conf/protocol_cats.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//This profile handles CATs miRNA defaults. Include it as an additional profile to set certain pipeline parameters appropriately.
params{
clip_r1 = 3
three_prime_clip_r1 = 0
three_prime_adapter = "AAAAAAAA"
protocol = 'cats'
}
7 changes: 7 additions & 0 deletions conf/protocol_illumina.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//This profile handles Illumina miRNA defaults. Include it as an additional profile to set certain pipeline parameters appropriately.
params{
clip_r1 = 0
three_prime_clip_r1 = 0
three_prime_adapter = "TGGAATTCTCGGGTGCCAAGG"
protocol = 'illumina'
}
7 changes: 7 additions & 0 deletions conf/protocol_nextflex.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//This profile handles Nextflex miRNA defaults. Include it as an additional profile to set certain pipeline parameters appropriately.
params{
clip_r1 = 4
three_prime_clip_r1 = 4
three_prime_adapter = "TGGAATTCTCGGGTGCCAAGG"
protocol = 'nextflex'
}
7 changes: 7 additions & 0 deletions conf/protocol_qiaseq.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//This profile handles QIASEQ miRNA defaults. Include it as an additional profile to set certain pipeline parameters appropriately.
params{
clip_r1 = 0
three_prime_clip_r1 = 0
three_prime_adapter = "AACTGTAGGCACCATCAAT"
protocol = 'qiaseq'
}
1 change: 0 additions & 1 deletion conf/test.config
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ params {
fasta = 'https://github.com/nf-core/test-datasets/raw/smrnaseq/reference/genome.fa'

mirtrace_species = 'hsa'
protocol = 'illumina'
skip_mirdeep = true
save_merged = false
save_aligned_mirna_quant = false
Expand Down
1 change: 0 additions & 1 deletion conf/test_full.config
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ params {
input = 'https://github.com/nf-core/test-datasets/raw/smrnaseq/samplesheet/v2.0/samplesheet-full.csv'
genome = 'GRCh37'
mirtrace_species = 'hsa'
protocol = 'illumina'
}


1 change: 0 additions & 1 deletion conf/test_index.config
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ params {
bowtie_index = 'https://github.com/nf-core/test-datasets/raw/smrnaseq/reference/bowtie_index.tar.gz'

mirtrace_species = 'hsa'
protocol = 'illumina'
skip_mirdeep = true
save_merged = false
save_aligned_mirna_quant = false
Expand Down
1 change: 0 additions & 1 deletion conf/test_no_genome.config
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,5 @@ params {
mirna_gtf = 'https://github.com/nf-core/test-datasets/raw/smrnaseq/reference/hsa.gff3'
mirtrace_species = 'hsa'
skip_mirdeep = true
protocol = 'illumina'

}
1 change: 0 additions & 1 deletion conf/test_umi.config
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ params {
fasta = 'https://github.com/nf-core/test-datasets/raw/smrnaseq/reference/genome.fa'

mirtrace_species = 'hsa'
protocol = 'illumina'
skip_mirdeep = true

//UMI Specific testcase
Expand Down
11 changes: 9 additions & 2 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,18 @@ This option indicates the experimental protocol used for the sample preparation.
- 'nextflex': adapter (`TGGAATTCTCGGGTGCCAAGG`), clip_r1 (`4`), three_prime_clip_r1 (`4`)
- 'qiaseq': adapter (`AACTGTAGGCACCATCAAT`)
- 'cats': adapter (`GATCGGAAGAGCACACGTCTG`), clip_r1(`3)
- 'custom' (where the user can indicate the `three_prime_adapter`, `clip_r1` and `three_prime_clip_r1` manually)

This option is not chosen as a parameter but as an additional profile that sets the corresponding `three_prime_adapter`, `clip_r1` and `three_prime_clip_r1` parameters accordingly. You can choose to either use any of the provided profiles by running the pipeline with e.g. `illumina` to set the defaults as described above in a more convenient way.

```bash
-profile your_other_profiles,illumina
```

In case you have a custom protocol, please supply the `three_prime_adapter`, `clip_r1` and `three_prime_clip_r1` manually.

The parameter `--three_prime_adapter` is set to the Illumina TruSeq single index adapter sequence `AGATCGGAAGAGCACACGTCTGAACTCCAGTCA`. This is also to ensure, that the auto-detect functionality of `FASTP` is disabled. Please make sure to adapt this adapter sequence accordingly for your run.

:warning: At least the `custom` protocol has to be specified, otherwise the pipeline won't run. In case you specify the `custom` protocol, ensure that the parameters above are set accordingly or the defaults will be applied. If you want to auto-detect the adapters using `fastp`, please set `--three_prime_adapter` to `auto-detect`.
:warning: If you do not choose a profile that sets the `three_prime_adapter`, `clip_r1` and `three_prime_clip_r1` options, the pipeline won't run. If you want to auto-detect the adapters using `fastp`, please set `--three_prime_adapter` to `auto-detect`.

### `mirtrace_species` or `mirgenedb_species`

Expand Down
10 changes: 8 additions & 2 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ params {

input = null

// Workflow flags
protocol = 'illumina'
// Protocol default (override via config profile - NOT directly via parameter!)
protocol = "Custom"

// References
genome = null
Expand Down Expand Up @@ -243,6 +243,12 @@ profiles {
test_no_genome { includeConfig 'conf/test_no_genome.config' }
test_full { includeConfig 'conf/test_full.config' }
test_index { includeConfig 'conf/test_index.config' }

//Protocol specific profiles
cats { includeConfig 'conf/protocol_cats.config' }
illumina { includeConfig 'conf/protocol_illumina.config' }
qiaseq { includeConfig 'conf/protocol_qiaseq.config' }
nextflex { includeConfig 'conf/protocol_nextflex.config' }
}

// Set default registry for Apptainer, Docker, Podman and Singularity independent of -profile
Expand Down
13 changes: 5 additions & 8 deletions nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,6 @@
"help_text": "You will need to create a design file with information about the samples in your experiment before running the pipeline. Use this parameter to specify its location. It has to be a comma-separated file with 3 columns, and a header row. See [usage docs](https://nf-co.re/smrnaseq/usage#samplesheet-input).",
"fa_icon": "fas fa-file-csv"
},
"protocol": {
"type": "string",
"default": "illumina",
"fa_icon": "fas fa-vial",
"description": "Protocol for constructing smRNA-seq libraries.",
"help_text": "Presets for trimming parameters and 3' adapter sequence with a specified protocol.\n\n| Protocol | Library Prep Kit | Trimming Parameter | 3' Adapter Sequence |\n| :------------ | :-------------------------------------- | :-------------------------------------- | :--------------------- |\n| illumina | Illumina TruSeq Small RNA | `clip_r1 = 0` `three_prime_clip_r1 = 0` | `TGGAATTCTCGGGTGCCAAGG` |\n| nextflex | BIOO SCIENTIFIC NEXTFLEX Small RNA-Seq | `clip_r1 = 4` `three_prime_clip_r1 = 4` | `TGGAATTCTCGGGTGCCAAGG` |\n| qiaseq | QIAGEN QIAseq miRNA | `clip_r1 = 0` `three_prime_clip_r1 = 0` | `AACTGTAGGCACCATCAAT` |\n| cats | Diagenode CATS Small RNA-seq | `clip_r1 = 3` `three_prime_clip_r1 = 0` | `AAAAAAAAAAA` + `GATCGGAAGAGCACACGTCTG` (only polyA is used for trimming) |\n| custom | user defined | user defined | user defined |\n\n> NB: When running `--protocol custom` the user ***must define the 3' Adapter Sequence***.\n> If trimming parameters aren't provided the pipeline will deafult to `clip_R1 = 0` and `three_prime_clip_R1 = 0` (i.e. no extra clipping).",
"enum": ["illumina", "nextflex", "qiaseq", "cats", "custom"]
},
"outdir": {
"type": "string",
"format": "directory-path",
Expand All @@ -48,6 +40,11 @@
"type": "string",
"description": "MultiQC report title. Printed as page header, used for filename if not otherwise specified.",
"fa_icon": "fas fa-file-signature"
},
"protocol": {
"type": "string",
"default": "Custom",
"fa_icon": "fas fa-atom"
}
}
},
Expand Down
45 changes: 1 addition & 44 deletions subworkflows/local/utils_nfcore_smrnaseq_pipeline/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ workflow PIPELINE_INITIALISATION {
outdir,
workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1
)
//Detect Protocol setting, set this early before help so help shows proper adapters etc pp
formatProtocol(params,log)

//
// Validate parameters and generate parameter summary to stdout
//
Expand Down Expand Up @@ -261,45 +260,3 @@ def methodsDescriptionText(mqc_methods_yaml) {

return description_html.toString()
}

/*
* Format the protocol
* Given the protocol parameter (params.protocol),
* this function formats the protocol such that it is fit for the respective
* subworkflow
*/
def formatProtocol(params,log) {

switch(params.protocol){
case 'illumina':
params.putIfAbsent("clip_r1", 0);
params.putIfAbsent("three_prime_clip_r1",0);
params.putIfAbsent("three_prime_adapter", "TGGAATTCTCGGGTGCCAAGG");
break
case 'nextflex':
params.putIfAbsent("clip_r1", 4);
params.putIfAbsent("three_prime_clip_r1", 4);
params.putIfAbsent("three_prime_adapter", "TGGAATTCTCGGGTGCCAAGG");
break
case 'qiaseq':
params.putIfAbsent("clip_r1",0);
params.putIfAbsent("three_prime_clip_r1",0);
params.putIfAbsent("three_prime_adapter","AACTGTAGGCACCATCAAT");
break
case 'cats':
params.putIfAbsent("clip_r1",3);
params.putIfAbsent("three_prime_clip_r1", 0);
params.putIfAbsent("three_prime_adapter", "AAAAAAAA");
break
case 'custom':
params.putIfAbsent("clip_r1", params.clip_r1)
params.putIfAbsent("three_prime_clip_r1", params.three_prime_clip_r1)
default:
log.warn "Please make sure to specify all required clipping and trimming parameters, otherwise only adapter detection will be performed."
}

log.warn "Running with Protocol ${params.protocol}"
log.warn "Therefore using Adapter: ${params.three_prime_adapter}"
log.warn "Clipping ${params.clip_r1} bases from R1"
log.warn "And clipping ${params.three_prime_clip_r1} bases from 3' end"
}

0 comments on commit 374ec02

Please sign in to comment.