This is a test version of Biostars. For the public version, visit https://www.biostars.org.
codon alignment with pal2nal

I'm trying to do multiple alignment with pal2nal, which requires two input files, I have a folder with multiple files whose extensions are -e1-e2_aa_aln.faa and -e1-e2.fasta, for a single alignment the command would be

pal2nal.pl file_one-e1-e2_aa_aln.faa file_one-e1-e2.fasta> file_one-e1-e2_nuc_aln.fasta

So, I'm trying with the next for loop to do all the alignments with all the files in the directory

for file in *.faa; do pal2nal.pl "$file" "${f%.faa}.fasta" -output fasta > "${file/-e1-e2_aa_aln.faa/one-e1-e2_nuc_aln.fasta}"; done

but, I get the next error message:

Can't open .fasta at /Users/user/Desktop/pal2nal.v14/pal2nal.pl line 335.

and I don't know where's my mistake in the for loop, can anyone help me ? please

alignment

1 answer

Debug your code with:

for file in *.faa
do 
    echo "$file"
    echo "${f%.faa}.fasta"
done

Then think variable name.

Log in to answer this question.