Commit 50a7e462 authored by Magali Ruffier's avatar Magali Ruffier
Browse files

added API support for karyotype attribute

parent 59f4538b
......@@ -1082,6 +1082,76 @@ sub is_toplevel {
return 0;
}
=head2 has_karyotype
Arg : int seq_region_id
Example : my $karyotype = $slice_adptor->has_karyotype($seq_region_id)
Description: Returns 1 if slice is a part of a karyotype else 0
Returntype : int
Caller : Slice method has_karyotype
Status : At Risk
=cut
sub has_karyotype {
my $self = shift;
my $id = shift;
my $sth = $self->prepare(
"SELECT at.code from seq_region_attrib sra, attrib_type at "
. "WHERE sra.seq_region_id = ? "
. "AND at.attrib_type_id = sra.attrib_type_id "
. "AND at.code = 'karyotype_rank'" );
$sth->bind_param( 1, $id, SQL_INTEGER );
$sth->execute();
my $code;
$sth->bind_columns( \$code );
while ( $sth->fetch ) {
$sth->finish;
return 1;
}
$sth->finish;
return 0;
}
=head2 get_karyotype_rank
Arg : int seq_region_id
Example : my $rank = $slice_adptor->get_karyotype_rank($seq_region_id)
Description: Returns the rank of a slice if it is part of the karyotype else 0
Returntype : int
Caller : Slice method get_karyotype_rank
Status : At Risk
=cut
sub get_karyotype_rank {
my $self = shift;
my $id = shift;
my $sth = $self->prepare(
"SELECT sra.value from seq_region_attrib sra, attrib_type at "
. "WHERE sra.seq_region_id = ? "
. "AND at.attrib_type_id = sra.attrib_type_id "
. "AND at.code = 'karyotype_rank'" );
$sth->bind_param( 1, $id, SQL_INTEGER );
$sth->execute();
my $code;
$sth->bind_columns( \$code );
my $rank = $sth->fetchrow_array();
$sth->finish();
return $rank;
}
=head2 is_reference
Arg : int seq_region_id
Example : my $reference = $slice_adptor->is_reference($seq_region_id)
......
......@@ -527,6 +527,28 @@ sub is_toplevel {
return $self->{'toplevel'};
}
=head2 has_karyotype
Arg : none
Example : my $top = $slice->has_karyotype()
Description: Returns 1 if slice is part of the karyotype else 0
Returntype : int
Caller : general
Status : At Risk
=cut
sub has_karyotype {
my ($self) = @_;
if ( !defined( $self->{'karyotype'} ) ) {
$self->{'karyotype'} =
$self->adaptor()->has_karyotype( $self->get_seq_region_id() );
}
return $self->{'karyotype'};
}
=head2 is_circular
Arg : none
Example : my $circ = $slice->is_circular()
......
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