Skip to content

Commit

Permalink
Merge pull request #15 from phac-nml/modify-parameters-iridanext-UI
Browse files Browse the repository at this point in the history
Modify input parameters to integrate with IRIDA-Next UI
  • Loading branch information
sgsutcliffe authored Jul 25, 2024
2 parents fcf87f2 + 23278eb commit 32adf64
Show file tree
Hide file tree
Showing 8 changed files with 356 additions and 511 deletions.
1 change: 1 addition & 0 deletions assets/schema_input.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
},
"contigs": {
"type": "string",
"format": "file-path",
"pattern": "^\\S+\\.f(ast|n)?a\\.gz$",
"errorMessage": "FASTA file containing assembled contigs, cannot contain spaces and must have extension '.fa.gz' or '.fasta.gz'"
},
Expand Down
440 changes: 0 additions & 440 deletions conf/igenomes.config

This file was deleted.

63 changes: 58 additions & 5 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,25 @@ process {
'enterococcus_faecium', 'escherichia_coli', 'helicobacter_pylori']

// Convert the species name to a Pointfinder database-style name:
def convert = {String species_name -> species_name.trim().toLowerCase().replaceAll(" ", "_")}
def species_code = "[sS]almonella|[cC]amplyobacter|[eE]nterococcus.faecalis|[eE]nterococcus.faecium|[eE]scherichia.coli|[hH]elicobacter.pylori"
def convert = {String species_name -> species_name.trim().toLowerCase().replaceAll(" ", "_").find(species_code)}

// Create the command line arguments:
def point_db_arg = {String database -> " --pointfinder-organism ${database} " }
def plasmid_db_arg = {String database -> " --plasmidfinder-database-type ${database} " }
def mlst_arg = {String scheme -> " --mlst-scheme ${scheme} " }
def minimum_contig_length_arg = {String min_length -> " --minimum-contig-length ${min_length} "}
def genome_size_lower_bound_arg = {String min_genome -> " --genome-size-lower-bound ${min_genome} "}
def genome_size_upper_bound_arg = {String max_genome -> " --genome-size-upper-bound ${max_genome} "}
def minimum_N50_value_arg = {String min_n50 -> " --minimum-N50-value ${min_n50} "}
def unacceptable_number_contigs_arg = {String min_length -> " --unacceptable-number-contigs ${min_length} "}
def pid_threshold_arg = {String min_pid -> " --pid-threshold ${min_pid} "}
def percent_length_overlap_plasmidfinder_arg = {String min_overlap -> " --percent-length-overlap-plasmidfinder ${min_overlap} "}
def percent_length_overlap_resfinder_arg = {String min_overlap -> " --percent-length-overlap-resfinder ${min_overlap} "}
def percent_length_overlap_pointfinder_arg = {String min_overlap -> " --percent-length-overlap-pointfinder ${min_overlap} "}
def no_exclude_genes_arg = " --no-exclude-genes"
def exclude_negatives_arg = " --exclude-negatives"
def exclude_resistance_phenotypes_arg = " --exclude-resistance-phenotypes"

// Check to see if the database name is valid:
def valid_point_db = {String database -> pointfinder_databases.contains(database)}
Expand All @@ -58,8 +71,8 @@ process {
ext.args = {
[
// Pointfinder database:
params.pointfinder_database && valid_point_db(params.pointfinder_database) ?
point_db_arg(params.pointfinder_database) :
params.pointfinder_database && valid_point_db(convert(params.pointfinder_database)) ?
point_db_arg(convert(params.pointfinder_database)) :
meta.species && valid_point_db(convert(meta.species)) ?
point_db_arg(convert(meta.species)) : "",

Expand All @@ -68,8 +81,48 @@ process {
? plasmid_db_arg(params.plasmidfinder_database) : "",

// MLST scheme:
params.mlst_scheme
? mlst_arg(params.mlst_scheme) : ""
params.mlst_scheme && (params.mlst_scheme != "Automatic")
? mlst_arg(params.mlst_scheme) : "",

// Additional parameters
params.minimum_contig_length
? minimum_contig_length_arg(params.minimum_contig_length.toString()) : "",

params.genome_size_lower_bound
? genome_size_lower_bound_arg(params.genome_size_lower_bound.toString()) : "",

params.genome_size_upper_bound
? genome_size_upper_bound_arg(params.genome_size_upper_bound.toString()) : "",

params.minimum_N50_value
? minimum_N50_value_arg(params.minimum_N50_value.toString()) : "",

params.minimum_contig_length
? minimum_contig_length_arg(params.minimum_contig_length.toString()) : "",

params.unacceptable_number_contigs
? unacceptable_number_contigs_arg(params.unacceptable_number_contigs.toString()) : "",

params.pid_threshold
? pid_threshold_arg(params.pid_threshold.toString()) : "",

params.percent_length_overlap_plasmidfinder
? percent_length_overlap_plasmidfinder_arg(params.percent_length_overlap_plasmidfinder.toString()) : "",

params.percent_length_overlap_resfinder
? percent_length_overlap_resfinder_arg(params.percent_length_overlap_resfinder.toString()) : "",

params.percent_length_overlap_pointfinder
? percent_length_overlap_pointfinder_arg(params.percent_length_overlap_pointfinder.toString()) : "",

params.no_exclude_genes
? no_exclude_genes_arg : "",

params.exclude_negatives
? exclude_negatives_arg : "",

params.exclude_resistance_phenotypes
? exclude_resistance_phenotypes_arg : ""
].join(" ")
}
}
Expand Down
12 changes: 1 addition & 11 deletions lib/WorkflowMain.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,5 @@ class WorkflowMain {
Nextflow.error("Please provide an input samplesheet to the pipeline e.g. '--input samplesheet.csv'")
}
}
//
// Get attribute from genome config file e.g. fasta
//
public static Object getGenomeAttribute(params, attribute) {
if (params.genomes && params.genome && params.genomes.containsKey(params.genome)) {
if (params.genomes[ params.genome ].containsKey(attribute)) {
return params.genomes[ params.genome ][ attribute ]
}
}
return null
}

}
15 changes: 1 addition & 14 deletions lib/WorkflowStaramr.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class WorkflowStaramr {
//
public static void initialise(params, log) {

genomeExistsError(params, log)
}

public static String toolCitationText(params) {
Expand Down Expand Up @@ -65,17 +64,5 @@ class WorkflowStaramr {
return description_html
}

//
// Exit pipeline if incorrect --genome key provided
//
private static void genomeExistsError(params, log) {
if (params.genomes && params.genome && !params.genomes.containsKey(params.genome)) {
def error_string = "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" +
" Genome '${params.genome}' not found in any config files provided to the pipeline.\n" +
" Currently, the available genome keys are:\n" +
" ${params.genomes.keySet().join(", ")}\n" +
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
Nextflow.error(error_string)
}
}

}
34 changes: 20 additions & 14 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ params {
// TODO nf-core: Specify your pipeline's command line flags
// Input options
input = null
// References
genome = null
igenomes_base = 's3://ngi-igenomes/igenomes'
igenomes_ignore = false

// Boilerplate options
outdir = null
Expand Down Expand Up @@ -50,10 +46,26 @@ params {
validationShowHiddenParams = false
validate_params = true

//StarAMR options
pointfinder_database = null
plasmidfinder_database = null
mlst_scheme = null
// StarAMR options

// Databases
pointfinder_database = "Automatic Selection"
plasmidfinder_database = "All"
mlst_scheme = "Automatic"

// Additional CLI arguments
genome_size_lower_bound = 4000000
genome_size_upper_bound = 6000000
minimum_N50_value = 10000
minimum_contig_length = 300
unacceptable_number_contigs = 1000
pid_threshold = 98
percent_length_overlap_plasmidfinder = 60
percent_length_overlap_resfinder = 60
percent_length_overlap_pointfinder = 95
no_exclude_genes = false
exclude_negatives = false
exclude_resistance_phenotypes = false

}

Expand Down Expand Up @@ -183,12 +195,6 @@ plugins {
}


// Load igenomes.config if required
if (!params.igenomes_ignore) {
includeConfig 'conf/igenomes.config'
} else {
params.genomes = [:]
}
// Export these variables to prevent local Python/R libraries from conflicting with those in the container
// The JULIA depot path has been adjusted to a fixed path `/usr/local/share/julia` that needs to be used for packages in the container.
// See https://apeltzer.github.io/post/03-julia-lang-nextflow/ for details on that. Once we have a common agreement on where to keep Julia packages, this is adjustable.
Expand Down
Loading

0 comments on commit 32adf64

Please sign in to comment.