From 4dc25cf0a0f11ea5a2693ec2540d41cbb829fabe Mon Sep 17 00:00:00 2001 From: "James A. Fellows Yates" Date: Wed, 15 May 2024 13:06:30 +0200 Subject: [PATCH] Rgi conditional mv (#5606) * Add Bracken stub, nf-test, version bump * Remove debug TODOs and fix tags * Remove pytests * And the other file * Add nf-test, stub, and version bump bracken combine versions * Fix tags * Add BRACKEN/BUILD module * Apply suggestions from code review Co-authored-by: Carson J Miller <68351153+CarsonJM@users.noreply.github.com> * Add additional output channel for secutiry * Make internal `mv` commands less error rone * Align semi colons --------- Co-authored-by: Carson J Miller <68351153+CarsonJM@users.noreply.github.com> --- modules/nf-core/rgi/main/main.nf | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/nf-core/rgi/main/main.nf b/modules/nf-core/rgi/main/main.nf index 94606b9dec1..6ac87f1311e 100644 --- a/modules/nf-core/rgi/main/main.nf +++ b/modules/nf-core/rgi/main/main.nf @@ -60,7 +60,16 @@ process RGI_MAIN { --input_sequence $fasta mkdir temp/ - mv *.xml *.fsa *.{nhr,nin,nsq} *.draft *.potentialGenes *{variant,rrna,protein,predictedGenes,overexpression,homolog}.json temp/ + mv *.xml *.fsa *.{nhr,nin,nsq} *.draft *.potentialGenes temp/ + + ## These files not always generated, so only move if they exist + ## Taken from https://stackoverflow.com/a/54655320 (RIP) by @TSJNachos117 + if [ "\$(ls -A | grep -i \\variant.json\\\$)" ] ; then mv *variant.json temp/ ; fi + if [ "\$(ls -A | grep -i \\rrna.json\\\$)" ] ; then mv *rrna.json temp/ ; fi + if [ "\$(ls -A | grep -i \\protein.json\\\$)" ] ; then mv *protein.json temp/ ; fi + if [ "\$(ls -A | grep -i \\predictedGenes.json\\\$)" ]; then mv *predictedGenes.json temp/; fi + if [ "\$(ls -A | grep -i \\overexpression.json\\\$)" ]; then mv *overexpression.json temp/; fi + if [ "\$(ls -A | grep -i \\homolog.json\\\$)" ] ; then mv *homolog.json temp/ ; fi RGI_VERSION=\$(rgi main --version)