0

I'm using kofamscan by KEGG to annotate bunch of fasta files.I'm running this with multiple fasta files so whenever new file is being analyzed the output file is being overwritten. I really want separate output files per input file(i.e. a.fasta -> a.txt; b.fasta -> b.txt, etc.) and I have tried the following but it seems to be not working:

#!/bin/bash
#$ -S /bin/bash
#$ -cwd
#$ -pe def_slot 8
#$ -N coral_kofam
#$ -o stdout
#$ -e stderr
#$ -l os7
# perform kofam operation from file 1 to file 47
#$ -t 1-47:1
#$ -tc 10


#setting
source ~/.bash_profile
readarray -t files < kofam_files #input files

TASK_ID=$((SGE_TASK_ID - 1))
~/kofamscan/bin/exec_annotation -o kofam_out_[$TASK_ID].txt --tmp-dir $(mktemp -d) ${files[$TASK_ID]}

The following section of the code is where I need to change(obviously as it is not working for me now)

-o kofam_out_[$TASK_ID].txt

Could anybody help me how to make this work?

3
  • What if you change [ ] to " "? Commented Aug 11, 2019 at 9:52
  • @shellter this is a parallel job on a cluster, there will be separate instances for each value of $TASK_ID, so no need to loop in the script: the items in the loop are each in a separate process on a separate machine. I think the answer by Lord Johar should solve the problem, now I'm hoping OP will comment on it and/or accept it. Commented Aug 11, 2019 at 20:08
  • @joanis : thanks for clarifying the O.P.s problem description. Commented Aug 11, 2019 at 22:34

1 Answer 1

1

Do you want to name output file with $TASK_ID?

Just put file name like this kofam_out_${TASK_ID}.txt

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.