Unverified Commit d76bcf48 authored by ens-bwalts's avatar ens-bwalts Committed by GitHub
Browse files

Merge pull request #376 from Ensembl/bugfix/feature_so_term

add feature_so_term to Slice.pm, as was added to Feature.pm
parents b9eeda0a 034f2216
......@@ -3054,6 +3054,7 @@ my %region_so_mapping = (
Example : $slice_so_acc = $slice->feature_so_acc;
Description : This method returns a string containing the SO accession number of the slice, based on the coordinate system name.
Returns : string (Sequence Ontology accession number)
=cut
sub feature_so_acc {
......@@ -3063,6 +3064,23 @@ sub feature_so_acc {
return $region_so_mapping{$self->coord_system_name} // 'SO:0000001';
}
=head2 feature_so_term
Description: This method returns a string containing the SO term of the slice, based on the coordinate system name
Define constant SEQUENCE_ONTOLOGY in classes that require it, or override it for multiple possible values for a class.
Returntype : String (Sequence Ontology term)
Exceptions : Thrown if caller SEQUENCE_ONTOLOGY is undefined and is not a Bio::EnsEMBL::Slice
=cut
sub feature_so_term {
my ($self) = shift;
return defined($region_so_mapping{$self->coord_system_name}) ?
$self->coord_system_name :
'region';
}
=head2 summary_as_hash
Example : $slice_summary = $slice->summary_as_hash();
......
......@@ -57,6 +57,7 @@ is($slice->end, $END, "Slice end is $END");
is($slice->seq_region_length, 62842997, "Slice length is correct");
is($slice->adaptor, $slice_adaptor, "Slice has adaptor $slice_adaptor");
is($slice->feature_so_acc, 'SO:0000340', 'Slice feature SO acc is correct (chromosome)');
is($slice->feature_so_term, 'chromosome', 'Slice feature SO term is correct (chromosome)');
#
#TEST - Slice::new
......@@ -221,6 +222,7 @@ is($clone->start, 1001, "Expanded clone start is correct if forced");
is($clone->end(), $len + 1000, "Expanded clone end is correct if forced");
is($clone->feature_so_acc, 'SO:0000001', 'Clone feature SO acc is correct (region)');
is($clone->feature_so_term, 'region', 'Clone feature SO term is correct (region)');
#
# Test constrain_to_seq_region
......
Markdown is supported
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