- Timestamp:
- Jan 16, 2008, 1:12:10 PM (15 years ago)
- 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 <% 11 final SessionControl sc = Base.getExistingSessionControl(pageContext, true); 12 final String ID = sc.getId(); 13 final 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 4 23 <html> 24 5 25 <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 8 85 </head> 86 9 87 <body> 10 88 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;"> <img src="/base/images/browse.png" border="0"></td> 129 <td style="border-style: none;">Browse…</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> 12 160 13 161 </body> -
branches/uk_ac_ebi_Tab2MageImporter/jsp/uk/ac/ebi/nugo/plugins/submit.jsp
r539 r540 13 13 14 14 <% 15 finalSessionControl sc = Base.getExistingSessionControl(pageContext, true);16 finalString ID = sc.getId();17 finalString requestId = request.getParameter("requestId");15 SessionControl sc = Base.getExistingSessionControl(pageContext, true); 16 String ID = sc.getId(); 17 String requestId = request.getParameter("requestId"); 18 18 19 19 … … 38 38 39 39 40 <jsp:forward page=" <%= request.getContextPath()%>/common/plugin/index.jsp">40 <jsp:forward page="/common/plugin/index.jsp"> 41 41 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=""/>49 42 <jsp:param name="parameter:domain" value="<%=inputDataBean.getDomain()%>" /> 50 43 <jsp:param name="parameter:accession" value="<%=inputDataBean.getAccession()%>" /> … … 95 88 <jsp:param name="parameter:mappingsMode" value="<%=inputDataBean.getMappingsMode()%>" /> 96 89 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"/> 97 95 98 96 </jsp:forward> -
branches/uk_ac_ebi_Tab2MageImporter/src/uk/ac/ebi/nugo/plugins/Tab2MageImporter.java
r532 r540 67 67 // =======================================================vars=================================== 68 68 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 97 70 98 71 //holds the plugin/job config parameters … … 104 77 105 78 private static final Set<GuiContext> guiContexts = Collections.singleton(experimentItemGuiContext); 106 79 107 80 //add all the parameter names to a String array for processing 108 81 static String [] paramNames = new String []{"experimentId","domain","accession","qualityControl","experimentalDesign", 109 110 111 112 113 114 115 116 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 118 91 119 92 // =====================================================c'tor================================== … … 134 107 private void initParams() 135 108 { 136 109 137 110 //create the parameter type - every parameter is a String 138 111 StringParameterType stringPT = new StringParameterType(255, null, true); 139 112 140 113 //a list to add the parameters to 141 114 params = new LinkedList<PluginParameter<?>>(); … … 157 130 System.out.println(" configure request = " +request + ", command = " + request.getCommand()); 158 131 159 132 160 133 try 161 134 { … … 178 151 //requires plugin to be set up so that immediate execution is allowed 179 152 response.setExecuteImmediately("Job configuration complete", Job.ExecutionTime.SHORT,true); 180 153 181 154 //set the response as done 182 155 //response.setDone("Job configuration complete", Job.ExecutionTime.SHORT); 183 184 156 157 185 158 //print out current values 186 159 System.out.println("================================================================="); … … 223 196 { 224 197 System.out.println("isInContext called"); 225 198 226 199 String message = null; 227 200 if (item == null) … … 281 254 return Plugin.MainType.IMPORT; 282 255 } 283 256 284 257 // ---------------------------------------------------------------------------------------------------------------------------------------------- 285 258 … … 313 286 } 314 287 } 315 288 316 289 317 290 // ---------------------------------------------------------------------------------------------------------------------------------------------- … … 353 326 System.out.println("running Tab2MageImporter plugin"); 354 327 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 357 332 DbControl dc=null; 358 333 String hostName=""; … … 367 342 String tab2MageFileName= "tab2mage.txt"; 368 343 String zipFileName = (String)job.getValue("zipFile"); 369 344 370 345 File zipFile = File.getByPath(dc, new Path(zipFileName, Path.Type.FILE), false); 371 346 372 347 // figure out where the zip file is located 373 348 Directory zipFileDir = zipFile.getDirectory(); … … 385 360 // save the new subDir 386 361 dc.saveItem(subDir); 387 388 // if(dc==null)389 // dc = sc.newDbControl();390 391 362 392 363 //get the experiment object that our data is meant to be imported into … … 394 365 String experimentId= (String)job.getValue("experimentId"); 395 366 Experiment experiment= Experiment.getById(dc,Integer.parseInt(experimentId)); 396 397 367 RawDataType rdt= experiment.getRawDataType(); // experiment platform 398 368 399 369 400 401 370 //FILE UNZIP MODULE: unzip the files into user specified directory 371 402 372 ZipUnpacker importUnpacker = new ZipUnpacker(zipFile, user, sc); 403 373 importUnpacker.unpack(subDir.getName()); … … 410 380 } 411 381 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 423 396 File statusFile = File.getByPath(dc, new Path(dir.getPath()+"/statusReport.txt",Path.Type.FILE ), false); 424 397 System.out.println("statusFile = "+ statusFile.getPath()); 425 ///////////////////////////////////////////////////////////////////////////////////////////////// 426 427 428 429 398 399 400 401 402 //VALIDATION MODULE 430 403 431 404 … … 484 457 485 458 486 459 //TAB2MAGE FILE IMPORT MODULE. 487 460 488 461 // create annotation types … … 524 497 // -- end of Tab2Mage file import module 525 498 526 527 499 500 //RAW DATA IMPORT MODULE 528 501 529 502 … … 545 518 546 519 547 548 520 //EXPERIMENT CONFIGURATION AND LOADING MODULE 521 549 522 //write experiment, attaching raw bio-assays 550 523 Tab2MageExperimentWriter expWriter= new Tab2MageExperimentWriter(hibernateItemsWriter.getRbas(),sc, … … 553 526 boolean writtenExp= expWriter.LoadExperiment(); 554 527 // -- end of experiment configuration and loading module 555 556 528 529 557 530 //dc.commit(); 558 531 response.setDone("Import plugin ended successfully"); … … 567 540 dc.close(); 568 541 } 569 542 570 543 } 571 544
Note: See TracChangeset
for help on using the changeset viewer.