Skip to content
Snippets Groups Projects
Commit 6d244bff authored by Andy Yates's avatar Andy Yates
Browse files

Bringing in summaries as hashes

parent 2d3ad239
No related branches found
No related tags found
No related merge requests found
...@@ -376,7 +376,32 @@ sub display_id { ...@@ -376,7 +376,32 @@ sub display_id {
} }
} }
=head2 summary_as_hash
Example : my $hash = $misc_feature->summary_as_hash();
Description: Generates a HashRef compatible with GFFSerializer. Adds
all attribute key value pairs plus MiscSet codes and names
Returntype : Hash
Exceptions : none
Caller : general
Status : Stable
=cut
sub summary_as_hash {
my ($self) = @_;
my $hash = $self->SUPER::summary_as_hash();
my $attributes = $self->get_all_Attributes();
foreach my $attr (@{$attributes}) {
$hash->{$attr->name()} = $attr->value();
}
my $misc_sets = $self->get_all_MiscSets();
foreach my $set (@{$misc_sets}) {
push(@{$hash->{misc_set_code}},$set->code());
push(@{$hash->{misc_set_name}},$set->name());
}
return $hash;
}
1; 1;
...@@ -162,5 +162,27 @@ sub score { ...@@ -162,5 +162,27 @@ sub score {
return $self->{'score'}; return $self->{'score'};
} }
=head2 summary_as_hash
Example : my $hash = $simple_feature->summary_as_hash();
Description: Generates a HashRef compatible with GFFSerializer. Adds
score, external_name and logic_name to the basic Feature
hash
Returntype : Hash
Exceptions : none
Caller : general
Status : Stable
=cut
sub summary_as_hash {
my ($self) = @_;
my $hash = $self->SUPER::summary_as_hash();
$hash->{score} = $self->score() if $self->score();
$hash->{'external_name'} = $self->display_label() if $self->display_label();
$hash->{'logic_name'} = $self->analysis->logic_name();
return $hash;
}
1; 1;
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment