[MOBY-guts] biomoby commit

Mark Wilkinson mwilkinson at dev.open-bio.org
Mon Oct 22 20:52:38 UTC 2007


mwilkinson
Mon Oct 22 16:52:37 EDT 2007
Update of /home/repository/moby/moby-live/Perl/MOBY
In directory dev.open-bio.org:/tmp/cvs-serv17883/MOBY

Modified Files:
	OntologyServer.pm 
Log Message:
fixing Relationships code
moby-live/Perl/MOBY OntologyServer.pm,1.104,1.105
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm,v
retrieving revision 1.104
retrieving revision 1.105
diff -u -r1.104 -r1.105
--- /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm	2007/09/14 16:26:50	1.104
+++ /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm	2007/10/22 20:52:37	1.105
@@ -1343,10 +1343,27 @@
 	my $incls = $self->_getInclusions($relHash,$node,[$rel], $incExpand);
 	foreach my $triplet ( @$incls ) {
 	  my ($inclId, $inclArtName, $inclAssert) = @$triplet;
-	  $hasRelDetails->{$inclId}->{$inclAssert} = $inclArtName;
+	  $hasRelDetails->{$inclId}->{$inclAssert} = $inclArtName;  # can be more than one articleName for each included Object
 	  push @entityResultList, $inclId;
 	}
       }
+	# we have the following structure now for the HAS and HASA...
+	#       DB<35> x $hasRelDetails
+	#	0  HASH(0x95cd1bc)
+	#	5371 => HASH(0x95f7fd8)   # object type
+	#	10795 => 'Tiny'		  # related to parent by $ rel relationship 
+	#	10796 => 'Small'
+	#	10797 => 'Aliphatic'
+	#	10798 => 'Aromatic'
+	#	10799 => 'Non-polar'
+	#	10800 => 'Polar'
+	#	10801 => 'Charged'
+	#	10802 => 'Positive'
+	#	10803 => 'Negative'
+	#	10804 => 'Hydropathy_KD'
+	#	10805 => 'Hydropathy_OHM'
+	#	10806 => 'Consensus'
+
       # set up list of unique object ids for the database lookup
       @entityQueryList = keys %$hasRelDetails;
     }
@@ -1358,16 +1375,23 @@
     
     # now it's time to move away from pure ids, retrieve details from database:
     my $details = $adaptor->get_details_for_id_list($ontology, \@fields, \@entityQueryList);
-
+    my $newstructure;
     # enhance details with information about relationships and build result hash
     foreach my $entityId (@entityResultList) {
       # add articleName slot if necessary
-      if ( exists $hasRelDetails->{$entityId} ) {
+      if ( exists $hasRelDetails->{$entityId} ) {  # the only things that have RelDetails are HASA/HAS EntityIDs
 	foreach my $assert ( keys %{$hasRelDetails->{$entityId}} ) {
-	  $details->{$entityId}->{'articleName'} = $hasRelDetails->{$entityId}->{$assert};
+	  # THIS DATA STRUCTURE IS WRONG - IT ASSUMES ONE ARTICLE NAME FOR EACH CONTAINED OBJECT TYPE
+	  # NEEDS TO BE REVERSED!
+	  my $articleName = $hasRelDetails->{$entityId}->{$assert};
+	  my $objectTypeLSID = $details->{entityId}->{object_lsid};
+	  $details->{$entityId}->{'articleName'}->{$articleName} = "Related_by";  # I know, this is a very goofy data structure.  What we really
+				# want are keys $details->{entitId}->{articleName}
+				# so taht we can see how often that object is included
+				# by a has or hasa relationship
 	}
       }
-      elsif ( $ontology eq 'object') {
+      elsif ( $ontology eq 'object') {  # if it doesn't have a RelDetail, and it is the object ontology we are querying, then its an ISA
 	# for isa, articleName is the empty string
 	$details->{$entityId}->{'articleName'} = '';
       }




More information about the MOBY-guts mailing list