[MOBY-guts] biomoby commit

Sebastien Carrere carrere at pub.open-bio.org
Fri Oct 21 13:22:19 UTC 2005


carrere
Fri Oct 21 09:22:18 EDT 2005
Update of /home/repository/moby/moby-live/Perl/MOBY
In directory pub.open-bio.org:/tmp/cvs-serv1100

Modified Files:
	MOBYXSLT.pm 
Log Message:
Bug in getObjectHasaElements fixed.
This function is very usefull for new ontology.
To retrieve content (i.e. <String articleName="content"> ...</String>) of an object:

my @a_hasa_elements = &MOBYXSLT::getObjectHasaElements($article);
if ($#a_hasa_elements >= 0)
{
    foreach my $hasa_element (@a_hasa_elements)
    {
	if (&MOBYXSLT::getObjectName($hasa_element) eq 'content')
	{
	    $input_data = &MOBYXSLT::getObjectContent($hasa_element);
    	}
    }
}


moby-live/Perl/MOBY MOBYXSLT.pm,1.1,1.2
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/MOBYXSLT.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Perl/MOBY/MOBYXSLT.pm	2005/09/08 13:51:06	1.1
+++ /home/repository/moby/moby-live/Perl/MOBY/MOBYXSLT.pm	2005/10/21 13:22:18	1.2
@@ -1,10 +1,8 @@
 package MOBYXSLT;
-use strict;
-use Carp;
 
-my $TMP_DIR   = '/tmp/';                #Where your temporary files will be written
-my $XSLTPROC  = '/usr/bin/xsltproc';    #Where your xsltproc binary is located
-my $XSL_SHEET = './xsl/parseMobyMessage.xsl';#Where your xsltproc style-sheet is located
+my $TMP_DIR   = '/tmp/';#Where your temporary files will be written
+my $XSLTPROC  = '/usr/bin/xsltproc';#Where your xsltproc binary is located
+my $XSL_SHEET = '/bioinfo/www/bioinfo/services/biomoby/cgi-bin/Services/LIPM/lib/parseMobyMessage.xsl';#Where your xsltproc style-sheet is located
 
 #$Id$
 
@@ -31,8 +29,6 @@
 
 =head1 SYNOPSIS
 
-use MOBYXSLT;
-
 sub MonWebservice
 {
 
@@ -47,8 +43,8 @@
     
     foreach my $query (@{$ra_queries})
     {
-	my $query_id = MOBYXSLT::getInputID($query);#Retrieve Query ID
-	my @a_input_articles = MOBYXSLT::getArticles($query);#Retrieve articles
+        my $query_id = MOBYXSLT::getInputID($query);#Retrieve Query ID
+	    my @a_input_articles = MOBYXSLT::getArticles($query);#Retrieve articles
         
         my ($fasta_sequences, $fasta_namespace, $fasta_id)  = ('','','');
 
@@ -58,9 +54,9 @@
 
             if (MOBYXSLT::isSimpleArticle($article))
             {
-		my $object_type = MOBYXSLT::getObjectType($article);
+        		my $object_type = MOBYXSLT::getObjectType($article);
                 
-		if (IsTheCorrectType($object_type))
+        		if (IsTheCorrectType($object_type))
                 {
                         $fasta_sequences = MOBYXSLT::getObjectContent($article);
 			            $fasta_namespace = MOBYXSLT::getObjectNamespace($article);
@@ -80,10 +76,15 @@
 	######
 	#What you want to do with your data
 	######
-
+	
+	
         my $cmd ="...";
+
         system("$cmd");
 
+       	
+	
+	
 	#########
 	#Send result
 	#########
@@ -106,19 +107,16 @@
 	my $XSL_SHEET = './parseMobyMessage.xsl'; #Where your xsltproc style-sheet is located
 
     
-=head1 NOTE
-
-	Many functions have same names as those from MOBY::CommonSubs
-
-=head1 AUTHORS
+=head1 DESCRIPTION
 
-	Sebastien.Carrere at toulouse.inra.fr
-
-=head1 METHODS
+	Note: many functions have same names as those from MOBY::CommonSubs
 
 =cut
 
 
+use strict;
+use Carp;
+
 =head2 function getInputs
 
  Title        : getInputs
@@ -151,6 +149,11 @@
     close TMP;
 
     my $parsed_message = `$XSLTPROC $XSL_SHEET $TMP_DIR$tmp_file`;
+    
+#    open (PARSED, ">$TMP_DIR$tmp_file" . ".xsl");
+#    print PARSED "$XSLTPROC $XSL_SHEET $TMP_DIR$tmp_file\n\n\n";
+#    print PARSED "$parsed_message";
+#    close PARSED;
 
     my $servicenotes = '';
     my @a_queries    = ();
@@ -337,7 +340,7 @@
  Function     : Takes a simple article structure (from getArticles or getCollectedSimples)
  		and retrieve the list of "HASA" element HASHREF
  Returns      : @a_hasa_elements: ARRAY of "HASA" element HASHREF
- Args         : $rh_simple_article: simple article HASHREF structure from getArticles or getCollectedSimples
+ Args         : $rh_object: simple article HASHREF structure from getArticles or getCollectedSimples
  Globals      : none
 
 =cut
@@ -346,14 +349,37 @@
 {
     my $rh_simple_article = shift();
 
-    if ($rh_simple_article->{'object_hasa'} ne '')
+    if (defined $rh_simple_article->{'article_objects'})
     {
-        return (@{$rh_simple_article->{'object_hasa'}});
+        if ($rh_simple_article->{'article_objects'}->{'object_hasa'} ne '')
+        {
+            return (@{$rh_simple_article->{'article_objects'}->{'object_hasa'}});
+        }
+        else
+        {
+            return ();
+        }
     }
     else
     {
-        return ();
+        if ($rh_simple_article->{'object_hasa'} ne '')
+        {
+            return @{$rh_simple_article->{'object_hasa'}};
+        }
+        else
+        {
+            return ();
+        }
     }
+
+#    if ($rh_object->{'object_hasa'} ne '')
+#    {
+#       return (@{$rh_object->{'object_hasa'}});
+#    }
+#    else
+#    {
+#        return ();
+#    }
 }
 
 =head2 function getObjectType




More information about the MOBY-guts mailing list