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

Run getmlst.py once and cache the result per pipeline run #93

Merged
merged 1 commit into from
Oct 3, 2024
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
7 changes: 5 additions & 2 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ include {serotyping} from './modules/serotyping.nf'
include {srst2_for_res_typing; split_target_RES_seq_from_sam_file; split_target_RES_sequences; freebayes} from './modules/res_alignments.nf'
include {res_typer} from './modules/res_typer.nf'
include {surface_typer} from './modules/surface_typer.nf'
include {srst2_for_mlst; get_mlst_allele_and_pileup} from './modules/mlst.nf'
include {getmlst_for_srst2; srst2_for_mlst; get_mlst_allele_and_pileup} from './modules/mlst.nf'
include {get_pbp_genes; get_pbp_alleles} from './modules/pbp_typer.nf'
include {finalise_sero_res_results; finalise_surface_typer_results; finalise_pbp_existing_allele_results; combine_results} from './modules/combine.nf'
include {get_version} from './modules/version.nf'
Expand Down Expand Up @@ -187,8 +187,11 @@ workflow MLST {
reads

main:
// Get MLST database for all downstream processes
getmlst_for_srst2()

// Run SRST2 MLST
srst2_for_mlst(reads, params.mlst_min_coverage)
srst2_for_mlst(getmlst_for_srst2.out.getmlst_results, reads, params.mlst_min_coverage)

// Get new consensus allele and pileup data
get_mlst_allele_and_pileup(srst2_for_mlst.out.bam_and_srst2_results, params.mlst_min_read_depth)
Expand Down
17 changes: 14 additions & 3 deletions modules/mlst.nf
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
process getmlst_for_srst2 {
output:
tuple path(mlst_fasta), path(mlst_profile_csv), emit: getmlst_results

script:
mlst_fasta="Streptococcus_agalactiae.fasta"
mlst_profile_csv="profiles_csv"
"""
getmlst.py --species 'Streptococcus agalactiae'
"""
}

process srst2_for_mlst {

input:
tuple path(mlst_fasta), path(mlst_profile_csv) // mlst database
tuple val(pair_id), file(reads) // ID and paired read files
val(min_coverage) // String of minimum coverage parameter(s) for SRST2

Expand All @@ -13,12 +26,10 @@ process srst2_for_mlst {
script:
mlst_db="Streptococcus_agalactiae.fasta"
mlst_name="Streptococcus_agalactiae"

"""
set +e

getmlst.py --species 'Streptococcus agalactiae'
srst2 --samtools_args '\\-A' --input_pe ${reads[0]} ${reads[1]} --output ${pair_id} --save_scores --mlst_db ${mlst_db} --mlst_definitions profiles_csv --mlst_delimiter '_' --min_coverage ${min_coverage}
srst2 --samtools_args '\\-A' --input_pe ${reads[0]} ${reads[1]} --output ${pair_id} --save_scores --mlst_db ${mlst_fasta} --mlst_definitions ${mlst_profile_csv} --mlst_delimiter '_' --min_coverage ${min_coverage}

touch ${pair_id}__mlst__${mlst_name}__results.txt

Expand Down
Loading