Skip to content

Commit 8633750

Browse files
authored
Merge pull request #30 from CaroAMN/dev
Updating Container Images + Improved File staging + MultiQC
2 parents bbbd6a5 + dcc6f68 commit 8633750

22 files changed

Lines changed: 537 additions & 291 deletions

File tree

README.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,26 +35,33 @@
3535
2. Channel Alignment
3636
3. Iterative Stitching
3737

38-
**Analysis**
38+
**ARA Registration**
3939

4040
4. ARA Registration subworkflow (optional)
4141
5. Cell Nuclei Quantification
4242

43+
**Full**
44+
45+
1. Preprocessing
46+
2. Nuclei quantification
47+
4348
## Pipeline Summary
4449

45-
The pipeline consists of two major stages, the `preprocessing`stage and the `analysis`stage.
50+
The pipeline consists of two major workflows `preprocessing` and the `full` workflow. The `ara-regsitration` is an optional subworkflow that works only for whole mouse brain samples.
4651

4752
### Preprocessing
4853

4954
Preprocessing is performed on raw 2D single-channel 16-bit `.tif` images produced by a light sheet microscope. Three individual steps are perfomed :
5055

51-
- Measuring and adjustemnts for intensities
52-
- Image channel alignemnt for at least two different channels
53-
- Image tile stitching to recustruct the full image for each channel and z-slice
56+
- **Intensity adjustments** to correct for the Gaussian shape of the lightsheet and intensity differences between adjacent tiles
57+
- **Image channel alignment** using a 2D rigid approach or a nonlinear 3D approach using Elastix.
58+
- **Image tile stitching** via an iterative 2D stitching approach by calculating z displacements and xy translations using phase correlation and SIFT.
59+
60+
### Full
5461

55-
### Analysis
62+
Quantification of cell-nuclei is performed using a 3D-Unet. It is performed on the nuclear channel only, assuming that the corresponding image file names contain the pattern `C1`.
5663

57-
Analysis is performed using a 3D-Unet to qunatify the amount of cell-nuclei in the given sample. The quantification is performed on the nuclear channel only, assuming that the corresponding image file names contain the pattern `C1`.
64+
### ARA Registration
5865

5966
Optionally registration to the Allen Refernce Atlas (ARA) for functional brain region annotation can be perfomed before segmentation.
6067
This includes the following two steps:

conf/modules.config

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ process {
1818
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
1919
]
2020

21-
withName: FASTQC {
22-
ext.args = '--quiet'
23-
}
24-
2521
withName: 'MULTIQC' {
2622
ext.args = { params.multiqc_title ? "--title \"$params.multiqc_title\"" : '' }
2723
publishDir = [
@@ -30,14 +26,12 @@ process {
3026
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
3127
]
3228
}
33-
/*
34-
withName: 'MAT2JSON' {
29+
30+
withName: 'STAGEFILES' {
3531
publishDir = [
36-
path: { "${params.outdir}/${meta.id}/mat2json" },
37-
mode: params.publish_dir_mode
32+
enabled: false
3833
]
3934
}
40-
*/
4135

4236
withName: 'NUMORPHINTENSITY' {
4337
publishDir = [

docs/output.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ The pipeline is built using [Nextflow](https://www.nextflow.io/) and processes d
1919
- [NumorphRegister](#numorphregister) - Performs registartion to the Allen Reference Atlas (ARA)
2020
- [Numorph3DUnet](#numorph3dunet) - Perfomrs cell-nuclei segmentation and quantification
2121
- [Mat2JSON] (#mat3json) - Converts `.mat`files to JSON
22+
- [MultiQC](#MultiQC) Aggregate report describing workflow run and tools used from the whole pipeline.
2223
- [Pipeline information](#pipeline-information) - Report metrics generated during the workflow execution
2324

2425
### NumorphIntensity
@@ -129,6 +130,19 @@ The pipeline is built using [Nextflow](https://www.nextflow.io/) and processes d
129130

130131
**Mat2JSON** converts a given `.mat`file into a `CSV` if the data is stored as a table datastructure or a `JSON` for other nested datastructures.
131132

133+
### MultiQC
134+
135+
<details markdown="1">
136+
<summary>Output files</summary>
137+
138+
- `multiqc/`
139+
- `multiqc_report.html`: a standalone HTML file that can be viewed in your web browser.
140+
- `multiqc_data/`: directory containing parsed statistics from the different tools used in the pipeline.
141+
142+
</details>
143+
144+
**MultiQC** collate pipeline QC from supported tools e.g. FastQC. The pipeline has special steps which also allow the software versions to be reported in the MultiQC output for future traceability. For more information about how to use MultiQC reports, see <http://multiqc.info>.
145+
132146
### Pipeline information
133147

134148
<details markdown="1">

docs/usage.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,11 @@ The individual parameters are explained [here](###Analysisspecificparameters)
5151

5252
### Analysis specific parameters
5353

54-
This section descripbes every parameter that can be set in the `parameter.csv`. In order that the pipeline runs correctly all named parameters need to be present in the parameter file and its recommended to use the provided parameter file (link). Every parameter has a default value that will be set if not otherwise defined in the `parameter.csv`.
54+
This section descripbes every parameter that can be set in the `parameter.csv`. In order for the pipeline to run correctly all named parameters need to be present in the parameter file and its recommended to use the provided parameter file (link). Every parameter has a default value that will be set if not otherwise defined in the `parameter.csv`.
5555

5656
| Parameter | Description |
5757
| --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
5858
| `darkfield_intensity` | 1xn_channels; Constant darkfield intensity value (i.e. average intensity of image with nothing present). **Default: 101** |
59-
| `img_directory` | |
6059
| `single_sheet` | true, false; Whether a single sheet was used for acquisition |
6160
| `ls_width` | 1xn_channels interger. Light sheet width setting for UltraMicroscope II as percentage. **Default: 50** |
6261
| `laser_y_displacement` | [-0.5,0.5]; Displacement of light-sheet along y axis. Value of 0.5 means light-sheet center is positioned at the top of the image. **Default: 0** |
@@ -164,7 +163,7 @@ This section descripbes every parameter that can be set in the `parameter.csv`.
164163
The typical command for running the pipeline is as follows:
165164

166165
```bash
167-
nextflow run nf-core/lsmquant --input ./samplesheet.csv --outdir ./results -profile docker
166+
nextflow run nf-core/lsmquant --input ./samplesheet.csv --outdir ./results -profile docker -work-dir ./work
168167
```
169168

170169
This will launch the pipeline with the `docker` configuration profile. See below for more information about profiles.
@@ -178,6 +177,8 @@ work # Directory containing the nextflow working files
178177
# Other nextflow hidden files, eg. history of pipeline runs and old logs.
179178
```
180179

180+
For this pipeline it is recommended to specify the location of the work directory as well with `-work-dir`. The directory will contain any nextflow working files which includes all in- and output files. The work directory will be larger than the input sample size. If you don't specify a location, the work directory will be created in the location from where the pipeline got started.
181+
181182
If you wish to repeatedly use the same parameters for multiple runs, rather than specifying each flag in the command, you can specify these in a params file.
182183

183184
Pipeline settings can be provided in a `yaml` or `json` file via `-params-file <file>`.

main.nf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ workflow NFCORE_LSMQUANT {
3535

3636
LSMQUANT(samplesheet)
3737

38+
emit:
39+
multiqc_report = LSMQUANT.out.multiqc_report
40+
3841
}
3942
/*
4043
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -73,6 +76,7 @@ workflow {
7376
params.outdir,
7477
params.monochrome_logs,
7578
params.hook_url,
79+
NFCORE_LSMQUANT.out.multiqc_report,
7680
)
7781
}
7882

modules/local/mat2json/main.nf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ process MAT2JSON {
33
tag "$meta.id - $matfile.baseName"
44
label 'process_single'
55

6-
container 'carolinschwitalla/mat2json:latest'
6+
container 'nf-core/mat2json:1.0.0'
77

88
input:
99
tuple val(meta), path(matfile)

modules/local/numorph3dunet/main.nf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ process NUMORPH3DUNET {
33
label 'process_gpu'
44

55

6-
container "carolinschwitalla/numorph-3dunet:latest"
6+
container "nf-core/numorph-3dunet:1.0.0"
77

88

99
input:
@@ -35,7 +35,7 @@ process NUMORPH3DUNET {
3535
mkdir -p ./images
3636
3737
# move images to images directory
38-
mv ${img_directory} ./images/
38+
ln -sr ${img_directory} ./images/
3939
4040
numorph_3dunet.predict \\
4141
-i images/ \\

modules/local/numorphalign/main.nf

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ process NUMORPHALIGN {
33
label 'process_high_long'
44

55

6-
container "carolinschwitalla/numorph_preprocessing:0.9.0"
6+
container "nf-core/numorph_preprocessing:1.0.0"
77

88
input:
99
tuple val(meta), path(img_directory), path(parameter_file)
@@ -32,18 +32,20 @@ process NUMORPHALIGN {
3232
"""
3333
mkdir -p results/samples/
3434
mkdir -p results/variables/
35+
mkdir -p ./images
3536
36-
mv ${adj_params_mat} results/variables
37-
mv ${path_table_mat} results/variables
38-
mv ${thresholds_mat} results/variables
37+
ln -sr ${img_directory} ./images
38+
ln -sr ${adj_params_mat} results/variables
39+
ln -sr ${path_table_mat} results/variables
40+
ln -sr ${thresholds_mat} results/variables
3941
4042
# resolve symlinks and paths
41-
img_directory=\$(readlink -f ${img_directory})
43+
img_dir=\$(readlink -f ./images)
4244
parameter_file=\$(readlink -f ${parameter_file})
4345
results_dir=\$(readlink -f ./results)
4446
NM_variables=\$(readlink -f ${NM_variables})
4547
46-
numorph_preprocessing 'input_dir' \$img_directory 'output_dir' \$results_dir 'parameter_file' \$parameter_file 'sample_name' ${meta.id} 'stage' 'align' 'NM_variables' \$NM_variables
48+
numorph_preprocessing 'input_dir' \$img_dir 'output_dir' \$results_dir 'parameter_file' \$parameter_file 'sample_name' ${meta.id} 'stage' 'align' 'NM_variables' \$NM_variables
4749
4850
cat <<-END_VERSIONS > versions.yml
4951
"${task.process}":

modules/local/numorphintensity/main.nf

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ process NUMORPHINTENSITY {
33
label 'process_high_long'
44

55

6-
container "carolinschwitalla/numorph_preprocessing:0.9.0"
6+
container "nf-core/numorph_preprocessing:1.0.0"
77

88

99
input:
@@ -26,14 +26,17 @@ process NUMORPHINTENSITY {
2626

2727
"""
2828
mkdir -p ./results
29+
mkdir -p ./images
30+
31+
ln -sr ${img_directory} ./images
2932
3033
# resolve symlinks and paths
31-
img_directory=\$(readlink -f ${img_directory})
34+
img_dir=\$(readlink -f ./images)
3235
parameter_file=\$(readlink -f ${parameter_file})
3336
results_dir=\$(readlink -f ./results)
3437
3538
36-
numorph_preprocessing 'input_dir' \$img_directory 'output_dir' \$results_dir 'parameter_file' \$parameter_file 'sample_name' ${meta.id} 'stage' 'intensity'
39+
numorph_preprocessing 'input_dir' \$img_dir 'output_dir' \$results_dir 'parameter_file' \$parameter_file 'sample_name' ${meta.id} 'stage' 'intensity'
3740
3841
cat <<-END_VERSIONS > versions.yml
3942
"${task.process}":

modules/local/numorphregister/main.nf

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,15 @@ process NUMORPHREGISTER {
22
tag "$meta.id"
33
label 'process_high_long'
44

5-
container "carolinschwitalla/numorph_analyze:latest"
5+
container "nf-core/numorph_analyze:1.0.1"
66

77
input:
88
tuple val(meta), path(resampled_directory), path(parameter_file)
9-
path NM_variables
10-
119

1210
output:
13-
path "results/variables/reg_params.mat" , emit: reg_params_mat
14-
path "results/variables/*_mask.mat" , emit: reg_mask
15-
path "results/NM_variables.mat" , emit: NM_variables
11+
path "results/*results.mat" , emit: res_mat
12+
path "results/variables/*" , emit: variables
13+
path "results/NM_variables.mat" , emit: NM_variables
1614
path "results/registered/*" , emit: registered
1715
path "versions.yml" , emit: versions
1816

@@ -23,22 +21,21 @@ process NUMORPHREGISTER {
2321
script:
2422
def args = task.ext.args ?: ''
2523
def prefix = task.ext.prefix ?: "${meta.id}"
26-
def nm_variables = NM_variables ? "${NM_variables}" : ""
2724

2825
"""
29-
mkdir -p \$PWD/results/variables/
30-
mkdir -p \$PWD/results/resampled/
31-
mkdir -p \$PWD/results/registered/
26+
mkdir -p results/variables/
27+
mkdir -p results/resampled/
28+
mkdir -p results/registered/
29+
3230
33-
mv $resampled_directory \$PWD/results/resampled
31+
ln -sr ${resampled_directory} results/resampled
3432
3533
#resolve symlinks and paths
3634
resampled_directory=\$(readlink -f ./results/resampled/)
3735
parameter_file=\$(readlink -f ${parameter_file})
38-
NM_variables=\$(readlink -f ${NM_variables})
3936
results_dir=\$(readlink -f ./results)
4037
41-
numorph_analyze 'input_dir' \$resampled_directory 'output_dir' \$results_dir 'parameter_file' \$parameter_file 'sample_name' ${meta.id} 'stage' 'register' 'NM_variables' \$NM_variables 'use_processed_images' 'resampled'
38+
numorph_analyze 'input_dir' \$resampled_directory 'output_dir' \$results_dir 'parameter_file' \$parameter_file 'sample_name' ${prefix} 'stage' 'register' 'NM_variables' '' 'use_processed_images' 'resampled'
4239
4340
4441
cat <<-END_VERSIONS > versions.yml
@@ -56,9 +53,10 @@ process NUMORPHREGISTER {
5653
mkdir -p results/variables
5754
5855
touch results/variables/reg_params.mat
59-
touch results/variables/${meta.id}_mask.mat
56+
touch results/variables/${prefix}_mask.mat
6057
touch results/NM_variables.mat
61-
touch results/registered/${meta.id}_registered.tif
58+
touch results/${prefix}_results.mat
59+
touch results/registered/${prefix}_registered.tif
6260
6361
cat <<-END_VERSIONS > versions.yml
6462
"${task.process}":

0 commit comments

Comments
 (0)