Changeset 1132


Ignore:
Timestamp:
Jun 18, 2009, 2:26:04 PM (12 years ago)
Author:
Nicklas Nordborg
Message:

References #234: Proof-of-concept: run a selected GenePattern? visualization module from BASE

This is a first attempt to run a visualization module. The main procedure is work and the really hard parts (starting the visualization applet with correct parameters and support files) have been done. But don't expect this to work outside of my development machine yet.

Location:
extensions/net.sf.basedb.genepattern/trunk
Files:
6 added
4 edited

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.genepattern/trunk/META-INF/extensions.xml

    r1107 r1132  
    5959    </action-factory>
    6060  </extension>
     61  <extension
     62    id="net.sf.basedb.genepattern.visualizer"
     63    extends="net.sf.basedb.clients.web.menu.extensions"
     64    >
     65    <index>4</index>
     66    <about>
     67      <name>Visualizer test</name>
     68      <description>
     69        A simple test of a visualizer
     70      </description>
     71    </about>
     72    <action-factory>
     73      <factory-class>
     74        net.sf.basedb.clients.web.extensions.menu.FixedMenuItemFactory
     75      </factory-class>
     76      <parameters>
     77        <title>Visualizer test&amp;hellip;</title>
     78        <onClick>Main.openPopup('$HOME$/test_visualizer.jsp?ID='+getSessionId(), 'VisualizerTest', 500, 400)</onClick>
     79        <icon>~/images/genepattern.gif</icon>
     80      </parameters>
     81    </action-factory>
     82  </extension>
    6183</extensions>
  • extensions/net.sf.basedb.genepattern/trunk/META-INF/servlets.xml

    r1117 r1132  
    1010  </servlet>
    1111  <servlet>
     12    <servlet-name>Visualizer</servlet-name>
     13    <servlet-class>net.sf.basedb.genepattern.servlet.Visualizer</servlet-class>
     14  </servlet>
     15  <servlet>
    1216    <servlet-name>Test</servlet-name>
    1317    <servlet-class>net.sf.basedb.genepattern.servlet.Test</servlet-class>
  • extensions/net.sf.basedb.genepattern/trunk/src/net/sf/basedb/genepattern/wrapper/GPClient.java

    r1130 r1132  
    88import org.genepattern.webservice.AnalysisWebServiceProxy;
    99import org.genepattern.webservice.Parameter;
     10import org.genepattern.webservice.TaskIntegratorProxy;
    1011import org.genepattern.webservice.WebServiceException;
    1112
     
    3233  private AdminProxy adminProxy;
    3334  private AnalysisWebServiceProxy wsProxy;
     35  private TaskIntegratorProxy tiProxy;
    3436 
    3537  /**
     
    7678    class.
    7779  */
    78   protected AnalysisWebServiceProxy getAnalysisProxy()
     80  public AnalysisWebServiceProxy getAnalysisProxy()
    7981    throws WebServiceException
    8082  {
     
    9193    class.
    9294  */
    93   protected AdminProxy getAdminProxy()
     95  public AdminProxy getAdminProxy()
    9496    throws WebServiceException
    9597  {
     
    99101    }
    100102    return adminProxy;
     103  }
     104 
     105  public TaskIntegratorProxy getTaskIntegratorProxy()
     106    throws WebServiceException
     107  {
     108    if (tiProxy == null)
     109    {
     110      tiProxy = new TaskIntegratorProxy(gpServer, login, password);
     111    }
     112    return tiProxy;
     113   
    101114  }
    102115 
     
    137150  }
    138151
     152  public TaskInfo getTaskInfo(String module)
     153    throws WebServiceException
     154  {
     155    org.genepattern.webservice.TaskInfo gpInfo = getAdminProxy().getTask(module);
     156    return new TaskInfo(gpInfo);
     157  }
     158 
     159  public SupportFileInfo[] getSupportFiles(String module)
     160    throws WebServiceException
     161  {
     162    TaskIntegratorProxy tiProxy = getTaskIntegratorProxy();
     163   
     164    String[] fileNames = tiProxy.getSupportFileNames(module);
     165    long[] dates = tiProxy.getLastModificationTimes(module, fileNames);
     166    SupportFileInfo[] supportFiles = new SupportFileInfo[fileNames.length];
     167    for (int i = 0; i < fileNames.length; ++i)
     168    {
     169      supportFiles[i] = new SupportFileInfo(fileNames[i], dates[i]);
     170    }
     171    return supportFiles;
     172  }
     173 
     174 
    139175  /**
    140176    Get the input parameters for a module.
     
    147183    throws WebServiceException
    148184  {
    149     org.genepattern.webservice.ParameterInfo[] gpParams = getGpClient().getParameters(module);
    150     ParameterInfo[] parameters = new ParameterInfo[gpParams.length];
    151     int index = 0;
    152     for (int i = 0; i < gpParams.length; ++i)
    153     {
    154       ParameterInfo pi = new ParameterInfo(gpParams[i]);
    155       if (filter == null || filter.evaluate(pi))
    156       {
    157         parameters[index] = pi;
    158         index++;
    159       }
    160     }
    161     return parameters;
     185    TaskInfo ti = new TaskInfo(getAdminProxy().getTask(module));
     186    return ti.getParameters(filter);
    162187  }
    163188 
  • extensions/net.sf.basedb.genepattern/trunk/src/net/sf/basedb/genepattern/wrapper/TaskInfo.java

    r1115 r1132  
    11package net.sf.basedb.genepattern.wrapper;
     2
     3import net.sf.basedb.util.filter.Filter;
    24
    35/**
     
    7678    return value == null ? null : value.toString();
    7779  }
     80 
     81  public String getAttribute(String key, String defaultValue)
     82  {
     83    Object value = getGPTaskInfo().getAttributes().get(key);
     84    return value == null ? defaultValue : value.toString();
     85  }
    7886
    7987  /**
     
    95103  }
    96104 
     105  public String getOs()
     106  {
     107    return getAttribute("os", "any");
     108  }
    97109 
     110  public String getCpuType()
     111  {
     112    return getAttribute("cpuType", "any");
     113  }
     114 
     115  public String getCommandLine()
     116  {
     117    return getAttribute("commandLine");
     118  }
     119 
     120  public ParameterInfo[] getParameters(Filter<? super ParameterInfo> filter)
     121  {
     122    org.genepattern.webservice.ParameterInfo[] gpParams = gpInfo.getParameterInfoArray();
     123    ParameterInfo[] parameters = new ParameterInfo[gpParams.length];
     124    int index = 0;
     125    for (int i = 0; i < gpParams.length; ++i)
     126    {
     127      ParameterInfo pi = new ParameterInfo(gpParams[i]);
     128      if (filter == null || filter.evaluate(pi))
     129      {
     130        parameters[index] = pi;
     131        index++;
     132      }
     133    }
     134    return parameters;
     135  }
    98136 
    99137}
Note: See TracChangeset for help on using the changeset viewer.