This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Bash skript for mafft alignment

Hello everyone! I have just started working with bash scripting and need to align (Mafft alignment) my 2863 fasta files, but my code does not seem to work. Can you please help me? Thanks in advance :)

Folder:
aa_less10

Files :
E*.aa.fa

New File that I want to save my aligned files:

align

Here is my code:

 for FILE in `cat aa_less10/E*.aa.fa`; 
 do
 mafft --genafpair --maxiterate 1000 $FILE > $FILE.out;   
 cp $FILE.out/$FILE align/$FILE  
 done
fasta alignment bash

1 answer

you want

for FILE in aa_less10/E*.aa.fa
do
(...)

and just, in case, protect your variable with ${FILE}

Hi again :D Thank you for the help.

Now I tried like this: (But the output dose not save in the current folder, do you know why? )

for FILE in aa_less10/E*.aa.fa; do

mafft --genafpair --maxiterate 1000 ${FILE} > $FILE.out;
done

Log in to answer this question.