Skip to content

Commit

Permalink
Merge branch 'scheme_dir_custom_primers' into 'dev'
Browse files Browse the repository at this point in the history
Scheme dir custom primers

See merge request epi2melabs/workflows/wf-artic!129
  • Loading branch information
mattdmem committed Mar 13, 2023
2 parents 12b22c3 + 2f397cb commit 6674df0
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 14 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [v0.3.24]
### Fixed
- Custom primer schemes

## [v0.3.23]
### Changed
- medaka bumped to 1.7.2 (np-artic bump to 1.3.0_19)
Expand Down
7 changes: 6 additions & 1 deletion bin/run_artic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ threads=$9
max_softclip_length=${10}
normalise=${11}

if [[ "$scheme_version" == "None" ]];
then
scheme_version="."
fi

function mock_artic {
# write an empty VCF
echo "Mocking artic results"
Expand Down Expand Up @@ -44,7 +49,7 @@ READFILE="${sample_name}_${sample_name}.fastq"
artic minion --medaka --normalise ${normalise} --threads ${threads} \
--read-file ${READFILE} \
--medaka-model ${medaka_model} \
--scheme-directory ${scheme_dir}/${scheme_name} \
--scheme-directory ${scheme_dir} \
--scheme-version ${scheme_version} \
--max-softclip-length ${max_softclip_length} \
${scheme_name} ${sample_name} \
Expand Down
27 changes: 15 additions & 12 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ process runArtic {
"""
run_artic.sh \
${meta.sample_id} ${directory} ${params._min_len} ${params._max_len} \
${params.medaka_model} ${params.scheme_name} ${scheme_dir} \
${params.scheme_version} ${task.cpus} ${params._max_softclip_length} ${params.normalise}
${params.medaka_model} ${params._scheme_name} ${scheme_dir} \
${params._scheme_version} ${task.cpus} ${params._max_softclip_length} ${params.normalise}
bcftools stats ${meta.sample_id}.pass.named.vcf.gz > ${meta.sample_id}.pass.named.stats
"""
}
Expand Down Expand Up @@ -395,7 +395,7 @@ workflow pipeline {
software_versions = getVersions()
workflow_params = getParams()
combined_genotype_summary = Channel.empty()
// scheme_directory = copySchemeDir(projectDir.resolve("./data/${scheme_dir}"))

if ((samples.getClass() == String) && (samples.startsWith("Error"))){
samples = channel.of(samples)
html_doc = report_no_data(
Expand Down Expand Up @@ -546,24 +546,26 @@ workflow {


scheme_dir_name = "primer_schemes"
schemes = """./data/${scheme_dir_name}"""
schemes = """./data/${scheme_dir_name}/${params.scheme_name}"""
scheme_dir = file(projectDir.resolve(schemes), type:'file', checkIfExists:true)

primers_path = """./data/${scheme_dir_name}/${params.scheme_name}/${params.scheme_version}/${params.scheme_name}.scheme.bed"""
primers = file(projectDir.resolve(primers_path), type:'file', checkIfExists:true)

reference_path = """./data/${scheme_dir_name}/${params.scheme_name}/${params.scheme_version}/${params.scheme_name}.reference.fasta"""
reference = file(projectDir.resolve(reference_path),type:'file', checkIfExists:true)

params._scheme_version = params.scheme_version
params._scheme_name = params.scheme_name

} else {
//custom scheme path defined
log.info """${c_purple}Custom primer scheme selected: ${params.custom_scheme} (WARNING: We do not validate your scheme - use at your own risk!)${c_reset}"""
//check path for required files
primers = file("""${params.custom_scheme}/${params.scheme_name}.scheme.bed""", type:'file', checkIfExists:true)
reference = file("""${params.custom_scheme}/${params.scheme_name}.reference.fasta""", type:'file', checkIfExists:true)


// check to make sure min and max length have been set

if (!params.max_len || !params.min_len) {
log.info """${c_purple}EXITING: --min_len and --max_len parameters must be specified when using custom schemes.${c_reset}"""
exit 1
Expand All @@ -572,11 +574,13 @@ workflow {
params._max_len = params.max_len
params.remove('max_len')


params._min_len = params.min_len
params.remove('min_len')

params._scheme_version = 'None'
params._scheme_name = params.scheme_name

scheme_dir = params.custom_scheme
}

if (!params.max_softclip_length) {
Expand All @@ -589,13 +593,13 @@ workflow {
}

// Pangolin options
if (params.pangolin_options == null){
if (params.pangolin_options == null){
params.remove('pangolin_options')
params._pangolin_options = ''
} else {
} else {
params._pangolin_options = params.pangolin_options
params.remove('pangolin_options')
}
}


// For nextclade choose the most recent data from the nextclade_data git submodule, or if nexclade_data_tag is set in params use that
Expand Down Expand Up @@ -626,8 +630,7 @@ workflow {
"sample_sheet":params.sample_sheet,
"unclassified":params.analyse_unclassified])

println(scheme_dir)
results = pipeline(samples, scheme_dir, params.scheme_name, params.scheme_version, reference,
results = pipeline(samples, scheme_dir, params._scheme_name, params._scheme_version, reference,
primers, ref_variants, nextclade_dataset, nextclade_data_tag)
output(results)
}
Expand Down
2 changes: 1 addition & 1 deletion nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ manifest {
description = 'Run the ARTIC SARS-CoV-2 methodology on multiplexed MinION, GridION, and PromethION data.'
mainScript = 'main.nf'
nextflowVersion = '>=20.10.0'
version = 'v0.3.23'
version = 'v0.3.24'
}

epi2melabs {
Expand Down
8 changes: 8 additions & 0 deletions nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,14 @@
"type": "string",
"hidden": true
},
"_scheme_version": {
"type": "string",
"hidden": true
},
"_scheme_name": {
"type": "string",
"hidden": true
},
"_min_len": {
"type": "string",
"hidden": true
Expand Down

0 comments on commit 6674df0

Please sign in to comment.