X BOL wishing you a very and Happy New year

Alternative content

Our Sponsors



Download BioinformaticsOnline(BOL) Apps in your chrome browser.




DotPlot with Perl

#!/usr/bin/perl use strict;use warnings; my $i;my $j;my $a; open (FH1,'<', "s.fa"); open (FH2,'<', "s.fa"); my $seq1 = do { local $/; <FH1> }; my $seq2 = do { local $/; <FH2> }; my @s1=split('',$seq1); my @s2=split('',$seq2); my @matrix=(); for($i=0;$i<scalar(@s2);$i++) { for($j=0;$j<scalar(@s1);$j++) { if($s2[$i] eq $s1[$j]) { $matrix[$i][$j]="."; } else { $matrix[$i][$j]=" "; } } } #Printing matrix of dot plot open (FHOUT,">dotplot.txt") or die "cannot open outfile\n"; for($a=0;$a<scalar(@s1);$a++) { print FHOUT "$s1[$a]"; } print FHOUT "\n"; #print"\n\n"; for($i=0;$i<scalar(@s2);$i++) { print FHOUT "$s2[$i]"; for($j=0;$j<scalar(@s1);$j++) { print FHOUT "$matrix[$i][$j]"; } print FHOUT "\n"; #print"\n\n"; } close FH1; close FH2; close FHOUT;