1034 |
# Loop through the genomes. |
# Loop through the genomes. |
1035 |
for my $genomeID (sort keys %{$genomeHash}) { |
for my $genomeID (sort keys %{$genomeHash}) { |
1036 |
Trace("Processing $genomeID.") if T(3); |
Trace("Processing $genomeID.") if T(3); |
1037 |
# Get the genome's PEGs. |
# Get the genome's annotations. |
1038 |
my @pegs = $fig->pegs_of($genomeID); |
my @annotations = $fig->read_all_annotations($genomeID); |
1039 |
for my $peg (@pegs) { |
Trace("Processing annotations.") if T(2); |
1040 |
Trace("Processing $peg.") if T(4); |
for my $tuple (@annotations) { |
1041 |
# Create a hash of timestamps. We use this to prevent duplicate time stamps |
# Create a hash of timestamps. We use this to prevent duplicate time stamps |
1042 |
# from showing up for a single PEG's annotations. |
# from showing up for a single PEG's annotations. |
1043 |
my %seenTimestamps = (); |
my %seenTimestamps = (); |
1044 |
# Loop through the annotations. |
# Get the annotation tuple. |
1045 |
for my $tuple ($fig->feature_annotations($peg, "raw")) { |
my ($peg, $timestamp, $user, $text) = @{$tuple}; |
|
my ($fid, $timestamp, $user, $text) = @{$tuple}; |
|
1046 |
# Here we fix up the annotation text. "\r" is removed, |
# Here we fix up the annotation text. "\r" is removed, |
1047 |
# and "\t" and "\n" are escaped. Note we use the "s" |
# and "\t" and "\n" are escaped. Note we use the "s" |
1048 |
# modifier so that new-lines inside the text do not |
# modifier so that new-lines inside the text do not |
1057 |
# Here it's a number. We need to insure the one we use to form |
# Here it's a number. We need to insure the one we use to form |
1058 |
# the key is unique. |
# the key is unique. |
1059 |
my $keyStamp = $timestamp; |
my $keyStamp = $timestamp; |
1060 |
while ($seenTimestamps{$keyStamp}) { |
while ($seenTimestamps{"$peg:$keyStamp"}) { |
1061 |
$keyStamp++; |
$keyStamp++; |
1062 |
} |
} |
|
$seenTimestamps{$keyStamp} = 1; |
|
1063 |
my $annotationID = "$peg:$keyStamp"; |
my $annotationID = "$peg:$keyStamp"; |
1064 |
|
$seenTimestamps{$annotationID} = 1; |
1065 |
# Insure the user exists. |
# Insure the user exists. |
1066 |
if (! $users{$user}) { |
if (! $users{$user}) { |
1067 |
$loadSproutUser->Put($user, "SEED user"); |
$loadSproutUser->Put($user, "SEED user"); |
1079 |
} |
} |
1080 |
} |
} |
1081 |
} |
} |
|
} |
|
1082 |
# Finish the load. |
# Finish the load. |
1083 |
my $retVal = $self->_FinishAll(); |
my $retVal = $self->_FinishAll(); |
1084 |
return $retVal; |
return $retVal; |