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,10 +11,10 @@ process AMPIR {
tuple val(meta), path(faa)
val cut_off
val model
val output_name
output:
tuple val(meta), path(output_name) , emit: amps
tuple val(meta), path("*.faa"), emit: amps_faa
tuple val(meta), path("*.csv"), emit: amps_csv
path "versions.yml" , emit: versions
when:
@ -27,10 +27,11 @@ process AMPIR {
#!/usr/bin/env Rscript
library(ampir)
protein_seqs <- read_faa("${faa}")
prediction <- predict_amps(protein_seqs, model = '$model')
prediction <- protein_seqs[which(prediction\$prob_AMP >= as.integer($cut_off)), ]
df_to_faa(protein_seqs, '$output_name')
protein_seqs <- read_faa('${faa}')
prediction <- predict_amps(protein_seqs, model = '${model}')
prediction <- protein_seqs[which(prediction\$prob_AMP >= as.integer(${cut_off})), ]
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_ampir <- paste(unlist(packageVersion("ampir")), collapse = ".")

View file

@ -8,7 +8,7 @@ tools:
- "ampir":
description: "A toolkit to predict antimicrobial peptides from protein sequences on a genome-wide scale."
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"
doi: "10.1093/bioinformatics/btaa653"
licence: ["GPL v2"]
@ -42,14 +42,14 @@ output:
type: file
description: File containing software versions
pattern: "versions.yml"
- amps:
- amps_faa:
type: file
description: File containing AMP predictions
pattern: "prediction.fasta"
- output_name:
type: value
description: File name of the FASTA output file
description: File containing AMP predictions in amino acid FASTA format
pattern: "*.{faa,fasta}"
- amps_csv:
type: file
description: File containing AMP predictions in CSV format
pattern: "*.csv"
authors:
- "@jasmezz"

View file

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

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
tags:
- "ampir"
- ampir
files:
- path: output/ampir/prediction.fasta
- path: output/ampir/test.csv
md5sum: 063fd8866f6a669457d7a49404fb449f
- path: output/ampir/test.faa
md5sum: e605d38752fd90261c924d51f7007189
- path: output/ampir/versions.yml
md5sum: 4a11d25b8a904a7ffb34ae88f6826888