Hello !
I would like to compare sequences that I have in one file. The most important think to me is that I would like to compare them in columns, so first position form sequence A with first position in sequence B etc.
Do you have any idea how to start?
(of course I don't expect prepared code, but maybe someone do something like this and could help me start )
This is how I start but it's give me error That file cannot be read.
I would like to compare sequences that I have in one file. The most important think to me is that I would like to compare them in columns, so first position form sequence A with first position in sequence B etc.
Do you have any idea how to start?
(of course I don't expect prepared code, but maybe someone do something like this and could help me start )
This is how I start but it's give me error That file cannot be read.
Code:
my $end = $#a1 < $#a2 ? $#a1 : $#a2;
my $result = 0;
for (my $l=0; $l<=$end; $l++) {
$result++ if $a1[$l] eq $a2[$l];
}
my $A = (2 * $result) / ($#a1 + $#a2 + 2);
my $B = $result / ($end+1);
print "Similar = $result, A = $A, B = $B\n";
}
my $file = 'seqs.txt';
open I, '<', $file
or die "Can't open '$file' for reading: $!\n";
chop (%hash = map { split /\s*,\s*/,$_,2 } grep (!/^$/,<I>));
print "$_$hash{$_}\n" for keys %hash;
open
open (IN, $ARGV[0]) || die "File not found $ARGV[0]: $!\n";
chomp(my @in = <IN>);
map {
s/[^agtc]//ig;
} @in;
my $dna1 = read_file($ARGV[0]);
my $dna2 = read_file($ARGV[1]);
compare ($dna1, $dna2);
compare($in[0], $in[1]);
compare($in[1], $in[2]);
compare($in[2], $in[3]);
close (IN);
Comment