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

Remove freyja boot #250

Merged
merged 7 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/test_profile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

- name: Run Cecret
run: |
nextflow run . -profile docker,test -c .github/workflows/github_actions.config --maxcpus 2 --medcpus 2 --cleaner 'fastp' --aligner 'minimap2' --mpileup_depth 200 --vadr false --aci false --freyja false
nextflow run . -profile docker,test -c .github/workflows/github_actions.config --maxcpus 2 --medcpus 2 --cleaner 'fastp' --aligner 'minimap2' --mpileup_depth 200 --vadr false

ls cecret*

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_profile1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

- name: Run Cecret
run: |
nextflow run . -profile docker,test1 -c .github/workflows/github_actions.config --maxcpus 2 --medcpus 2 --cleaner 'fastp' --aligner 'minimap2' --mpileup_depth 200 --vadr false --aci false --freyja false
nextflow run . -profile docker,test1 -c .github/workflows/github_actions.config --maxcpus 2 --medcpus 2 --cleaner 'fastp' --aligner 'minimap2' --mpileup_depth 200 --vadr false

ls cecret*

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_profile2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

- name: Run Cecret
run: |
nextflow run . -profile docker,test2 -c .github/workflows/github_actions.config --maxcpus 2 --medcpus 2 --cleaner 'fastp' --aligner 'minimap2' --mpileup_depth 200 --vadr false --aci false --freyja false
nextflow run . -profile docker,test2 -c .github/workflows/github_actions.config --maxcpus 2 --medcpus 2 --cleaner 'fastp' --aligner 'minimap2' --mpileup_depth 200 --vadr false

ls cecret*

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test_wastewater.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,7 @@ jobs:

cat cecret*/cecret_results.txt

head cecret/freyja/aggregated-freyja.tsv

- name: Clean
run: rm -rf work .nextflow*
5 changes: 2 additions & 3 deletions configs/cecret_config_template.config
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@
//params.kraken2_db = false

//# For process samtools_ampliconstats and samtools_plot_ampliconstats
//params.samtools_ampliconstats_options = ''
//params.samtools_ampliconstats_options = '--max-amplicon-length 3000 --max-amplicons 3000'
//params.samtools_ampliconstats = true
//params.samtools_plot_ampliconstats_options = '-size 1200,900 -size2 1200,900 -size3 1200,900'
//params.samtools_plot_ampliconstats = true
Expand All @@ -210,9 +210,8 @@
//params.freyja_aggregate = true
//params.freyja_variants_options = ''
//params.freyja_demix_options = '--depthcutoff 100'
//params.freyja_boot_options = '--nb 1000 --depthcutoff 100'
//params.freyja_aggregate_options = ''
//params.freyja_plot_options = '--mincov 100'
//params.freyja_plot_options = ''
//params.freyja_plot_filetype = 'png'

//# For process nextclade
Expand Down
8 changes: 6 additions & 2 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ params.bedtools_multicov_options = false
if (params.bedtools_multicov_options ) {
println('WARNING : params.bedtools_multicov_options no longer does anything!')
}
params.freyja_boot_options = false
if (params.freyja_boot_options ) {
println('WARNING : params.freyja_boot_options no longer does anything!')
}

//# Starting the workflow --------------------------------------------------------------

Expand Down Expand Up @@ -179,9 +183,9 @@ params.nextclade_options = ''
params.nextalign_options = '--include-reference'
params.freyja_variants_options = ''
params.freyja_demix_options = "--depthcutoff ${params.minimum_depth}"
params.freyja_boot_options = "--nb 1000 --depthcutoff ${params.minimum_depth}"

params.freyja_aggregate_options = ''
params.freyja_plot_options = "--mincov ${params.minimum_depth}"
params.freyja_plot_options = ""
params.freyja_plot_filetype = 'png'

//# Specifying some species-specific params
Expand Down
85 changes: 76 additions & 9 deletions modules/freyja.nf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
process freyja {
process freyja_variants {
tag "${sample}"
label "process_medium"
errorStrategy { task.attempt < 2 ? 'retry' : 'ignore'}
//errorStrategy { task.attempt < 2 ? 'retry' : 'ignore'}
publishDir "${params.outdir}", mode: 'copy'
container 'quay.io/uphl/freyja:1.4.7-2023-10-31'

Expand All @@ -18,8 +18,8 @@ process freyja {
tuple val(sample), file(bam), file(reference_genome)

output:
path "freyja/${sample}_demix.tsv", optional: true, emit: freyja_demix
path "freyja/${sample}*", emit: files
tuple val(sample), file("freyja/${sample}_{depths,variants}.tsv"), optional: true, emit: variants
path "freyja/${sample}*", optional: true, emit: files
path "logs/${task.process}/${sample}.${workflow.sessionId}.log"

shell:
Expand All @@ -36,17 +36,84 @@ process freyja {
--depths freyja/!{sample}_depths.tsv \
--ref !{reference_genome} \
| tee -a $log
'''
}

process freyja_demix {
tag "${sample}"
label "process_medium"
//errorStrategy { task.attempt < 2 ? 'retry' : 'ignore'}
publishDir "${params.outdir}", mode: 'copy'
container 'quay.io/uphl/freyja:1.4.7-2023-10-31'

//#UPHLICA maxForks 10
//#UPHLICA pod annotation: 'scheduler.illumina.com/presetSize', value: 'standard-xlarge'
//#UPHLICA memory 60.GB
//#UPHLICA cpus 14
//#UPHLICA time '45m'

when:
params.freyja

input:
tuple val(sample), file(variants)

output:
path "freyja/${sample}_demix.tsv", optional: true, emit: demix
path "freyja/${sample}*", optional: true, emit: files
path "logs/${task.process}/${sample}.${workflow.sessionId}.log"

shell:
'''
mkdir -p freyja logs/!{task.process}
log=logs/!{task.process}/!{sample}.!{workflow.sessionId}.log

date > $log
freyja --version >> $log

freyja demix \
!{params.freyja_demix_options} \
freyja/!{sample}_variants.tsv \
freyja/!{sample}_depths.tsv \
!{variants[1]} \
!{variants[0]} \
--output freyja/!{sample}_demix.tsv \
| tee -a $log
'''
}

process freyja_boot {
tag "${sample}"
label "process_medium"
//errorStrategy { task.attempt < 2 ? 'retry' : 'ignore'}
publishDir "${params.outdir}", mode: 'copy'
container 'quay.io/uphl/freyja:1.4.7-2023-10-31'

//#UPHLICA maxForks 10
//#UPHLICA pod annotation: 'scheduler.illumina.com/presetSize', value: 'standard-xlarge'
//#UPHLICA memory 60.GB
//#UPHLICA cpus 14
//#UPHLICA time '45m'

when:
params.freyja

input:
tuple val(sample), file(variants)

output:
path "freyja/${sample}*", emit: files
path "logs/${task.process}/${sample}.${workflow.sessionId}.log"

shell:
'''
mkdir -p freyja logs/!{task.process}
log=logs/!{task.process}/!{sample}.!{workflow.sessionId}.log

date > $log
freyja --version >> $log

freyja boot !{params.freyja_boot_options} \
freyja/!{sample}_variants.tsv \
freyja/!{sample}_depths.tsv \
!{variants[1]} \
!{variants[0]} \
--nt !{task.cpus} \
--output_base freyja/!{sample}_boot.tsv \
| tee -a $log
Expand Down Expand Up @@ -76,7 +143,7 @@ process freyja_aggregate {
output:
path "freyja/aggregated*", emit: files
path "freyja/aggregated-freyja.tsv", emit: aggregated_freyja_file
path "freyja/*mqc.png", emit: for_multiqc
path "freyja/*mqc.png", emit: for_multiqc
path "freyja/*png"
path "logs/${task.process}/${task.process}.${workflow.sessionId}.log"

Expand Down
2 changes: 1 addition & 1 deletion nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ manifest {
name = 'Cecret'
author = 'Erin Young'
homePage = 'https://github.com/UPHL-BioNGS/Cecret'
version = 'v3.8.20231031'
version = 'v3.9.20231102'
defaultBranch = 'master'
recurseSubmodules = false
description = 'Reference-based consensus creation'
Expand Down
7 changes: 0 additions & 7 deletions nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,6 @@
"hidden": true,
"description": "Options for process"
},
"freyja_boot_options": {
"type": "string",
"hidden": true,
"default": "--nb 1000 --depthcutoff 100",
"description": "Options for process"
},
"freyja_demix_options": {
"type": "string",
"hidden": true,
Expand All @@ -144,7 +138,6 @@
"freyja_plot_options": {
"type": "string",
"hidden": true,
"default": "--mincov 100",
"description": "Options for process"
},
"freyja_variants_options": {
Expand Down
9 changes: 6 additions & 3 deletions subworkflows/sarscov2.nf
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
include { freyja; freyja_aggregate } from '../modules/freyja' addParams(params)
include { freyja_aggregate } from '../modules/freyja' addParams(params)
include { freyja_demix } from '../modules/freyja' addParams(params)
include { freyja_variants } from '../modules/freyja' addParams(params)
include { pangolin } from '../modules/pangolin' addParams(params)
include { nextclade } from '../modules/nextclade' addParams(params)
include { nextclade_dataset as dataset } from '../modules/nextclade' addParams(params)
Expand Down Expand Up @@ -26,8 +28,9 @@ workflow sarscov2 {
}

nextclade(ch_fastas.collect(), ch_dataset)
freyja(ch_bam.map{it -> tuple(it[0], it[1])}.combine(ch_reference_genome))
freyja_aggregate(freyja.out.freyja_demix.collect(), ch_freyja_script)
freyja_variants(ch_bam.map{it -> tuple(it[0], it[1])}.combine(ch_reference_genome))
freyja_demix(freyja_variants.out.variants)
freyja_aggregate(freyja_demix.out.demix.collect(), ch_freyja_script)

emit:
dataset = ch_dataset
Expand Down