Changeset 540


Ignore:
Timestamp:
Jan 16, 2008, 1:12:10 PM (13 years ago)
Author:
mbayer
Message:

changed code so that users can either run the wizard or import data using the old style importer

Location:
branches/uk_ac_ebi_Tab2MageImporter
Files:
6 added
5 edited

Legend:

Unmodified
Added
Removed
  • branches/uk_ac_ebi_Tab2MageImporter/jsp/uk/ac/ebi/nugo/plugins/configureImporter.jsp

    r539 r540  
    1 <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    2     pageEncoding="ISO-8859-1"%>
    3 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
     1<%@ page import="net.sf.basedb.core.*"%>
     2<%@ page import="net.sf.basedb.clients.web.*"%>
     3<%@ page import="net.sf.basedb.util.*"%>
     4<%@ page import="java.util.*"%>
     5
     6<jsp:useBean id="inputDataBean" class="uk.ac.ebi.nugo.plugins.DataBean" scope="session" />
     7<!-- submits the form data back to the bean assuming that each form element is matched to a variable in the bean by the same name -->
     8<jsp:setProperty name="inputDataBean" property="*" />
     9
     10<%
     11final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
     12final String ID = sc.getId();
     13final String requestId = request.getParameter("requestId");
     14
     15
     16  //we also need to figure out the name/id of the currently selected experiment that this import is getting initiated from
     17  ItemContext cc = sc.getCurrentContext(Item.EXPERIMENT);
     18  int experimentId = cc.getId();
     19
     20 %>
     21
     22
    423<html>
     24
    525<head>
    6 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    7 <title>Insert title here</title>
     26
     27<link rel="stylesheet" type="text/css" href="<%= request.getContextPath()%>/plugins/uk/ac/ebi/nugo/plugins/styles.css" />
     28<link rel="stylesheet" type="text/css" href="/base/include/styles/main.css">
     29<link rel="stylesheet" type="text/css" href="/base/include/styles/size_m.css">
     30
     31<script language="JavaScript" src="<%= request.getContextPath()%>/include/scripts/main.js" type="text/javascript"></script>
     32
     33<script language="JavaScript" type="text/javascript">
     34  //submits form
     35  function submit()
     36  {
     37    document.hybridizations.submit();
     38  }
     39    function getRoot()
     40    {
     41      return '/base/';
     42    }
     43    function getScale()
     44    {
     45      return 1.0;
     46    }
     47    function doImport()
     48    {
     49      var frm = document.forms['hybridizations'];
     50      if (Main.trimString(frm.path.value) == '')
     51      {
     52        alert("You must select a file to import from");
     53        frm.path.focus();
     54      }
     55      else
     56      {
     57        frm.submit();
     58      }
     59    }
     60    function browseOnClick()
     61    {
     62      var frm = document.forms['hybridizations'];
     63      var url = '<%= request.getContextPath()%>/filemanager/index.jsp?ID=<%=ID%>&cmd=SelectOne&title=Select+file+to+import&callback=setFileCallback';
     64      url += '&filter:INT:location=1';
     65      Main.openPopup(url, 'SelectFile', 1000, 700);
     66    }
     67    function setFileCallback(fileId, path)
     68    {
     69      var frm = document.forms['hybridizations'];
     70      frm.file_id.value = fileId;
     71      frm.path.value = path;
     72      document.getElementById('zipFile').value = path;
     73      }
     74    function recentFileOnChange()
     75    {
     76      var frm = document.forms['hybridizations'];
     77      var selected = frm.recentFile[frm.recentFile.selectedIndex];
     78      setFileCallback(selected.value, selected.text);
     79      frm.recentFile.selectedIndex = 0;
     80    }
     81
     82   
     83    </script>
     84
    885</head>
     86
    987<body>
    1088
    11 configureImporter.jsp
     89
     90
     91
     92
     93<form name="hybridizations"action="<%= request.getContextPath()%>/common/plugin/index.jsp" method="post">
     94<input type="hidden" name="ID" value="<%=ID%>">
     95<input type="hidden" name="cmd" value="SetParameters">
     96<input type="hidden"name="requestId" value="<%=requestId%>">
     97
     98<input type="hidden" name="file_id" value="">
     99<input type="hidden" name="parameter:zipFile" value=""  id="zipFile">
     100<input type="hidden" name="parameter:useWizard" value="yes"  id="useWizard">
     101<input type="hidden" name="parameter:experimentId" value="<%=experimentId %>"  id="experimentId">
     102
     103<h1>Tab2MAGE Import Wizard -- Select Your Data File</h1>
     104
     105<p>
     106<!--  table with the input form -->
     107<table cellpadding="15">
     108
     109  <!-- file upload -->
     110  <tr>
     111    <td class="boldText">Zip file:</td>
     112
     113    <td class="input">
     114    <table class="noBorder" border="0" cellspacing="0" cellpadding="5">
     115      <tr class="noBorder" >
     116     
     117        <td style="vertical-align: middle;border-style: none;"><input type="text" name="path" size="35" value=""></td>
     118       
     119        <td  style="vertical-align: middle;border-style: none;">
     120        <div class="buttons"
     121          onmouseover="this.className='buttons_hover';"
     122          onmouseout="this.className='buttons';"
     123          onclick="browseOnClick()">
     124        <div class="buttons_inner">
     125
     126        <table class="noBorder" cellspacing="0" cellpadding="0">
     127          <tr class="noBorder">
     128            <td style="border-style: none;">&nbsp;&nbsp;<img src="/base/images/browse.png" border="0"></td>
     129            <td style="border-style: none;">Browse&hellip;</td>
     130          </tr>
     131        </table>
     132
     133        </div>
     134        </div>
     135        </td>
     136       
     137      </tr>
     138    </table>
     139    </td>
     140
     141    <td>Please select the zip file on your local disk that contains the data files for import.
     142   All files must be of the same data format (e.g. Genepix or Affymetrix etc.).
     143   <p>
     144   The file must include a Tab2MAGE file relating to your raw data files and this must be named "tab2mage.txt".
     145   </td>
     146  </tr>
     147
     148</table>
     149
     150<p>
     151
     152  <table align="center" class="noBorder" cellspacing="5"  cellpadding="5">
     153  <tr class="noBorder">
     154    <td id="next" width="50%" style="border-style: none;"><div class="buttons" onmouseover="this.className='buttons_hover';" onmouseout="this.className='buttons';" onclick="submit()"><div class="buttons_inner"><table  class="noBorder" cellspacing="0" cellpadding="0"><tr  class="noBorder"><td style="border-style: none;"><img src="/base/images/gonext.gif" border="0"></td><td style="border-style: none;">Submit</td></tr></table></div></div></td>
     155    <td id="close" width="50%" style="border-style: none;"><div class="buttons" onmouseover="this.className='buttons_hover';" onmouseout="this.className='buttons';" onclick="window.close()"><div class="buttons_inner"><table  class="noBorder" cellspacing="0" cellpadding="0"><tr  class="noBorder"><td style="border-style: none;"><img src="/base/images/cancel.gif" border="0"></td><td style="border-style: none;">Cancel</td></tr></table></div></div></td>  </tr>
     156  </table>
     157
     158
     159</form>
    12160
    13161</body>
  • branches/uk_ac_ebi_Tab2MageImporter/jsp/uk/ac/ebi/nugo/plugins/submit.jsp

    r539 r540  
    1313
    1414<%
    15   final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
    16   final String ID = sc.getId();
    17   final String requestId = request.getParameter("requestId");
     15  SessionControl sc = Base.getExistingSessionControl(pageContext, true);
     16  String ID = sc.getId();
     17  String requestId = request.getParameter("requestId");
    1818 
    1919
     
    3838
    3939
    40 <jsp:forward page="<%= request.getContextPath()%>/common/plugin/index.jsp">
     40<jsp:forward page="/common/plugin/index.jsp">
    4141
    42 <jsp:param name="ID" value="<%=ID%>" />
    43 <jsp:param name="cmd" value="SetParameters"/>
    44 <jsp:param name="requestId" value="<%=requestId%>" />
    45 
    46 <jsp:param name="parameter:fileList" value=""/>
    47 <jsp:param name="parameter:subjectList" value=""/>
    48 <jsp:param name="parameter:tissueList" value=""/>
    4942<jsp:param name="parameter:domain" value="<%=inputDataBean.getDomain()%>" />
    5043<jsp:param name="parameter:accession" value="<%=inputDataBean.getAccession()%>" />
     
    9588<jsp:param name="parameter:mappingsMode" value="<%=inputDataBean.getMappingsMode()%>" />
    9689
     90<jsp:param name="parameter:fileList" value=""/>
     91<jsp:param name="parameter:subjectList" value=""/>
     92<jsp:param name="parameter:tissueList" value=""/>
     93
     94<jsp:param name="cmd" value="SetParameters"/>
    9795
    9896</jsp:forward>
  • branches/uk_ac_ebi_Tab2MageImporter/src/uk/ac/ebi/nugo/plugins/Tab2MageImporter.java

    r532 r540  
    6767//  =======================================================vars=================================== 
    6868
    69   //
    70   private RequestInformation configureJob;
    71   // the gui experiment type parameter
    72   private PluginParameter<Experiment> experimentParameter;
    73 
    74   // the gui zip file parameter
    75   private PluginParameter<File> fileParameter;
    76 
    77   // the gui tab2mage file name parameter
    78   private PluginParameter<String> tab2mageFileNameParameter;
    79 
    80   // the gui email server parameter
    81   private PluginParameter<String> emailHostParameter;
    82 
    83   // validation file parameter
    84   private PluginParameter<String> statusPathParameter;
    85 
    86   // boolean overwrite parameter type
    87   private BooleanParameterType overwriteType = new BooleanParameterType(false, false);
    88 
    89   // overwrite parameter
    90   private PluginParameter<Boolean> overWriteParameter;
    91 
    92   // directory parameter
    93   private PluginParameter<String> directoryParameter;
    94 
    95   // validation mode parameter
    96   private PluginParameter<Boolean> validationParameter;
     69
    9770
    9871  //holds the plugin/job config parameters
     
    10477
    10578  private static final Set<GuiContext> guiContexts = Collections.singleton(experimentItemGuiContext);
    106  
     79
    10780  //add all the parameter names to a String array for processing
    10881  static String [] paramNames = new String []{"experimentId","domain","accession","qualityControl","experimentalDesign",
    109           "experimentName","description","releaseDate","submissionDate","submitter","organization",
    110           "publicationTitle","authors","journal","volume","issue","pages","year","pubmedId","treatmentProtocol",
    111           "extractionProtocol","labelingProtocol","hybridizationProtocol","scanningProtocol",
    112           "treatmentProtocolParams","extractionProtocolParams","labelingProtocolParams",
    113           "hybridizationProtocolParams","scanningProtocolParams","platform","organism",
    114           "numDesigns","dyeSwap","refSample","numTreatmentGroups","expFactors","numReplicates",
    115           "tissues","pooling","path", "subjectNames", "fileList", "subjectList", "tissueList","useWizard",
    116           "legacyData","mappingsMode"};
    117  
     82    "experimentName","description","releaseDate","submissionDate","submitter","organization",
     83    "publicationTitle","authors","journal","volume","issue","pages","year","pubmedId","treatmentProtocol",
     84    "extractionProtocol","labelingProtocol","hybridizationProtocol","scanningProtocol",
     85    "treatmentProtocolParams","extractionProtocolParams","labelingProtocolParams",
     86    "hybridizationProtocolParams","scanningProtocolParams","platform","organism",
     87    "numDesigns","dyeSwap","refSample","numTreatmentGroups","expFactors","numReplicates",
     88    "tissues","pooling","path", "subjectNames", "fileList", "subjectList", "tissueList","useWizard",
     89    "legacyData","mappingsMode"};
     90
    11891
    11992//  =====================================================c'tor================================== 
     
    134107  private void initParams()
    135108  {   
    136        
     109
    137110    //create the parameter type - every parameter is a String
    138111    StringParameterType stringPT = new StringParameterType(255, null, true);
    139    
     112
    140113    //a list to add the parameters to
    141114    params = new LinkedList<PluginParameter<?>>();
     
    157130    System.out.println(" configure request = "  +request + ", command = " + request.getCommand());
    158131
    159    
     132
    160133    try
    161134    {
     
    178151        //requires plugin to be set up so that immediate execution is allowed
    179152        response.setExecuteImmediately("Job configuration complete", Job.ExecutionTime.SHORT,true);
    180        
     153
    181154        //set the response as done
    182155        //response.setDone("Job configuration complete", Job.ExecutionTime.SHORT);
    183        
    184        
     156
     157
    185158        //print out current values
    186159        System.out.println("=================================================================");
     
    223196  {
    224197    System.out.println("isInContext called");
    225    
     198
    226199    String message = null;
    227200    if (item == null)
     
    281254    return Plugin.MainType.IMPORT;
    282255  }
    283  
     256
    284257//  ----------------------------------------------------------------------------------------------------------------------------------------------     
    285258
     
    313286    }
    314287  }
    315  
     288
    316289
    317290//  ----------------------------------------------------------------------------------------------------------------------------------------------     
     
    353326    System.out.println("running Tab2MageImporter plugin");
    354327    System.out.println(" run request = "  +request + ", command = " + request.getCommand());
    355    
    356    
     328
     329    //check whether we are running the wizard or not
     330    String useWizard = (String)job.getValue("useWizard");
     331
    357332    DbControl dc=null;
    358333    String hostName="";
     
    367342      String tab2MageFileName= "tab2mage.txt";
    368343      String zipFileName = (String)job.getValue("zipFile");
    369      
     344
    370345      File zipFile = File.getByPath(dc, new Path(zipFileName, Path.Type.FILE), false);
    371      
     346
    372347      // figure out where the zip file is located
    373348      Directory zipFileDir = zipFile.getDirectory();
     
    385360      // save the new subDir
    386361      dc.saveItem(subDir);
    387      
    388 //      if(dc==null)
    389 //        dc = sc.newDbControl();
    390 
    391362
    392363      //get the experiment object that our data is meant to be imported into
     
    394365      String experimentId= (String)job.getValue("experimentId");
    395366      Experiment experiment= Experiment.getById(dc,Integer.parseInt(experimentId));
    396            
    397367      RawDataType rdt= experiment.getRawDataType(); // experiment platform
    398368
    399369
    400         //FILE UNZIP MODULE: unzip the files into user specified directory
    401          
     370      //FILE UNZIP MODULE: unzip the files into user specified directory
     371
    402372      ZipUnpacker importUnpacker = new ZipUnpacker(zipFile, user, sc);
    403373      importUnpacker.unpack(subDir.getName());
     
    410380      }
    411381
    412       // -- end of file unzip module
    413      
    414      
    415       ///////////////////////////////////////////////////////////////////////////////////////////////////
    416      
    417       //now write the tab2mage file to the user's home dir on the server so it can be consumed by the plugin
    418       //this takes all the inputs provided by the user on the custom interface (input.jsp)
    419       //give the file a unique name so we don't get any conflicts
    420       Tab2MageWriter t2mWriter = new Tab2MageWriter(job, dir,sc,paramNames);
    421       t2mWriter.writeTab2MageFile();
    422       t2mWriter.writeStatusFile();
     382
     383      //if we are in wizard mode, generate the tab2mage file automatically
     384      if(useWizard.equals("yes"))
     385      {
     386        //now write the tab2mage file to the user's home dir on the server so it can be consumed by the plugin
     387        //this takes all the inputs provided by the user on the custom interface (input.jsp)
     388        //give the file a unique name so we don't get any conflicts
     389        Tab2MageWriter t2mWriter = new Tab2MageWriter(job, dir,sc,paramNames);
     390        t2mWriter.writeTab2MageFile();
     391        t2mWriter.writeStatusFile();
     392      }
     393
     394
     395
    423396      File statusFile = File.getByPath(dc, new Path(dir.getPath()+"/statusReport.txt",Path.Type.FILE ), false);
    424397      System.out.println("statusFile = "+ statusFile.getPath());
    425       /////////////////////////////////////////////////////////////////////////////////////////////////
    426      
    427 
    428 
    429         //VALIDATION MODULE
     398
     399
     400
     401
     402      //VALIDATION MODULE
    430403
    431404
     
    484457
    485458
    486         //TAB2MAGE FILE IMPORT MODULE.
     459      //TAB2MAGE FILE IMPORT MODULE.
    487460
    488461      //  create annotation types
     
    524497      // -- end of Tab2Mage file import module
    525498
    526  
    527         //RAW DATA IMPORT MODULE
     499
     500      //RAW DATA IMPORT MODULE
    528501
    529502
     
    545518
    546519
    547         //EXPERIMENT CONFIGURATION AND LOADING MODULE
    548  
     520      //EXPERIMENT CONFIGURATION AND LOADING MODULE
     521
    549522      //write experiment, attaching raw bio-assays
    550523      Tab2MageExperimentWriter expWriter= new Tab2MageExperimentWriter(hibernateItemsWriter.getRbas(),sc,
     
    553526      boolean writtenExp= expWriter.LoadExperiment();
    554527      // -- end of experiment configuration and loading module
    555      
    556      
     528
     529
    557530      //dc.commit();
    558531      response.setDone("Import plugin ended successfully");
     
    567540        dc.close();
    568541    }
    569    
     542
    570543  }
    571544
Note: See TracChangeset for help on using the changeset viewer.