BioPerl-DB

 view release on metacpan or  search on metacpan

lib/Bio/DB/BioSQL/SeqFeatureAdaptor.pm  view on Meta::CPAN

    my $i = 0;
    my $loc = $obj->location();
    my @locs =
	$loc->isa("Bio::Location::SplitLocationI") ?
	$loc->sub_Location() : ($loc);
    foreach $loc (@locs) {
	$loc->rank(++$i) if $loc->can('rank');
	$ok = $loc->store(-fkobjs => [$obj]) && $ok;
    }
    # store the annotation and associate ourselves with it; we use an adaptor
    # to transparently access all annotation through the AnnotationCollectionI
    # interface
    my $ac = $self->_featann_adaptor();
    $ac->feature($obj);
    # we need to get an adaptor to store it (or make it persistent, which is
    # unnecessary overhead since $ac will go out of scope at the end of this
    # method)
    if($ac->get_num_of_annotations() > 0) {
	my $acadp = $self->_anncoll_adaptor();
	$ok = $acadp->create($ac) && $ok;
	$acadp->add_association(-objs => [$ac, $obj]);

lib/Bio/DB/BioSQL/SeqFeatureAdaptor.pm  view on Meta::CPAN

    if(@$locs == 1) {
	$obj->location($locs->[0]);
    } elsif(@$locs > 1) {
	$obj->location(Bio::Location::Split->new(-locations => $locs));
    }
    $ok = @$locs > 0;
    #
    # look up annotation for this feature by association
    #
    my $annadp = $self->_anncoll_adaptor();
    # we use an adaptor to transparently add all annotation through the
    # AnnotationCollectionI interface
    my $ac = $self->_featann_adaptor();
    $ac->feature($obj);
    # now have the adaptor find by association
    $qres = $annadp->find_by_association(-objs => [$ac,$obj]);
    # no need to attach the annotation collection to the feature - the
    # annotation adaptor added everything to the feature transparently
    $qres->next_object(); # remove it from the stack, just to be sure
    # done
    return $ok;
}

=head2 remove_children

 Title   : remove_children
 Usage   :
 Function: This method is to cascade deletes in maintained objects.



( run in 0.463 second using v1.01-cache-2.11-cpan-a1d94b6210f )