All pastes #52067 Raw Edit

Unnamed

public text v1 · immutable
#52067 ·published 2006-04-28 17:50 UTC
rendered paste body
my %md5sNotFound = ();
my %md5sWithoutUniprot = ();
my %idsMapped = ();
my %genbankIds = ();

while(my $line = <INFILE>){
	chomp $line;
	my ($genbank, $sequence, $method) = split(/\t/, $line);
	$genbankIds{$genbank} = undef;

	my $c1 = 0;
	my $c2 = 0;
	my $c3 = 0;

    my $md5 = md5_hex($sequence);
	if(defined $md5Hash->{$md5} and exists $md5Hash->{$md5}->{'UniProt'}){
		print OUTFILE join("\t", ($genbank, $md5Hash->{$md5}->{'UniProt'}->{'ID'}, $md5, 'n/a', $method, $sequence))."\n";
		$idsMapped{$genbank} = undef;

		$c1 = 1;
	} elsif(!defined $md5Hash->{$md5}){
		$md5sNotFound{$genbank} = undef;

		$c2 = 1
	} elsif(!exists $md5Hash->{$md5}->{'UniProt'}){
		$md5sWithoutUniprot{$genbank} = undef;

		$c3 = 1;
	}

	if($c1 + $c2 + $c3 > 1){
		die "HOLY CRAP!";
	}
}

my $idsMappedCount = scalar keys %idsMapped;
my $md5sNotFound = scalar keys %md5sNotFound;
my $md5sWithoutUniprot = scalar keys %md5sWithoutUniprot;

close OUTFILE;
close INFILE;

$dbh->disconnect();

print "Done\n";

print "$idsMappedCount genBank IDs mapped\n";
print "$md5sNotFound genBank IDs not mapped due to MD5s not found\n";
print "$md5sWithoutUniprot genBank IDs not mapped due to sequences that do not have a uniprot id\n";
print "\n";
print "Sum of the above: ".($idsMappedCount+$md5sNotFound+$md5sWithoutUniprot)." genBank IDs\n";
print "Counted from the file: ".(scalar keys %genbankIds)." genBank IDs\n";