#!/usr/bin/perl -w use strict; use CGI; use HTML::Template; my $cgi = new CGI; my $tmpl = HTML::Template->new (filename => 'tmpl/annotation.tmpl'); print "Content-type: text/html\n\n"; my $offgenes = 0; my $prodgenes = 0; my @offcordinates; my @prodcordinates; my $exactmatching = 0; my $start; my $stop; my $start1; my $stop1; my $threeprimematch; my %findgene; my %findgene2; my @officialannotation = (); my @prodigalannotation = (); my $hash_ref; my $hash_ref2; open(INFILE, "<", "genbankfile.txt") or die "cannot open file $!"; while() { if ($_ =~ /\d+/) { $offgenes++; } @offcordinates = split; $findgene = { "start" => $offcordinates[1], "stop" => $offcordinates[0] }; push @officialannotation, $findgene; } open(INFILE2, "<", "prodigalAnnotation.txt") or die "cannot open file $!"; while() { if($_ =~ /\d+/) { $prodgenes++; } @prodcordinates = split; $findgene2 = { "start1" => $prodcordinates[0], "stop1" => $prodcordinates[1] }; push @prodigalannotation, $findgene2; } foreach $genes ( @officialannotation ) { my %genes_= %$genes; foreach $genes2 ( @prodigalannotation ) { my %genes2 = %$genes2; if($genes{start} eq $genes2{start1}) { $exactmatching++; } } } print "$offgenes\n"; print "$prodgenes\n"; print "$exactmatching\n"; close(INFILE); close(INFILE2);