Skip to content

Commit

Permalink
Add squirrel (#1)
Browse files Browse the repository at this point in the history
* adding squirrel

* fix

* wip

* make naming of outputs consistent with the rest of the pipeline

* make naming of outputs consistent with the rest of the pipeline

* Small changes

* remove masking from first alignment

* add version

* update schema and dockerfile sha

* update squirrel version

* add export

* update squirrel defaults

* Small changes pre merge

* fix

* no default clade

---------

Co-authored-by: Biowilko <[email protected]>
  • Loading branch information
rmcolq and BioWilko authored Sep 26, 2024
1 parent d7e41f3 commit 960e885
Show file tree
Hide file tree
Showing 5 changed files with 116 additions and 3 deletions.
33 changes: 33 additions & 0 deletions modules/squirrel.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
process squirrelAlignmentAndQC {

label "process_low"

container "docker.io/articnetworkorg/squirrel@sha256:78921da0c726dd525f5d72db331526975adb634478ee31047c46765bd3d5a64a"

publishDir "${params.outdir}/${task.process.replaceAll(":","_")}", pattern: "squirrel/**", mode: 'copy', saveAs: { fn -> fn.replace("squirrel/", "")}

input:
path fasta
path refs
output:
path "squirrel/all_consensus.aln.fasta", emit: alignment
path "squirrel/**", emit: all
path "squirrel.version", emit: version

script:
extra = ""
if ( params.squirrel_assembly_refs )
extra += " --assembly-refs ${refs}"
if ( params.clade )
extra += " --clade ${params.clade}"
if ( params.run_phylo )
extra += " --run-phylo"
if ( params.outgroups )
extra += " --outgroups ${params.outgroups}"

"""
export XDG_CACHE_HOME=\$PWD/.cache
squirrel --version 2>&1 | sed 's/: /,/' > squirrel.version
squirrel ${fasta} --no-mask --seq-qc -o squirrel --outfile all_consensus.aln.fasta --tempdir squirrel_tmp -t ${task.cpus} ${extra}
"""
}
18 changes: 16 additions & 2 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@ manifest {
description = 'Epi2me compatible Nextflow pipeline for processing ARTIC tiling amplicon Illumina sequencing reads from monkeypox virus (MPXV) samples.'
mainScript = 'main.nf'
nextflowVersion = '>=20.01.0'
version = '1.1.0'
version = '1.2.0'
}

epi2melabs {
tags = 'MPox,artic,amplicon,viruses,public health,illumina'
icon = 'faVirusCovid'
}


// Load base.config by default for all pipelines
includeConfig 'conf/base.conf'

Expand Down Expand Up @@ -89,7 +95,15 @@ params {
monochrome_logs = false
validate_params = true
show_hidden_params = false
schema_ignore_params = 'show_hidden_params,validate_params,monochrome_logs,aws_queue,aws_image_prefix,wf,fastqSearchPath,fastq_exts,illuminaSuffixes,out_dir,illumina-suffixes'
schema_ignore_params = 'show_hidden_params,validate_params,monochrome_logs,aws_queue,aws_image_prefix,wf,fastqSearchPath,fastq_exts,illuminaSuffixes,out_dir,illumina-suffixes,run_phylo,no_mask'

// Squirrel options
skip_squirrel = false
no_mask = false
clade = null
run_phylo = false
outgroups = null
squirrel_assembly_refs = null

}

Expand Down
52 changes: 52 additions & 0 deletions nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,52 @@
},
"required": ["outdir", "prefix", "store_dir"]
},
"squirrel_options": {
"title": "Squirrel Options",
"type": "object",
"description": "Options related to running Squirrel",
"properties": {
"skip_squirrel": {
"type": "boolean",
"default": false,
"title": "Skip Squirrel",
"description": "Do not run alignment and QC pipeline",
"help_text": ""
},
"clade": {
"type": "string",
"title": "Clade",
"description": "Specify whether the sequencing run is primarily `cladeI` or `cladeII`.",
"enum": [
"cladei",
"cladeia",
"cladeib",
"cladeii",
"cladeiia",
"cladeiib"
],
"help_text": ""
},
"outgroups": {
"type": "string",
"title": "Outgroups",
"hidden": true,
"description": "Specify which MPXV outgroup(s) in the alignment to use in the phylogeny.",
"help_text": "These are required by the phylogenetics module and will get pruned out from the final tree."
},
"squirrel_assembly_refs": {
"type": "string",
"format": "path",
"title": "Assembly References",
"hidden": true,
"description": "References to check for `calls to reference` against, used only by the sequence QC process.",
"help_text": ""
}
},
"required": ["clade"],
"fa_icon": "fas fa-address-card",
"help_text": ""
},
"resource_options": {
"title": "Resource Options",
"type": "object",
Expand Down Expand Up @@ -229,6 +275,12 @@
{
"$ref": "#/definitions/output"
},
{
"$ref": "#/definitions/squirrel_options"
},
{
"$ref": "#/definitions/resource_options"
},
{
"$ref": "#/definitions/advanced_options"
},
Expand Down
Empty file added test_data/empty.fa
Empty file.
16 changes: 15 additions & 1 deletion workflows/illuminaMpxv.nf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ include { makeQCCSV } from '../modules/qc.nf'

include { collateSamples } from '../modules/upload.nf'

include { squirrelAlignmentAndQC } from '../modules/squirrel.nf'

workflow prepareReferenceFiles {

c_green = params.monochrome_logs ? '' : "\033[0;32m";
Expand Down Expand Up @@ -146,8 +148,19 @@ workflow sequenceAnalysis {

publishQCCSV(qc)

collateSamples(callConsensusFreebayes.out.consensus.join(ch_filtered_reads))

callConsensusFreebayes.out.consensus.map{ sampleName,sampleFasta -> sampleFasta }.collectFile(name: "all_consensus.fa").set{ consensus }
if ( params.squirrel_assembly_refs ) {
refs_ch = channel.fromPath("${params.squirrel_assembly_refs}", checkIfExists:true)
} else {
refs_ch = channel.fromPath("${projectDir}/test_data/empty.fa", checkIfExists:true)
}
squirrelAlignmentAndQC(consensus, refs_ch)

emit:
qc_pass = callConsensusFreebayes.out.consensus.join(ch_filtered_reads)
qc_pass = collateSamples.out
alignment = squirrelAlignmentAndQC.out.alignment
}

workflow mpxvIllumina {
Expand All @@ -156,6 +169,7 @@ workflow mpxvIllumina {

main:
prepareReferenceFiles()

sequenceAnalysis(ch_filePairs, prepareReferenceFiles.out.reference, prepareReferenceFiles.out.bwaIndex, prepareReferenceFiles.out.primers)
}

Expand Down

0 comments on commit 960e885

Please sign in to comment.