Hi, Philipp. Thanks for your comments, it's really helpful. I also got stuck with that. I do not have the protein align, my input file is orthology gene family. So pal2nal is not suitable for me. I try to use a perl script:
die "perl $0 <fa> <OUT>" unless ( @ARGV == 2 );
use Bio::AlignIO;
use Bio::SimpleAlign;
$in = Bio::AlignIO->new(
-file => "$ARGV[0]",
-format => 'clustalw'
);
open OUT, ">$ARGV[1]" or die "$!";
while(my $aln = $in->next_aln() ){
# my @id;
# my @seq1;
# $n = 0;
# foreach $seq ($aln->each_seq()) {
# ($id[$n], $seq1[$n]) = ( $seq->id, $seq->seq);
# $n++;
# }
# print OUT "$id[0]&$id[1]\n$seq1[0]\n$seq1[1]\n\n";
$seq1 = $aln->get_seq_by_pos(1);
($id1, $sequence1) = ( $seq1->id, $seq1->seq);
$seq2 = $aln->get_seq_by_pos(2);
($id2, $sequence2) = ( $seq2->id, $seq2->seq);
print OUT "$id1&$id2\n$sequence1\n$sequence2\n\n";
}
$in->close();
close(OUT);;
However, the sequence still not equal. Could you please help to check what the problem was? Thanks.

Hi deepakumar, I have the same problem in ka/ks calculator. Do you have any idea how to resolve it ????
@deepkumar and @adeena_hassan I've been observing the same problem. Did you solve it somehow? Thanks
Please use
ADD COMMENTorADD REPLYto answer to previous reactions, as such this thread remains logically structured and easy to follow. I have now moved your reaction but as you can see it's not optimal. Adding an answer should only be used for providing a solution to the question asked.Ka/Ks calculator is a command line tool and it takes input in AXT format. A perl script that convert FASTA file into AXT is available with the tool. It reads a pair of sequences and computes corresponding estimates (length of the two sequence must b equal).
Here is my input file in AXT format:
Command:
Not sure if this example makes sense .. it does not even seem to be "aligned" according to me. Also the stretches of Ns might cause some issues
Can someone post an example of a pair for which it does work?
I think it might be due to the alignment result, if the two sequences are of too much length difference you will have to trim the unaligned parts.
Moreover, muscle is likely not the best tool to align the sequences for this purpose, as you will need to do a codon-aware alignment (== align the dna sequence codon per codon), otherwise the Kn/Ks estimates will not make any sense!
In addition, can someone really explain how are you running the tool? There are three people with the problem, just one test sequence, but no mention to as how the tool is being used. Is it the command-line version? The windows version? The online version? What parameters (if any) are being used?
Were you able to make it work in the end? I removed the piece of code that ashatan.314 noted as the problem but I still had the same error. Also other sequences that were not divided by 3 didnt give me any error.
@katerinapargana Ka/Ks calculator only worked for pairs of sequence and it worked well with the input given above. Before calculation, gaps and stop codons between compared sequences will be removed.