For context: I am running Prokka (as a novice bioinformatician with no Prokka and little Bash experience) and I have multiple FASTA files.
I have been told I need to produce a Bash loop that will allow me to input the FASTA files 1 by 1.
For example: my directory with all the FASTA (.fna) files is called StaphFNA, it has 1000 FASTA files in there. They are all named with ID numbers - but they do not increment as normal (so they aren't numbered 1, 2, 3 etc) there are random jumps e.g., one first be 34872 and the next one is 8933.
I need the first FASTA file within StaphFNA to be inputted, processed in Prokka, then outputted to a file called 'StaphProkka', then the 2nd FASTA file to go through the same process - being outputted into 'StaphProkka' again. On and on until all 1000 are complete.
As you can imagine, its a bit laborious having to do this 1000 times, so I wish to make a loop, but I am new to bash and I am struggling.
My Prokka argument (which I believe to be correct):
prokka /Users/me/Documents/StaphFNA --outdir StaphProkka --prefix staph_aur --kingdom bacteria --locusting staphylococcus
My For loop (which I know is wrong):
i = 0
for i in StaphFNA/.fna*; do
prokka /Users/me/Documents/StaphFNA/$i --outdir StaphProkka --prefix staph_aur --kingdom bacteria --locusting staphylococcus
i = i + 1
done
prokka foo.fna --outdir StaphProkka
, does that create a file calledStaphProkka/foo.prokka
or similar?i = 0
and removei = i + 1
. Also if you want to test first, writeecho
in front ofprokka
. It will show all commands that will be run when you do it withoutecho