convert code into matlab code
Ältere Kommentare anzeigen
hi, i badly need this code, but it is not matlab code. this is code foe sequence local alignment(smith-waterman), I did not find it as matlab code .I converted most of this code but the last part, I did not know the commands of this programming language can anybody help to convert the following code into matlab?
- trace-back
my $align1 = "";
my $align2 = "";
my $j = $max_j;
my $i = $max_i;
while (1) {
last if $matrix[$i][$j]{pointer} eq "none";
if ($matrix[$i][$j]{pointer} eq "diagonal") {
$align1 .= substr($seq1, $j-1, 1);
$align2 .= substr($seq2, $i-1, 1);
$i--; $j--;
}
elsif ($matrix[$i][$j]{pointer} eq "left") {
$align1 .= substr($seq1, $j-1, 1);
$align2 .= "-";
$j--;
}
elsif ($matrix[$i][$j]{pointer} eq "up") {
$align1 .= "-";
$align2 .= substr($seq2, $i-1, 1);
$i--;
}
}
$align1 = reverse $align1;
$align2 = reverse $align2;
print "$align1\n";
print "$align2\n";
thanks in advance
Akzeptierte Antwort
Weitere Antworten (1)
Diego
am 30 Dez. 2011
0 Stimmen
If you have the bioinfo toolbox, then you probably have the swalign file that implements the smith-waterman algorithm. On the other hand, I just discovered that Matlab runs perl scripts smoothly! In my case, I have a perl script that uses the bioperl module and Matlab ran it!. I said this because I was facing a similar problem, and these tips may help you to accomplish your work. Regards, Diego
4 Kommentare
Walter Roberson
am 30 Dez. 2011
Huda is attempting to use Smith-Waterman, an algorithm designed for biological sequence alignment, to do alignment of non-biological sequences, and so cannot use the bioinfo toolbox version.
Diego
am 30 Dez. 2011
Hi Walter and Huda. Hopefully my participation in this post is ok.
As you may remember, past few days I used the needleman-wunsh algorithm to align decimal numbers. I'm going to have to do the same in a couple of days with the SW algorithm since I need local and not global alignments. So I wonder if there is a reason (structure of the code or function callings etc) for which the swalign file cannot be modified the same as the nwalign file for reading non-biological sequences?
Thanks,
Diego
huda nawaf
am 30 Dez. 2011
huda nawaf
am 31 Dez. 2011
Kategorien
Mehr zu Matrix Indexing finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!