[MOBY-guts] biomoby commit
Mark Wilkinson
mwilkinson at pub.open-bio.org
Sat Dec 27 20:24:52 UTC 2003
mwilkinson
Sat Dec 27 15:24:52 EST 2003
Update of /home/repository/moby/moby-live/Perl/MOBY
In directory pub.open-bio.org:/tmp/cvs-serv30103/Perl/MOBY
Modified Files:
CommonSubs.html CommonSubs.pm
Log Message:
changed my mind and decided to return both the object name as well as its LSID, since the latter is a bit arcane sometimes.
moby-live/Perl/MOBY CommonSubs.html,1.7,1.8 CommonSubs.pm,1.37,1.38
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.html,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.html 2003/12/27 20:15:45 1.7
+++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.html 2003/12/27 20:24:52 1.8
@@ -492,10 +492,10 @@
name : whichDeepestParentObject
function : select the parent node from nodeList that is
closest to the querynode
- usage : whichDeepestParentObject($CENTRAL, $queryNode, \@nodeList)
+ usage : ($term, $lsid) = whichDeepestParentObject($CENTRAL, $queryTerm, \@termList)
args : $CENTRAL - your MOBY::Client::Central object
- $queryNode - the node I am interested in
- \@nodelist - the list of nodes that I know about
+ $queryTerm - the object type I am interested in
+ \@termlist - the list of object types that I know about
returns : an ontology term as a scalar, or undef if there
is no parent of this node in the nodelist</pre>
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm 2003/12/27 20:15:45 1.37
+++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm 2003/12/27 20:24:52 1.38
@@ -1080,10 +1080,10 @@
name : whichDeepestParentObject
function : select the parent node from nodeList that is
closest to the querynode
- usage : whichDeepestParentObject($CENTRAL, $queryNode, \@nodeList)
+ usage : ($term, $lsid) = whichDeepestParentObject($CENTRAL, $queryTerm, \@termList)
args : $CENTRAL - your MOBY::Client::Central object
- $queryNode - the node I am interested in
- \@nodelist - the list of nodes that I know about
+ $queryTerm - the object type I am interested in
+ \@termlist - the list of object types that I know about
returns : an ontology term as a scalar, or undef if there
is no parent of this node in the nodelist
@@ -1093,21 +1093,21 @@
sub whichDeepestParentObject {
use MOBY::Client::OntologyServer;
my ($CENTRAL, $queryTerm, $termlist) = @_;
- return undef unless ($CENTRAL && $queryTerm && $termlist && (ref($termlist) =~ /ARRAY/));
+ return (undef,undef) unless ($CENTRAL && $queryTerm && $termlist && (ref($termlist) =~ /ARRAY/));
my %nodeLSIDs;
foreach (@$termlist){ # get list of known LSIDs
my $lsid = $CENTRAL->ObjLSID($_);
- $nodeLSIDs{$lsid}=1;
+ $nodeLSIDs{$lsid}=$_;
}
my $queryLSID = $CENTRAL->ObjLSID($queryTerm);
- return undef unless keys(%nodeLSIDs);
+ return (undef, undef) unless keys(%nodeLSIDs);
my $isa = $CENTRAL->ISA($queryTerm, 'Object'); # set the complete parentage in the cache if it isn't already
- return undef unless $isa; # this should return true or we are in BIIIG trouble!
- my @lsids = $CENTRAL->ISA_CACHE($queryTerm); # returns **LSIDs** in order, so we can shift our way back to root
- while (my $thisnode = shift @lsids){ # @isas are lsid's
- return $thisnode if $nodeLSIDs{$thisnode};
+ return (undef, undef) unless $isa; # this should return true or we are in BIIIG trouble!
+ my @ISAlsids = $CENTRAL->ISA_CACHE($queryTerm); # returns **LSIDs** in order, so we can shift our way back to root
+ while (my $thislsid = shift @ISAlsids){ # @isas are lsid's
+ return ($nodeLSIDs{$thislsid},$thislsid) if $nodeLSIDs{$thislsid};
}
- return undef
+ return (undef, undef);
}
sub _makeXrefType {
More information about the MOBY-guts
mailing list