Skip to content

Commit

Permalink
Add validation step
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisLeNezet committed Mar 26, 2024
1 parent cb62a8e commit f58f958
Show file tree
Hide file tree
Showing 37 changed files with 1,112 additions and 2,972 deletions.
6 changes: 3 additions & 3 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,10 @@ process {
withName: GLIMPSE_LIGATE {
ext.prefix = { "${meta.id}_D${meta.depth}_P${meta.panel}" }
}
withName: GLIMPSE_CONCORDANCE {
ext.prefix = { "${meta.id}_D${meta.depth}_P${meta.panel}_R${meta.region}" }
withName: GLIMPSE2_CONCORDANCE {
ext.prefix = { "${meta.id}_D${meta.depth}_P${meta.panel}_R${meta.region.replace(':','_')}" }
}
withName: ADD_COLUMNS {
ext.prefix = { "${meta.id}_D${meta.depth}_P${meta.panel}_R${meta.region}_SNP" }
ext.prefix = { "${meta.id}_D${meta.depth}_P${meta.panel}_R${meta.region.replace(':','_')}_SNP" }
}
}
10 changes: 7 additions & 3 deletions conf/test_sim.config
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/

params {
config_profile_name = 'Test simulation mode'
config_profile_name = 'Test simulation / imputation / validation mode'
config_profile_description = 'Minimal test dataset to check pipeline function'

// Limit resources so that this can run on GitHub Actions
Expand All @@ -24,8 +24,12 @@ params {
input_region = "${projectDir}/tests/csv/region.csv"
depth = 1

// Genome references
fasta = "https://raw.githubusercontent.com/nf-core/test-datasets/phaseimpute/data/reference_genome/21_22/hs38DH.chr21_22.fa"
panel = "${projectDir}/tests/csv/panel.csv"
phased = true
map = "${projectDir}/tests/csv/map.csv"
fasta = "https://raw.githubusercontent.com/nf-core/test-datasets/phaseimpute/data/reference_genome/21_22/hs38DH.chr21_22.fa"

step = "simulate"
step = "all"
tools = "glimpse1"
}
34 changes: 34 additions & 0 deletions conf/test_validate.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Nextflow config file for running minimal tests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Defines input files and everything required to run a fast and simple pipeline test.
Use as follows:
nextflow run nf-core/phaseimpute -profile test_validate,<docker/singularity> --outdir <OUTDIR>
----------------------------------------------------------------------------------------
*/

params {
config_profile_name = 'Test validation mode'
config_profile_description = 'Minimal test dataset to check pipeline function'

// Limit resources so that this can run on GitHub Actions
max_cpus = 2
max_memory = '6.GB'
max_time = '6.h'

// Input data
input = "${projectDir}/tests/csv/sample_sim.csv"
input_region = "${projectDir}/tests/csv/region.csv"
depth = 1

// Genome references
fasta = "https://raw.githubusercontent.com/nf-core/test-datasets/phaseimpute/data/reference_genome/21_22/hs38DH.chr21_22.fa"
panel = "${projectDir}/tests/csv/panel.csv"
phased = true
map = "${projectDir}/tests/csv/map.csv"

step = "validate"
}
4 changes: 2 additions & 2 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

```bash
nextflow run main.nf -profile singularity,test --outdir results -resume
nextflow run main.nf -profile singularity,test_sim --outdir results -resume
```

## Problematic
Expand All @@ -39,8 +40,7 @@ All channel need to be identified by a meta map as follow:
- M : map used
- T : tool used
- G : reference genome used (is it needed ?)
- D : depth

- S : simulation (depth or genotype array)
## Open questions

How to use different schema ?
Expand Down
Binary file modified docs/images/metro/Concordance.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2,921 changes: 1 addition & 2,920 deletions docs/images/metro/MetroMap.xml

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion docs/images/metro/txt2image.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ To use drawio
drawio --version
drawio docs/images/metro/MetroMap.xml --export --format png --page-index 0 --output docs/images/metro/MetroMap.png --scale 3
drawio docs/images/metro/MetroMap.xml --export --format png --layers 0 --page-index 1 --output docs/images/metro/PostProcessing.png --scale 3
drawio docs/images/metro/MetroMap.xml --export --format png --layers 1 --page-index 1 --output docs/images/metro/Concordance.png --scale 3
drawio docs/images/metro/MetroMap.xml --export --format png --layers 1 --page-index 1 --output docs/images/metro/Concordance2.png --scale 3
drawio docs/images/metro/MetroMap.xml --export --format png --layers 2 --page-index 1 --output docs/images/metro/Simulate.png --scale 3
drawio docs/images/metro/MetroMap.xml --export --format png --layers 3 --page-index 1 --output docs/images/metro/Phase.png --scale 3
drawio docs/images/metro/MetroMap.xml --export --format png --layers 4 --page-index 1 --output docs/images/metro/PreProcessing.png --scale 3
drawio docs/images/metro/MetroMap.xml --export --format png --layers 5 --page-index 1 --output docs/images/metro/Concordance.png --scale 3
```
22 changes: 21 additions & 1 deletion main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,31 @@ workflow NFCORE_PHASEIMPUTE {
ch_versions // channel: versions of software used

main:

//
// Initialise input channels
//

input_impute = Channel.empty()
input_simulate = Channel.empty()
input_validate = Channel.empty()

if (params.step == "impute") {
input_impute = ch_input
} else if (params.step == "simulate" || params.step == "all") {
input_simulate = ch_input
} else if (params.step == "validate") {
input_validate = ch_input
}


//
// WORKFLOW: Run pipeline
//
PHASEIMPUTE (
ch_input,
input_impute,
input_simulate,
input_validate,
ch_fasta,
ch_panel,
ch_regions,
Expand Down
15 changes: 15 additions & 0 deletions modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@
"git_sha": "7e56daae390ff896b292ddc70823447683a79936",
"installed_by": ["vcf_impute_glimpse"]
},
"glimpse/concordance": {
"branch": "master",
"git_sha": "7e56daae390ff896b292ddc70823447683a79936",
"installed_by": ["modules"]
},
"glimpse/ligate": {
"branch": "master",
"git_sha": "7e56daae390ff896b292ddc70823447683a79936",
Expand All @@ -68,6 +73,11 @@
"git_sha": "14ba46490cae3c78ed8e8f48d2c0f8f3be1e7c03",
"installed_by": ["multiple_impute_glimpse2"]
},
"glimpse2/concordance": {
"branch": "master",
"git_sha": "3f5420aa22e00bd030a2556dfdffc9e164ec0ec5",
"installed_by": ["modules"]
},
"glimpse2/ligate": {
"branch": "master",
"git_sha": "ee7fee68281944b002bd27a8ff3f19200b4d3fad",
Expand All @@ -83,6 +93,11 @@
"git_sha": "fa12139827a18b324bd63fce654818586a8e9cc7",
"installed_by": ["multiple_impute_glimpse2"]
},
"gunzip": {
"branch": "master",
"git_sha": "3a5fef109d113b4997c9822198664ca5f2716208",
"installed_by": ["modules"]
},
"multiqc": {
"branch": "master",
"git_sha": "b7ebe95761cd389603f9cc0e0dc384c0f663815a",
Expand Down
32 changes: 32 additions & 0 deletions modules/local/addcolumns/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
process ADD_COLUMNS {
label 'process_single'

input:
tuple val(meta), path(input)

output:
tuple val(meta), path('*.txt'), emit: txt
path "versions.yml", emit: versions

when:
task.ext.when == null || task.ext.when

script:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
awk '(NR>=2) && (NR<=10)' $input | \\
awk 'NR==1{\$(NF+1)="ID"} NR>1{\$(NF+1)="${meta.id}"}1' | \\
awk 'NR==1{\$(NF+1)="Region"} NR>1{\$(NF+1)="${meta.region}"}1' | \\
awk 'NR==1{\$(NF+1)="Depth"} NR>1{\$(NF+1)="${meta.depth}"}1' | \\
awk 'NR==1{\$(NF+1)="GPArray"} NR>1{\$(NF+1)="${meta.gparray}"}1' | \\
awk 'NR==1{\$(NF+1)="Tools"} NR>1{\$(NF+1)="${meta.tools}"}1' | \\
awk 'NR==1{\$(NF+1)="Panel"} NR>1{\$(NF+1)="${meta.panel}"}1' > \\
${prefix}.txt
cat <<-END_VERSIONS > versions.yml
"${task.process}":
awk: \$(awk --version | head -1 | grep -o -E '([0-9]+.){1,2}[0-9]')
END_VERSIONS
"""
}
25 changes: 25 additions & 0 deletions modules/local/concatenate/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
process CONCATENATE {
label 'process_single'

input:
tuple val(meta), path(input)

output:
tuple val(meta), path('*.txt'), emit: txt
path "versions.yml", emit: versions

when:
task.ext.when == null || task.ext.when

script:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
awk '(NR == 1) || (FNR > 1)' $input > ${prefix}.txt
cat <<-END_VERSIONS > versions.yml
"${task.process}":
awk: \$(awk --version | head -1 | grep -o -E '([0-9]+.){1,2}[0-9]')
END_VERSIONS
"""
}
7 changes: 7 additions & 0 deletions modules/nf-core/glimpse/concordance/environment.yml

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

65 changes: 65 additions & 0 deletions modules/nf-core/glimpse/concordance/main.nf

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

85 changes: 85 additions & 0 deletions modules/nf-core/glimpse/concordance/meta.yml

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

Loading

0 comments on commit f58f958

Please sign in to comment.