Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overhaul strandedness detection / comparison #1306

Merged
merged 43 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
0cfb662
Check RSeQC strandedness without reference to undetermined
pinin4fjords May 29, 2024
5ce89ae
Update subworkflows/local/utils_nfcore_rnaseq_pipeline/main.nf
pinin4fjords May 29, 2024
26a329b
fix strand message
pinin4fjords Jun 12, 2024
7a20206
Merge branch 'dev' into improve_rseqc_strandedness
pinin4fjords Jun 13, 2024
4c4afd0
Update Salmon
pinin4fjords Jun 14, 2024
2a5414c
Add strandedness detection threshold parameter
pinin4fjords Jun 14, 2024
8ccffc9
Add a consistent library type check between Salmon and RSeQC. Make th…
pinin4fjords Jun 14, 2024
c6b91a9
Amend for undetermined
pinin4fjords Jun 14, 2024
ab0c62b
Constraint strand detection threshold
pinin4fjords Jun 14, 2024
38bdb9e
Consistent defaults
pinin4fjords Jun 14, 2024
cb54dc2
Merge branch 'dev' into improve_rseqc_strandedness
pinin4fjords Jun 17, 2024
9aadd4a
Fix up after merge
pinin4fjords Jun 17, 2024
82724b8
Fix for linting
pinin4fjords Jun 17, 2024
c4d3535
update CHANGELOG
pinin4fjords Jun 17, 2024
9dd6d6d
Fix the fix
pinin4fjords Jun 17, 2024
451cb64
fix typos
pinin4fjords Jun 17, 2024
3df6ec8
[automated] Fix linting with Prettier
nf-core-bot Jun 17, 2024
007bde2
Fix module lint error
pinin4fjords Jun 17, 2024
002ebbd
revert config changed in error
pinin4fjords Jun 17, 2024
465be1f
Merge branch 'improve_rseqc_strandedness' of github.com:nf-core/rnase…
pinin4fjords Jun 17, 2024
1977f6d
Fix conditionality
pinin4fjords Jun 17, 2024
bc6189f
Clarify stranded/ unstraded at library level, include other library t…
pinin4fjords Jun 18, 2024
62ed423
Allow for missing keys in salmon library counts for testing
pinin4fjords Jun 18, 2024
b4760ce
Fix function tests
pinin4fjords Jun 18, 2024
2ded8c0
Auto updating snapshot broke things for unaffected tests. So manually…
pinin4fjords Jun 18, 2024
3733031
Merge branch 'dev' into improve_rseqc_strandedness
pinin4fjords Jun 18, 2024
231fba6
Merge branch 'dev' into improve_rseqc_strandedness
pinin4fjords Jun 18, 2024
29265f0
Merge branch 'dev' into improve_rseqc_strandedness
pinin4fjords Jun 18, 2024
ac9abda
Return percentages for strandedness
pinin4fjords Jun 18, 2024
3ad69a7
Explicitly publish lib_format_counts
pinin4fjords Jun 18, 2024
4ce478d
update docs
pinin4fjords Jun 18, 2024
3583d2c
Fix typo
pinin4fjords Jun 18, 2024
eef388e
Prettier
pinin4fjords Jun 18, 2024
c95c489
Fix typo
pinin4fjords Jun 18, 2024
035e85f
Set maximum on bars per column
pinin4fjords Jun 19, 2024
cdbc971
Pass/fail in separate mqc column
pinin4fjords Jun 19, 2024
0b16071
Merge branch 'dev' into improve_rseqc_strandedness
pinin4fjords Jun 19, 2024
6eb5b06
Merge branch 'improve_rseqc_strandedness' of github.com:nf-core/rnase…
pinin4fjords Jun 19, 2024
dc22231
Fix multiqc config for cell colors to highlight strandedness
pinin4fjords Jun 19, 2024
bd48aa7
Fix strand status conditional
pinin4fjords Jun 19, 2024
36c6658
update strand check image
pinin4fjords Jun 19, 2024
e45e521
Fix multiqc yaml
pinin4fjords Jun 19, 2024
4dd03ca
fix up params + usage
pinin4fjords Jun 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified docs/images/mqc_strand_check.png
100755 → 100644
pinin4fjords marked this conversation as resolved.
Show resolved Hide resolved
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/output.md
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ The majority of RSeQC scripts generate output files which can be plotted and sum

</details>

This script predicts the "strandedness" of the protocol (i.e. unstranded, sense or antisense) that was used to prepare the sample for sequencing by assessing the orientation in which aligned reads overlay gene features in the reference genome. The strandedness of each sample has to be provided to the pipeline in the input samplesheet (see [usage docs](https://nf-co.re/rnaseq/usage#samplesheet-input)). However, this information is not always available, especially for public datasets. As a result, additional features have been incorporated into this pipeline to auto-detect whether you have provided the correct information in the samplesheet, and if this is not the case then a warning table will be placed at the top of the MultiQC report highlighting the offending samples (see image below). If required, this will allow you to correct the input samplesheet and rerun the pipeline with the accurate strand information. Note, it is important to get this information right because it can affect the final results.
This script predicts the "strandedness" of the protocol (i.e. unstranded, sense or antisense) that was used to prepare the sample for sequencing by assessing the orientation in which aligned reads overlay gene features in the reference genome. The strandedness of each sample has to be provided to the pipeline in the input samplesheet (see [usage docs](https://nf-co.re/rnaseq/usage#samplesheet-input)). However, this information is not always available, especially for public datasets. As a result, additional features have been incorporated into this pipeline to auto-detect whether you have provided the correct information in the samplesheet, and if this is not the case then the affected libraries will be flagged in the tale under 'Strandedness Checks' elsewhere in the report. If required, this will allow you to correct the input samplesheet and rerun the pipeline with the accurate strand information. Note, it is important to get this information right because it can affect the final results.
pinin4fjords marked this conversation as resolved.
Show resolved Hide resolved

RSeQC documentation: [infer_experiment.py](http://rseqc.sourceforge.net/#infer-experiment-py)

Expand Down
6 changes: 5 additions & 1 deletion docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ You will need to create a samplesheet with information about the samples you wou

### Multiple runs of the same sample

The `sample` identifiers have to be the same when you have re-sequenced the same sample more than once e.g. to increase sequencing depth. The pipeline will concatenate the raw reads before performing any downstream analysis. Below is an example for the same sample sequenced across 3 lanes. If you set the strandedness value to `auto` the pipeline will sub-sample the input FastQ files to 1 million reads, use Salmon Quant to infer the strandedness automatically and then propagate this information to the remainder of the pipeline. If the strandedness has been inferred or provided incorrectly a warning will be present at the top of the MultiQC report so please be sure to check when looking at the QC for your samples.
The `sample` identifiers have to be the same when you have re-sequenced the same sample more than once e.g. to increase sequencing depth. The pipeline will concatenate the raw reads before performing any downstream analysis. Below is an example for the same sample sequenced across 3 lanes.

```csv title="samplesheet.csv"
sample,fastq_1,fastq_2,strandedness
Expand All @@ -27,6 +27,10 @@ CONTROL_REP1,AEG588A1_S1_L003_R1_001.fastq.gz,AEG588A1_S1_L003_R2_001.fastq.gz,a
CONTROL_REP1,AEG588A1_S1_L004_R1_001.fastq.gz,AEG588A1_S1_L004_R2_001.fastq.gz,auto
```

### Strandedness prediction

If you set the strandedness value to `auto` the pipeline will sub-sample the input FastQ files to 1 million reads, use Salmon Quant to infer the strandedness automatically and then propagate this information to the remainder of the pipeline. If the strandedness has been inferred or provided incorrectly the sample will be flagged in the 'Strandedness Checks' section of the MultiQC report, so please be sure to check when looking at the QC for your samples.

### Full samplesheet

The pipeline will auto-detect whether a sample is single- or paired-end using the information provided in the samplesheet. The samplesheet can have as many columns as you desire, however, there is a strict requirement for the first 4 columns to match those defined in the table below.
Expand Down
6 changes: 3 additions & 3 deletions subworkflows/local/utils_nfcore_rnaseq_pipeline/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -574,9 +574,9 @@ def calculateStrandedness(forwardFragments, reverseFragments, unstrandedFragment

return [
inferred_strandedness: strandedness,
forwardFragments: forwardFragments / (totalFragments as double),
reverseFragments: reverseFragments / (totalFragments as double),
unstrandedFragments: unstrandedFragments / (totalFragments as double)
forwardFragments: (forwardFragments / (totalFragments as double)) * 100,
reverseFragments: (reverseFragments / (totalFragments as double)) * 100,
unstrandedFragments: (unstrandedFragments / (totalFragments as double)) * 100
]
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
"content": [
{
"inferred_strandedness": "unstranded",
"forwardFragments": 0.5,
"reverseFragments": 0.5,
"forwardFragments": 50.0,
"reverseFragments": 50.0,
"unstrandedFragments": 0.0
}
],
Expand All @@ -65,7 +65,7 @@
{
"inferred_strandedness": "reverse",
"forwardFragments": 0.0,
"reverseFragments": 1.0,
"reverseFragments": 100.0,
"unstrandedFragments": 0.0
}
],
Expand Down Expand Up @@ -219,7 +219,7 @@
"content": [
{
"inferred_strandedness": "forward",
"forwardFragments": 1.0,
"forwardFragments": 100.0,
"reverseFragments": 0.0,
"unstrandedFragments": 0.0
}
Expand All @@ -242,9 +242,9 @@
"content": [
{
"inferred_strandedness": "reverse",
"forwardFragments": 0.0074992500657742505,
"reverseFragments": 0.8360163982823675,
"unstrandedFragments": 0.1564843516518582
"forwardFragments": 0.749925006577425,
"reverseFragments": 83.60163982823676,
"unstrandedFragments": 15.64843516518582
}
],
"meta": {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion workflows/rnaseq/nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if (!params.skip_alignment && params.aligner == 'star_salmon') {
publishDir = [
path: { "${params.outdir}/${params.aligner}" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') || filename.endsWith('_meta_info.json') ? null : filename }
saveAs: { filename -> filename.equals('versions.yml') || filename.endsWith('_meta_info.json') || filename.endsWith('_format_counts.json') ? null : filename }
]
}

Expand Down
Loading