This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How do I run pal2nal.pl in batch mode ?

HI,

I had more than 4,500 orthologs, how do I run pal2nal.pl in batch mode. by taking two input files ?

pep.aln - OG0016582.mt.r.py.fa
nuc.fasta - all_OG0016582.fa.cds.fa 


pal2nal.pl aafasta/OG0016582.mt.r.py.fa  cdsfasta/all_OG0016582.fa.cds.fa -output paml > all_OG0016582.paml.fasta 

I wrote a script, can some one correct my script, thanks.

for i in $(ls -1 *.fa | sed 's/\.fa//'); do  pal2nal.pl  aafasta/$i\.fa  cdsfasta/$i\.fa -output paml > $i\.fasta ; done
gene genome protein
pal2nal.pl  OG0012884_out.fa OG0012884_out.txt -output paml > OG0012884_paml.txt

Script -

for txt in *_out.txt ; do
    sample=${txt%.txt}
    out=${sample%_out}
    pal2nal.pl "$sample".fa "$sample".txt -output paml > "$out"_paml.txt
done

You might add a check that the other file exists:

if [[ ! -e $sample.fa ]] ; then
    echo "$sample.fa missing, skipped." >&2
    continue
fi

0 answers

No answers yet.

Log in to answer this question.