Add full user options for AMPir

This commit is contained in:
jasmezz 2022-06-09 16:59:00 +02:00
parent ba53e09b64
commit ecf1d146ab
4 changed files with 22 additions and 13 deletions

View file

@ -9,8 +9,9 @@ process AMPIR {
input: input:
tuple val(meta), path(faa) tuple val(meta), path(faa)
val cut_off
val model val model
val min_length
val min_probability
output: output:
tuple val(meta), path("*.faa"), emit: amps_faa tuple val(meta), path("*.faa"), emit: amps_faa
@ -23,15 +24,17 @@ process AMPIR {
script: script:
def args = task.ext.args ?: '' def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}" def prefix = task.ext.prefix ?: "${meta.id}"
min_length = ("${min_length}" == "[]") ? "": " min_len = as.integer(${min_length})," // Fall back to AMPir default value if none specified
""" """
#!/usr/bin/env Rscript #!/usr/bin/env Rscript
library(ampir) library(ampir)
protein_seqs <- read_faa('${faa}') input_seqs <- read_faa('${faa}')
prediction <- predict_amps(protein_seqs, model = '${model}') prediction <- predict_amps(input_seqs,${min_length} model = '${model}')
prediction <- protein_seqs[which(prediction\$prob_AMP >= as.integer(${cut_off})), ] prediction <- prediction[which(prediction\$prob_AMP >= as.numeric(${min_probability})), ]
df_to_faa(protein_seqs, "${prefix}.faa") output_seqs <- input_seqs[row.names(prediction), ]
write.table(prediction, file = "${prefix}.csv", row.names = FALSE, quote = FALSE, dec = '.') write.table(prediction, file = "${prefix}.csv", row.names = FALSE, sep = ";", quote = FALSE, dec = '.')
df_to_faa(output_seqs, "${prefix}.faa")
version_file_path <- "versions.yml" version_file_path <- "versions.yml"
version_ampir <- paste(unlist(packageVersion("ampir")), collapse = ".") version_ampir <- paste(unlist(packageVersion("ampir")), collapse = ".")

View file

@ -25,9 +25,13 @@ input:
pattern: "*.{faa,fasta}" pattern: "*.{faa,fasta}"
- model: - model:
type: value type: value
description: Model for AMP prediction description: Built-in model for AMP prediction
pattern: "{precursor,mature}" pattern: "{precursor,mature}"
- cut_off: - min_length:
type: value
description: Minimum protein length for which predictions will be generated
pattern: "[0-9]+"
- min_probability:
type: value type: value
description: Cut-off for AMP prediction description: Cut-off for AMP prediction
pattern: "[0-9][0-9]" pattern: "[0-9][0-9]"

View file

@ -10,9 +10,11 @@ workflow test_ampir {
file(params.test_data['candidatus_portiera_aleyrodidarum']['genome']['proteome_fasta'], checkIfExists: true), file(params.test_data['candidatus_portiera_aleyrodidarum']['genome']['proteome_fasta'], checkIfExists: true),
] ]
cut_off = "80"
model = "precursor" model = "precursor"
AMPIR ( fasta, cut_off, model ) min_length = []
min_probability = "0.7"
AMPIR ( fasta, model, min_length, min_probability )
} }

View file

@ -4,8 +4,8 @@
- ampir - ampir
files: files:
- path: output/ampir/test.csv - path: output/ampir/test.csv
md5sum: 063fd8866f6a669457d7a49404fb449f md5sum: a3b3152373a8add3613ace8c71073e68
- path: output/ampir/test.faa - path: output/ampir/test.faa
md5sum: e605d38752fd90261c924d51f7007189 md5sum: 0435609144022c55ac196db053f0df89
- path: output/ampir/versions.yml - path: output/ampir/versions.yml
md5sum: 4a11d25b8a904a7ffb34ae88f6826888 md5sum: 4a11d25b8a904a7ffb34ae88f6826888