Bio-DB-Das-Chado
view release on metacpan or search on metacpan
lib/Bio/DB/Das/Chado.pm view on Meta::CPAN
return $self->{'dbh'};
}
=head2 term2name
Title : term2name
Usage : $obj->term2name($newval)
Function: When called with a hashref, sets cvterm.cvterm_id to cvterm.name
mapping hashref; when called with an int, returns the name
corresponding to that cvterm_id; called with no arguments, returns
the hashref.
Returns : see above
Args : on set, a hashref; to retrieve a name, an int; to retrieve the
hashref, none.
Note: should be replaced by Bio::GMOD::Util->term2name
=cut
sub term2name {
my $self = shift;
my $arg = shift;
if(ref($arg) eq 'HASH'){
return $self->{'term2name'} = $arg;
} elsif($arg) {
return $self->{'term2name'}{$arg};
} else {
return $self->{'term2name'};
}
}
=head2 name2term
Title : name2term
Usage : $obj->name2term($newval)
Function: When called with a hashref, sets cvterm.name to cvterm.cvterm_id
mapping hashref; when called with a string, returns the cvterm_id
corresponding to that name; called with no arguments, returns
the hashref.
Returns : see above
Args : on set, a hashref; to retrieve a cvterm_id, a string; to retrieve
the hashref, none.
Note: Should be replaced by Bio::GMOD::Util->name2term
=cut
sub name2term {
my $self = shift;
my $arg = shift;
my $cvnames = shift;
if(ref($cvnames) eq 'HASH'){ $self->{'termcvs'} = $cvnames; }
if(ref($arg) eq 'HASH'){
return $self->{'name2term'} = $arg;
} elsif($arg) {
return $self->{'name2term'}{$arg};
#rather than trying to guess what a caller wants, the caller will have
#deal with what comes... (ie, a scalar or a hash).
# my $val= $self->{'name2term'}{$arg};
# if(ref($val)) {
# #? use $cvnames scalar here to pick which cv?
# my @val= @$val;
# foreach $val (@val) {
# my $cv= $self->{'termcvs'}{$val};
# return $val if($cv =~ /^(SO|sequence)/i); # want sofa_id
# }
# return $val[0]; #? 1st is best guess
# }
# return $val;
} else {
return $self->{'name2term'};
}
}
=head2 segment
Title : segment
Usage : $db->segment(@args);
Function: create a segment object
Returns : segment object(s)
Args : see below
This method generates a Bio::Das::SegmentI object (see
L<Bio::Das::SegmentI>). The segment can be used to find overlapping
features and the raw sequence.
When making the segment() call, you specify the ID of a sequence
landmark (e.g. an accession number, a clone or contig), and a
positional range relative to the landmark. If no range is specified,
then the entire region spanned by the landmark is used to generate the
segment.
Arguments are -option=E<gt>value pairs as follows:
-name ID of the landmark sequence.
-class A namespace qualifier. It is not necessary for the
database to honor namespace qualifiers, but if it
does, this is where the qualifier is indicated.
-version Version number of the landmark. It is not necessary for
the database to honor versions, but if it does, this is
where the version is indicated.
-start Start of the segment relative to landmark. Positions
follow standard 1-based sequence rules. If not specified,
defaults to the beginning of the landmark.
-end End of the segment relative to the landmark. If not specified,
defaults to the end of the landmark.
The return value is a list of Bio::Das::SegmentI objects. If the method
is called in a scalar context and there are no more than one segments
that satisfy the request, then it is allowed to return the segment.
Otherwise, the method must throw a "multiple segment exception".
=cut
sub segment {
my $self = shift;
my ($name,$base_start,$stop,$end,$class,$version,$db_id,$feature_id,$srcfeature_id)
= $self->_rearrange([qw(NAME
START
STOP
END
CLASS
( run in 1.904 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )