Implement suggestions from code review

This commit is contained in:
jasmezz 2022-06-09 15:37:35 +02:00
parent 5a94794793
commit ba53e09b64
4 changed files with 22 additions and 21 deletions

View file

@ -11,11 +11,11 @@ process AMPIR {
tuple val(meta), path(faa) tuple val(meta), path(faa)
val cut_off val cut_off
val model val model
val output_name
output: output:
tuple val(meta), path(output_name) , emit: amps tuple val(meta), path("*.faa"), emit: amps_faa
path "versions.yml" , emit: versions tuple val(meta), path("*.csv"), emit: amps_csv
path "versions.yml" , emit: versions
when: when:
task.ext.when == null || task.ext.when task.ext.when == null || task.ext.when
@ -27,10 +27,11 @@ process AMPIR {
#!/usr/bin/env Rscript #!/usr/bin/env Rscript
library(ampir) library(ampir)
protein_seqs <- read_faa("${faa}") protein_seqs <- read_faa('${faa}')
prediction <- predict_amps(protein_seqs, model = '$model') prediction <- predict_amps(protein_seqs, model = '${model}')
prediction <- protein_seqs[which(prediction\$prob_AMP >= as.integer($cut_off)), ] prediction <- protein_seqs[which(prediction\$prob_AMP >= as.integer(${cut_off})), ]
df_to_faa(protein_seqs, '$output_name') df_to_faa(protein_seqs, "${prefix}.faa")
write.table(prediction, file = "${prefix}.csv", row.names = FALSE, quote = FALSE, dec = '.')
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

@ -8,7 +8,7 @@ tools:
- "ampir": - "ampir":
description: "A toolkit to predict antimicrobial peptides from protein sequences on a genome-wide scale." description: "A toolkit to predict antimicrobial peptides from protein sequences on a genome-wide scale."
homepage: "https://github.com/Legana/ampir" homepage: "https://github.com/Legana/ampir"
documentation: "https://github.com/Legana/ampir" documentation: "https://cran.r-project.org/web/packages/ampir/index.html"
tool_dev_url: "https://github.com/Legana/ampir" tool_dev_url: "https://github.com/Legana/ampir"
doi: "10.1093/bioinformatics/btaa653" doi: "10.1093/bioinformatics/btaa653"
licence: ["GPL v2"] licence: ["GPL v2"]
@ -42,14 +42,14 @@ output:
type: file type: file
description: File containing software versions description: File containing software versions
pattern: "versions.yml" pattern: "versions.yml"
- amps: - amps_faa:
type: file type: file
description: File containing AMP predictions description: File containing AMP predictions in amino acid FASTA format
pattern: "prediction.fasta"
- output_name:
type: value
description: File name of the FASTA output file
pattern: "*.{faa,fasta}" pattern: "*.{faa,fasta}"
- amps_csv:
type: file
description: File containing AMP predictions in CSV format
pattern: "*.csv"
authors: authors:
- "@jasmezz" - "@jasmezz"

View file

@ -14,7 +14,5 @@ workflow test_ampir {
model = "precursor" model = "precursor"
output_name = "prediction.fasta" AMPIR ( fasta, cut_off, model )
AMPIR ( fasta, cut_off, model, output_name )
} }

View file

@ -1,9 +1,11 @@
- name: "ampir" - name: ampir test_ampir
command: nextflow run ./tests/modules/ampir -entry test_ampir -c ./tests/config/nextflow.config -c ./tests/modules/ampir/nextflow.config command: nextflow run ./tests/modules/ampir -entry test_ampir -c ./tests/config/nextflow.config -c ./tests/modules/ampir/nextflow.config
tags: tags:
- "ampir" - ampir
files: files:
- path: output/ampir/prediction.fasta - path: output/ampir/test.csv
md5sum: 063fd8866f6a669457d7a49404fb449f
- path: output/ampir/test.faa
md5sum: e605d38752fd90261c924d51f7007189 md5sum: e605d38752fd90261c924d51f7007189
- path: output/ampir/versions.yml - path: output/ampir/versions.yml
md5sum: 4a11d25b8a904a7ffb34ae88f6826888 md5sum: 4a11d25b8a904a7ffb34ae88f6826888