Changeset 513
- Timestamp:
- Dec 6, 2007, 1:04:50 PM (15 years ago)
- Location:
- branches/uk_ac_ebi_Tab2MageImporter
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/uk_ac_ebi_Tab2MageImporter/jsp/uk/ac/ebi/nugo/plugins/experiment.jsp
r512 r513 64 64 final String ID = sc.getId(); 65 65 final String requestID = request.getParameter("requestId"); 66 67 //we also need to figure out the name/id of the currently selected experiment that this import is getting initiated from 68 ItemContext cc = sc.getCurrentContext(Item.EXPERIMENT); 69 int experimentID = cc.getId(); 70 DbControl dc = sc.newDbControl(); 71 Experiment experiment = Experiment.getById(dc,experimentID); 72 String expName = experiment.getName(); 73 dc.close(); 74 75 //set the experiment id in the bean so we can get at it later in the plugin 76 inputDataBean.setExperimentId(new Integer(experimentID).toString()); 66 77 %> 78 79 experiment name = <%=expName %><br> 80 experiment ID = <%=experimentID %> 67 81 68 82 <h2>Tab2MAGE Importer -- Your Experiment</h2> … … 256 270 <td class="boldText">Experiment Name:</td> 257 271 <td class="input"> 258 <textarea rows="2" cols="30" name="experimentName"> my numpty experiment</textarea>272 <textarea rows="2" cols="30" name="experimentName"><%=expName %></textarea> 259 273 </td> 260 274 <td>The name you have chosen for the Experiment.</td> -
branches/uk_ac_ebi_Tab2MageImporter/jsp/uk/ac/ebi/nugo/plugins/hybridizations.jsp
r512 r513 7 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 8 <jsp:setProperty name="inputDataBean" property="*" /> 9 10 11 <html>12 <head>13 <link rel="stylesheet" type="text/css" href="<%= request.getContextPath()%>/plugins/uk/ac/ebi/nugo/plugins/styles.css" />14 </head>15 <body>16 17 9 18 10 <% … … 22 14 %> 23 15 16 17 <html> 18 19 <head> 20 21 <link rel="stylesheet" type="text/css" href="<%= request.getContextPath()%>/plugins/uk/ac/ebi/nugo/plugins/styles.css" /> 22 <link rel="stylesheet" type="text/css" href="/base/include/styles/main.css"> 23 <link rel="stylesheet" type="text/css" href="/base/include/styles/size_m.css"> 24 25 <script language="JavaScript" src="<%= request.getContextPath()%>/include/scripts/main.js" type="text/javascript"></script> 26 27 <script language="JavaScript" type="text/javascript"> 28 function getRoot() 29 { 30 return '/base/'; 31 } 32 function getScale() 33 { 34 return 1.0; 35 } 36 function doImport() 37 { 38 var frm = document.forms['hybridizations']; 39 if (Main.trimString(frm.path.value) == '') 40 { 41 alert("You must select a file to import from"); 42 frm.path.focus(); 43 } 44 else 45 { 46 frm.submit(); 47 } 48 } 49 function browseOnClick() 50 { 51 var frm = document.forms['hybridizations']; 52 var url = '<%= request.getContextPath()%>/filemanager/index.jsp?ID=<%=ID%>&cmd=SelectOne&title=Select+file+to+import&callback=setFileCallback'; 53 url += '&filter:INT:location=1'; 54 Main.openPopup(url, 'SelectFile', 1000, 700); 55 } 56 function setFileCallback(fileId, path) 57 { 58 var frm = document.forms['hybridizations']; 59 frm.file_id.value = fileId; 60 frm.path.value = path; 61 document.getElementById('zipFile').value = path; 62 } 63 function recentFileOnChange() 64 { 65 var frm = document.forms['hybridizations']; 66 var selected = frm.recentFile[frm.recentFile.selectedIndex]; 67 setFileCallback(selected.value, selected.text); 68 frm.recentFile.selectedIndex = 0; 69 } 70 71 72 </script> 73 74 </head> 75 76 <body> 77 78 79 80 24 81 <h2>Tab2MAGE Importer -- Your Hybridizations</h2> 25 82 Page 3 of 3 26 83 <p> 27 <form action="<%= request.getContextPath()%>/common/plugin/index.jsp" method="post">84 <form name="hybridizations"action="<%= request.getContextPath()%>/common/plugin/index.jsp" method="post"> 28 85 <input type="hidden" name="ID" value="<%=ID%>"> <input type="hidden" name="cmd" value="SetParameters"> 29 86 <input type="hidden"name="requestID" value="<%=requestID%>"> … … 57 114 <input type="hidden" name="parameter:hybridizationProtocolParams" value="<%=inputDataBean.getHybridizationProtocolParams()%>"> 58 115 <input type="hidden" name="parameter:scanningProtocolParams" value="<%=inputDataBean.getScanningProtocolParams()%>"> 59 60 <!-- 61 <input type="hidden" name="parameter:platform" value="<%=inputDataBean.getPlatform()%>"> 62 <input type="hidden" name="parameter:organism" value="<%=inputDataBean.getOrganism()%>"> 63 <input type="hidden" name="parameter:numDesigns" value="<%=inputDataBean.getNumDesigns()%>"> 64 <input type="hidden" name="parameter:dyeSwap" value="<%=inputDataBean.getDyeSwap()%>"> 65 <input type="hidden" name="parameter:refSample" value="<%=inputDataBean.getRefSample()%>"> 66 <input type="hidden" name="parameter:numTreatments" value="<%=inputDataBean.getNumTreatments()%>"> 67 <input type="hidden" name="parameter:expFactors" value="<%=inputDataBean.getExpFactors()%>"> 68 <input type="hidden" name="parameter:numReplicates" value="<%=inputDataBean.getNumReplicates()%>"> 69 <input type="hidden" name="parameter:tissues" value="<%=inputDataBean.getTissues()%>"> 70 <input type="hidden" name="parameter:pooling" value="<%=inputDataBean.getPooling()%>"> 71 <input type="hidden" name="parameter:zipFile" value="<%=inputDataBean.getZipFile()%>"> 72 --> 116 <input type="hidden" name="parameter:experimentId" value="<%=inputDataBean.getExperimentId()%>"> 117 118 <input type="hidden" name="file_id" value=""> 119 <input type="hidden" name="parameter:zipFile" value="" id="zipFile"> 120 73 121 74 122 <!-- table with the input form --> … … 79 127 <td class="boldText">Microarray platform used:</td> 80 128 <td class="input"><select name="parameter:platform"> 81 <option >Genepix</option>82 129 <option >Affymetrix</option> 130 <option >Agilent</option> 131 <option >AIDA</option> 132 <option >BZScan</option> 133 <option >ChipSkipper</option> 134 <option >GenePix</option> 135 <option >GeneTAC</option> 136 <option >Illumina</option> 137 <option >Imagene</option> 138 <option >QuantArray Biotin</option> 139 <option >QuantArray Cy</option> 140 <option >Spotfinder</option> 83 141 </select></td> 84 142 </tr> … … 154 212 <tr> 155 213 <td class="boldText">Please select the zip file on your local disk that contains the data files for import:</td> 156 <td class="input"><INPUT type="file" name="parameter:zipFile" size="50" value="test.txt"></td> 157 </tr> 214 215 <td> 216 <table border="0" cellspacing="0" cellpadding="0"> 217 <tr> 218 <td><input type="text" class="text required" name="path" size="50" value=""> </td> 219 <td> 220 <div class="buttonclass" onmouseover="this.className='buttonclass_hover';" 221 onmouseout="this.className='buttonclass';" onclick="browseOnClick()"> 222 223 <table border="0" cellspacing="0" cellpadding="0" class="noBorder"> 224 <tr class="noBorder"> 225 <td class="centered"><img src="/base/images/browse.png" border="0"></td> 226 <td>Browse…</td> 227 </tr> 228 </table> 229 230 </div> 231 </td> 232 233 </tr> 234 </table> 235 </td> 236 </tr> 237 238 158 239 159 240 </table> -
branches/uk_ac_ebi_Tab2MageImporter/jsp/uk/ac/ebi/nugo/plugins/styles.css
r511 r513 55 55 text-align: center; 56 56 align: center; 57 vertical-align: top; 57 58 } 58 59 -
branches/uk_ac_ebi_Tab2MageImporter/src/uk/ac/ebi/nugo/plugins/DataBean.java
r512 r513 43 43 String pooling; 44 44 String zipFile; 45 String experimentId; 45 46 46 47 … … 356 357 { 357 358 this.zipFile = zipFile; 359 } 360 public String getExperimentId() 361 { 362 return experimentId; 363 } 364 public void setExperimentId(String experimentId) 365 { 366 this.experimentId = experimentId; 358 367 } 359 368 -
branches/uk_ac_ebi_Tab2MageImporter/src/uk/ac/ebi/nugo/plugins/Tab2MageImporter.java
r512 r513 9 9 import java.io.InputStream; 10 10 import java.util.Arrays; 11 import java.util.Calendar; 11 12 import java.util.Collections; 12 13 import java.util.LinkedList; … … 25 26 import net.sf.basedb.core.Item; 26 27 import net.sf.basedb.core.Job; 28 import net.sf.basedb.core.Path; 27 29 import net.sf.basedb.core.PluginConfigurationRequest; 28 30 import net.sf.basedb.core.PluginParameter; … … 41 43 import net.sf.basedb.core.plugin.Request; 42 44 import net.sf.basedb.core.plugin.Response; 45 import net.sf.basedb.util.formatter.DateFormatter; 43 46 import uk.ac.ebi.nugo.common.Helper; 44 47 import uk.ac.ebi.nugo.common.ZipUnpacker; … … 101 104 102 105 private static final Set<GuiContext> guiContexts = Collections.singleton(experimentItemGuiContext); 106 103 107 104 108 // =====================================================c'tor================================== … … 120 124 { 121 125 //add all the parameter names to a String array for processing 122 String [] paramNames = new String []{" domain","accession","qualityControl","experimentalDesign",126 String [] paramNames = new String []{"experimentId","domain","accession","qualityControl","experimentalDesign", 123 127 "experimentName","description","releaseDate","submissionDate","submitter","organization", 124 128 "publicationTitle","authors","journal","volume","issue","pages","year","pubmedId","treatmentProtocol", … … 129 133 "tissues","pooling","zipFile"}; 130 134 131 // next create the parameter type 135 // next create the parameter type - everyone is a String here 132 136 StringParameterType stringPT = new StringParameterType(255, null, true); 133 137 … … 188 192 } 189 193 } 190 catch (Throwable ex) 191 { 194 catch (Exception ex) 195 { 196 System.out.println("exception in configure method"); 192 197 ex.printStackTrace(); 193 response.setError(ex.getMessage(), Arrays.asList(ex));198 //response.setError(ex.getMessage(), Arrays.asList(ex)); 194 199 } 195 200 … … 213 218 public String isInContext(GuiContext context, Object item) 214 219 { 220 System.out.println("isInContext called"); 221 215 222 String message = null; 216 223 if (item == null) … … 224 231 } 225 232 else 226 { 227 Experiment exp = (Experiment) 228 RawDataType rawDataType = exp.getRawDataType(); 233 { 234 Experiment exp = (Experiment)item; 235 RawDataType rawDataType = exp.getRawDataType(); 229 236 if (!Tab2MageHelper.supportedPlatforms(rawDataType.getId().toLowerCase())) 230 237 { … … 342 349 System.out.println("running Tab2MageImporter plugin"); 343 350 response.setDone("Import plugin ended successfully"); 344 /* 351 345 352 346 353 DbControl dc=null; … … 354 361 User user= User.getById(dc, sc.getLoggedInUserId()); 355 362 356 357 //obtain all job parameters 358 359 File file = (File) job.getValue("file"); 360 file= File.getById(dc, file.getId()); 361 362 String directoryName = (String)job.getValue("directory"); 363 364 String tab2MageFileName= (String) job.getValue("tab2mageFileName"); 365 hostName= (String) job.getValue("emailHost"); 366 367 if ((Boolean)job.getValue("overwrite") != null) overwrite = (Boolean)job.getValue("overwrite"); 368 if ((Boolean)job.getValue("validation") != null) validation = (Boolean)job.getValue("validation"); 369 370 Experiment experiment= (Experiment)job.getValue("experiment"); 371 experiment= Experiment.getById(dc,experiment.getId()); 363 String tab2MageFileName= "tab2mage.txt"; 364 String zipFileName = (String)job.getValue("zipFile"); 365 366 File zipFile = File.getByPath(dc, new Path(zipFileName, Path.Type.FILE), false); 367 368 // figure out where the zip file is located 369 Directory zipFileDir = zipFile.getDirectory(); 370 System.out.println("zipFile is located in dir " + zipFileDir.toString()); 371 372 // make a new subdir in that dir 373 // the zip file should then be unzipped in here 374 // give it the same name as that of the zip file plus a timestamp 375 String timeStamp = new DateFormatter("ddMMyy_HHmmss").format(Calendar.getInstance().getTime()); 376 Directory subDir = Directory.getNew(dc, zipFileDir); 377 String fileNameNoExt = zipFile.getName().substring(0, zipFile.getName().indexOf(".")); 378 System.out.println("new subDir = " + fileNameNoExt + timeStamp); 379 subDir.setName(fileNameNoExt + timeStamp); 380 381 // save the new subDir 382 dc.saveItem(subDir); 383 384 // String directoryName = (String)job.getValue("directory"); 385 // hostName= (String) job.getValue("emailHost"); 386 // if ((Boolean)job.getValue("overwrite") != null) overwrite = (Boolean)job.getValue("overwrite"); 387 // if ((Boolean)job.getValue("validation") != null) validation = (Boolean)job.getValue("validation"); 388 389 //get the experiment object that our data is meant to be imported into 390 //this will be the experiment that the user is running the import from 391 String experimentId= (String)job.getValue("experimentId"); 392 Experiment experiment= Experiment.getById(dc,Integer.parseInt(experimentId)); 393 372 394 RawDataType rdt= experiment.getRawDataType(); // experiment platform 373 395 374 String statusp=(String)job.getValue("statusPath");375 File statusFile=Helper.processFilePath(user,overwrite, sc,statusp);396 // String statusp=(String)job.getValue("statusPath"); 397 // File statusFile=Helper.processFilePath(user,overwrite, sc,statusp); 376 398 377 399 //FILE UNZIP MODULE: unzip the files into user specified directory 378 400 379 ZipUnpacker importUnpacker = new ZipUnpacker( file, user, sc);380 importUnpacker.unpack( directoryName);401 ZipUnpacker importUnpacker = new ZipUnpacker(zipFile, user, sc); 402 importUnpacker.unpack(subDir.getName()); 381 403 Directory dir= importUnpacker.getUnzippedFilesDirectory(); // this may return the id of the unzipped file directory instead 382 404 if (dir==null) … … 396 418 //use code from tab2mage exporter to do so 397 419 420 //PluginConfigurationRequest pcRequest = (PluginConfigurationRequest) sc.getSessionSetting("plugin.configure.request"); 421 Tab2MageWriter t2mWriter = new Tab2MageWriter(request, dir,dc); 422 t2mWriter.writeTab2MageFile(); 423 424 398 425 ///////////////////////////////////////////////////////////////////////////////////////////////// 399 426 400 427 /* 401 428 402 429 //VALIDATION MODULE … … 539 566 } 540 567 // -- end of messaging module 541 568 */ 542 569 dc.commit(); 543 570 response.setDone("Import plugin ended successfully"); … … 553 580 } 554 581 555 */582 556 583 557 584 }
Note: See TracChangeset
for help on using the changeset viewer.