Changeset 1083
- Timestamp:
- May 18, 2009, 2:19:18 PM (14 years ago)
- Location:
- extensions/net.sf.basedb.mev/trunk
- Files:
-
- 2 added
- 2 deleted
- 5 edited
- 1 copied
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
extensions/net.sf.basedb.mev/trunk/META-INF/extensions.xml
r1068 r1083 29 29 </factory-class> 30 30 <parameters> 31 <require MevFile>true</requireMevFile>31 <requireSpotData>true</requireSpotData> 32 32 <title>Start MeV</title> 33 <tooltip>Launch MeV with data from this bioassay set</tooltip> 33 <tooltip> 34 Launch MeV with data from this bioassay set. If 35 you have not yet created any MeV file you will be 36 given the option to do so. 37 </tooltip> 34 38 <onClick>MeV.launch($ID$)</onClick> 35 39 <icon>~/images/tm4_launch.png</icon> 36 <script>~/scripts/mev.jsp</script>37 </parameters>38 </action-factory>39 </extension>40 <extension41 id="net.sf.basedb.mev.launchexport"42 extends="net.sf.basedb.clients.web.bioassayset.list.tools"43 >44 <index>2</index>45 <about>46 <name>MeV TDMS Export</name>47 <description>48 Adds an action to the "Tools" column that exports data to a49 MeV TDMS file.50 </description>51 </about>52 <action-factory>53 <factory-class>54 net.sf.basedb.mev.factory.MevButtonFactory55 </factory-class>56 <parameters>57 <requireMevFile>false</requireMevFile>58 <requireSpotData>true</requireSpotData>59 <requireWritePermission>true</requireWritePermission>60 <title>Generate MeV TDMS file</title>61 <tooltip>Create a MeV TDMS file from the data in this bioassay set</tooltip>62 <onClick>MeV.createTDMS($ID$)</onClick>63 <icon>~/images/tm4_export.png</icon>64 40 <script>~/scripts/mev.jsp</script> 65 41 </parameters> -
extensions/net.sf.basedb.mev/trunk/resources/launch_mev.jsp
r1070 r1083 31 31 import="net.sf.basedb.core.Experiment" 32 32 import="net.sf.basedb.core.Directory" 33 import="net.sf.basedb.core.File" 33 34 import="net.sf.basedb.core.User" 34 35 import="net.sf.basedb.core.DbControl" … … 36 37 import="net.sf.basedb.core.ItemContext" 37 38 import="net.sf.basedb.core.Item" 39 import="net.sf.basedb.core.Include" 40 import="net.sf.basedb.core.Permission" 38 41 import="net.sf.basedb.core.Path" 42 import="net.sf.basedb.core.FileStoreUtil" 43 import="net.sf.basedb.core.ItemQuery" 44 import="net.sf.basedb.core.PluginConfiguration" 45 import="net.sf.basedb.core.query.Restrictions" 46 import="net.sf.basedb.core.query.Expressions" 47 import="net.sf.basedb.core.query.Hql" 48 import="net.sf.basedb.core.query.Orders" 39 49 import="net.sf.basedb.clients.web.Base" 40 50 import="net.sf.basedb.clients.web.util.HTML" 41 51 import="net.sf.basedb.clients.web.extensions.ExtensionsControl" 42 52 import="net.sf.basedb.util.Values" 53 import="java.util.List" 43 54 %> 44 55 <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> … … 47 58 final String ID = sc.getId(); 48 59 final int bioAssaySetId = Values.getInt(request.getParameter("bioassayset_id")); 49 final String title = "Create MeV TDMS file?"; 60 final String title = "Launch MeV"; 61 final String homeUrl = ExtensionsControl.getHomeUrl("net.sf.basedb.mev.launchmev"); 62 final String root = request.getContextPath()+"/"; 63 50 64 DbControl dc = null; 51 65 String defaultPath = "/"; 52 String defaultFileName = ""; 53 String jobName = "Create MeV TDMS file"; 66 54 67 try 55 68 { … … 58 71 ItemContext cc = sc.getCurrentContext(Item.BIOASSAYSET); 59 72 cc.setId(bioAssaySetId); 60 defaultFileName = Path.makeSafeFilename(bas.getName() + "-" + bas.getId() + ".tdms.txt", ""); 61 jobName += " for " + bas.getName(); 73 74 // Get the current files 75 File tdmsFile = FileStoreUtil.getDataFile(dc, bas, "mev.tdms"); 76 File cghFile = FileStoreUtil.getDataFile(dc, bas, "mev.cgh"); 77 boolean allowCreateFile = bas.hasPermission(Permission.WRITE) 78 && sc.hasPermission(Permission.CREATE, Item.FILE); 79 80 // Get the avilable CGH export configurations 81 ItemQuery<PluginConfiguration> cghQuery = PluginConfiguration.getQuery(); 82 cghQuery.restrict(Restrictions.eq( 83 Hql.property("pluginDefinition.className"), 84 Expressions.string("net.sf.basedb.mev.plugin.CghExporterPlugin"))); 85 cghQuery.order(Orders.asc(Hql.property("name"))); 86 cghQuery.include(Include.MINE, Include.IN_PROJECT, Include.SHARED, Include.OTHERS); 87 List<PluginConfiguration> cghConfigurations = cghQuery.list(dc); 88 boolean canCreateCGHFile = cghConfigurations.size() > 0; 89 90 // Default names of export files and export jobs 91 String defaultTdmsFileName = Path.makeSafeFilename(bas.getName() + "-" + bas.getId() + ".tdms.txt", ""); 92 String defaultCghFileName = Path.makeSafeFilename(bas.getName() + "-" + bas.getId() + ".cgh.txt", ""); 93 String tdmsJobName = "Create TDMS file for " + bas.getName(); 94 String cghJobName = "Create CGH file for " + bas.getName(); 95 96 // Default home directory of either experiment or user 62 97 try 63 98 { … … 76 111 catch (Throwable t) 77 112 {} 78 113 %> 114 <base:page type="popup" title="<%=title%>"> 115 <base:head> 116 <script language="JavaScript"> 117 function launchMev(fileType) 118 { 119 var url = 'mev_jnlp.jsp?ID=<%=ID%>&bioassayset_id=<%=bioAssaySetId%>'; 120 url += '&filetype=' + fileType; 121 window.opener.location.href = url; 122 window.close(); 123 } 124 function exportTdms() 125 { 126 var url = getRoot()+'common/plugin/index.jsp?ID='+getSessionId(); 127 url += '&cmd=NewJob&plugin_class=net.sf.basedb.mev.plugin.TdmsExporterPlugin'; 128 url += '&item_type=BIOASSAYSET&context_type=ITEM'; 129 url += '&job_name=' + encodeURIComponent('<%=HTML.javaScriptEncode(tdmsJobName)%>'); 130 url += '¶meter:saveAs='+encodeURIComponent('<%=HTML.javaScriptEncode(defaultPath+defaultTdmsFileName)%>'); 131 url += '¶meter:attachToBioAssaySet=true'; 132 Main.openPopup(url, 'CreateTDMSFile', 740, 540); 133 window.close(); 134 } 135 function exportCgh() 136 { 137 var frm = document.forms['mev']; 138 var url = getRoot()+'common/plugin/index.jsp?ID='+getSessionId(); 139 url += '&cmd=NewJob&plugin_class=net.sf.basedb.mev.plugin.CghExporterPlugin'; 140 url += '&pluginconfiguration_id=' + frm.cgh_configuration[frm.cgh_configuration.selectedIndex].value; 141 url += '&item_type=BIOASSAYSET&context_type=ITEM'; 142 url += '&job_name=' + encodeURIComponent('<%=HTML.javaScriptEncode(cghJobName)%>'); 143 url += '¶meter:saveAs='+encodeURIComponent('<%=HTML.javaScriptEncode(defaultPath+defaultCghFileName)%>'); 144 url += '¶meter:attachToBioAssaySet=true'; 145 Main.openPopup(url, 'CreateCGHFile', 740, 540); 146 window.close(); 147 } 148 </script> 149 </base:head> 150 <base:body> 151 152 <form name="mev"> 153 <h3><%=title%></h3> 154 <div class="boxedbottom"> 155 <table class="form"> 156 <tr> 157 <td class="prompt" colspan="2">TDMS - Tab-delimited multiple sample</td> 158 </tr> 159 <tr> 160 <td><base:button title="Start MeV" 161 onclick="launchMev('mev.tdms')" 162 image="<%=tdmsFile == null ? homeUrl + "/images/tm4_disabled.png" : homeUrl + "/images/tm4.png" %>" 163 disabled="<%=tdmsFile == null%>"/></td> 164 <td> 165 <% 166 if (tdmsFile == null) 167 { 168 %> 169 There is currently no TDMS file associated with the bioassay set. 170 <% 171 } 172 else 173 { 174 %> 175 Start MeV with the current TDMS file:<br> 176 <%=HTML.encodeTags(tdmsFile.getName())%> <%=Base.getFileLinks(ID, tdmsFile, root) %> 177 <% 178 } 179 %> 180 </td> 181 </tr> 182 <tr> 183 <td><base:button title="Export" 184 onclick="exportTdms()" 185 disabled="<%=!allowCreateFile%>" 186 image="<%=allowCreateFile ? "export.gif" : homeUrl + "/images/export_disabled.gif"%>" /></td> 187 <td> 188 <% 189 if (allowCreateFile) 190 { 191 %> 192 Export the spot data to a MeV TDMS file that can be opened with MeV. 193 <% 194 } 195 else 196 { 197 %> 198 You don't have enough permissions to create a MeV TDSM file. 199 <% 200 } 201 %> 202 </td> 203 </tr> 204 <tr> 205 <td class="prompt" colspan="2">CGH - Comparative genomics hybridization</td> 206 </tr> 207 <tr> 208 <td><base:button title="Start MeV" 209 onclick="launchMev('mev.cgh')" 210 image="<%=tdmsFile == null ? homeUrl + "/images/tm4_disabled.png" : homeUrl + "/images/tm4.png" %>" 211 disabled="<%=cghFile == null%>"/></td> 212 <td> 213 <% 214 if (cghFile == null) 215 { 216 %> 217 There is currently no CGH file associated with the bioassay set. 218 <% 219 } 220 else 221 { 222 %> 223 Start MeV with the current CGH file:<br> 224 <%=HTML.encodeTags(cghFile.getName())%> <%=Base.getFileLinks(ID, cghFile, root) %> 225 <% 226 } 227 %> 228 </td> 229 </tr> 230 <tr> 231 <td><base:button title="Export" 232 onclick="exportCgh()" 233 disabled="<%=!canCreateCGHFile%>" 234 image="<%=canCreateCGHFile ? "export.gif" : homeUrl + "/images/export_disabled.gif"%>" /></td> 235 <td> 236 <% 237 if (canCreateCGHFile) 238 { 239 %> 240 Export the spot data to a MeV CGH file that can be opened with MeV. 241 <% 242 } 243 else 244 { 245 %> 246 You don't have enough permissions to create a MeV CGH file. 247 <% 248 } 249 %> 250 </td> 251 </tr> 252 <% 253 if (canCreateCGHFile) 254 { 255 %> 256 <tr> 257 <td style="text-align: right;">-configuration</td> 258 <td> 259 <select name="cgh_configuration"> 260 <% 261 for (PluginConfiguration cfg : cghConfigurations) 262 { 263 %> 264 <option value="<%=cfg.getId()%>"><%=HTML.encodeTags(cfg.getName())%> 265 <% 266 } 267 %> 268 </select> 269 </td> 270 </tr> 271 <% 272 } 273 %> 274 </table> 275 </div> 276 </form> 277 278 <table align="center"> 279 <tr> 280 <td><base:button onclick="window.close();" title="Close" /></td> 281 </tr> 282 </table> 283 284 </base:body> 285 </base:page> 286 <% 79 287 } 80 288 finally … … 83 291 } 84 292 %> 85 <base:page type="popup" title="<%=title%>">86 <base:head>87 <script language="JavaScript">88 function createTDMS()89 {90 var url = getRoot()+'common/plugin/index.jsp?ID='+getSessionId();91 url += '&cmd=NewJob&plugin_class=net.sf.basedb.mev.plugin.TdmsExporterPlugin';92 url += '&item_type=BIOASSAYSET&context_type=ITEM';93 url += '&job_name=' + encodeURIComponent('<%=jobName%>');94 url += '¶meter:saveAs='+encodeURIComponent('<%=HTML.javaScriptEncode(defaultPath+defaultFileName)%>');95 url += '¶meter:attachToBioAssaySet=true';96 Main.openPopup(url, 'CreateTDMSFile2', 740, 540);97 window.close();98 }99 </script>100 </base:head>101 <base:body>102 103 <base:note type="question" title="<%=title%>">104 The selected bioassay is not associated with a MeV TDMS file.105 Do you wish to create one with the MeV TDMS exporter plug-in?106 <br><br>107 </base:note>108 <p>109 <table align="center">110 <tr>111 <td width="50%"><base:button onclick="createTDMS()" title="Yes" /></td>112 <td width="50%"><base:button onclick="window.close()" title="No" /></td>113 </tr>114 </table>115 </div>116 117 </base:body>118 </base:page> -
extensions/net.sf.basedb.mev/trunk/resources/mev_jnlp.jsp
r1028 r1083 40 40 final String ID = sc.getId(); 41 41 final int bioAssaySetId = Values.getInt(request.getParameter("bioassayset_id")); 42 final String fileType = Values.getString(request.getParameter("filetype")); 43 final String mevFileType = "mev.cgh".equals(fileType) ? "cgh" : "tdms"; 42 44 final String scheme = request.getScheme(); 43 45 final String serverName = request.getServerName(); … … 121 123 <application-desc main-class="org.tigr.microarray.mev.TMEV"> 122 124 <argument>-fileType</argument> 123 <argument> tdms</argument>125 <argument><%=mevFileType%></argument> 124 126 <argument>-fileUrl</argument> 125 <argument><%=fullHomeUrl%>/MevExport/<%=ID%>/<%=bioAssaySetId%> .servlet</argument>127 <argument><%=fullHomeUrl%>/MevExport/<%=ID%>/<%=bioAssaySetId%>/<%=fileType%>.servlet</argument> 126 128 </application-desc> 127 129 </jnlp> -
extensions/net.sf.basedb.mev/trunk/resources/scripts/mev.jsp
r1069 r1083 15 15 url += '?ID='+getSessionId(); 16 16 url += '&bioassayset_id=' + bioAssaySetId; 17 location.href = url; 18 } 19 20 this.createTDMS = function(bioAssaySetId) 21 { 22 var url = '<%=homeUrl%>/launch_export.jsp'; 23 url += '?ID='+getSessionId(); 24 url += '&bioassayset_id=' + bioAssaySetId; 25 Main.openPopup(url, 'CreateTDMSFile', 400, 300); 17 Main.openPopup(url, 'LaunchMev', 500, 340); 26 18 } 27 19 -
extensions/net.sf.basedb.mev/trunk/src/net/sf/basedb/mev/factory/MevButtonFactory.java
r974 r1083 63 63 extends FixedButtonFactory 64 64 { 65 private BooleanrequireMevFile;65 private String requireMevFile; 66 66 private Boolean requireSpotData; 67 67 private Boolean requireWritePermission; … … 86 86 BioAssaySet bas = (BioAssaySet)currentItem; 87 87 DbControl dc = context.getClientContext().getDbControl(); 88 boolean hasMevFile = hasAccessibleMevFile(dc, bas);89 88 boolean hasSpotData = bas.getNumSpots() > 0; 90 89 boolean hasWritePermission = bas.hasPermission(Permission.WRITE); 91 90 boolean createAction = true; 92 if (getRequireMevFile() != null) createAction &= getRequireMevFile() == hasMevFile;91 if (getRequireMevFile() != null) createAction &= hasAccessibleMevFile(dc, bas, getRequireMevFile()); 93 92 if (getRequireSpotData() != null) createAction &= getRequireSpotData() == hasSpotData; 94 93 if (getRequireWritePermission() != null) createAction &= getRequireWritePermission() == hasWritePermission; … … 114 113 115 114 /** 116 @since 1. 1115 @since 1.3 117 116 */ 118 117 public void setRequireMevFile(String requireMevFile) 119 118 { 120 this.requireMevFile = Values.getBoolean(requireMevFile);119 this.requireMevFile = requireMevFile; 121 120 } 122 121 123 122 /** 124 @since 1. 1123 @since 1.3 125 124 */ 126 public BooleangetRequireMevFile()125 public String getRequireMevFile() 127 126 { 128 127 return requireMevFile; … … 161 160 } 162 161 163 private boolean hasAccessibleMevFile(DbControl dc, BioAssaySet bas )162 private boolean hasAccessibleMevFile(DbControl dc, BioAssaySet bas, String fileType) 164 163 { 165 164 File mevFile = null; 166 165 try 167 166 { 168 mevFile = FileStoreUtil.getDataFile(dc, bas, DataFileType.MEV_TDMS);167 mevFile = FileStoreUtil.getDataFile(dc, bas, fileType); 169 168 if (mevFile != null) 170 169 { -
extensions/net.sf.basedb.mev/trunk/src/net/sf/basedb/mev/plugin/CghExporterPlugin.java
r1082 r1083 361 361 Config.getCharset())); 362 362 parameters.add(getOverwriteParameter(null, null)); 363 if (checkCghFileType(dc) == null)363 if (checkCghFileType(dc) != null) 364 364 { 365 365 parameters.add(new PluginParameter<Boolean>( -
extensions/net.sf.basedb.mev/trunk/src/net/sf/basedb/mev/servlet/MevExport.java
r974 r1083 26 26 import net.sf.basedb.core.Application; 27 27 import net.sf.basedb.core.BioAssaySet; 28 import net.sf.basedb.core.DataFileType;29 28 import net.sf.basedb.core.File; 30 29 import net.sf.basedb.core.FileStoreUtil; … … 32 31 import net.sf.basedb.core.SessionControl; 33 32 import net.sf.basedb.core.DbControl; 33 import net.sf.basedb.mev.Mev; 34 34 import net.sf.basedb.util.Values; 35 35 … … 63 63 // The bioassay set to export 64 64 int bioAssaySetId = 0; 65 65 // The file type to look for 66 String fileType = Mev.TDMS_FILE; 66 67 DbControl dc = null; 67 68 try … … 69 70 if (request.getQueryString() != null) 70 71 { 71 // Paremeters where given on query string: ?ID=...&bioassayset_id=... 72 // Paremeters where given on query string: ?ID=...&bioassayset_id=...&filetype=... 72 73 ID = request.getParameter("ID"); 73 74 bioAssaySetId = Values.getInt(request.getParameter("bioassayset_id")); 75 fileType = Values.getString(request.getParameter("filetype"), fileType); 74 76 } 75 77 else if (request.getPathInfo() != null) 76 78 { 77 // Parameters are given as path: /ID/bioassayset_id 79 // Parameters are given as path: /ID/bioassayset_id/filetype 78 80 String[] path = request.getPathInfo().split("/"); 79 ID = path[path.length-2]; 80 bioAssaySetId = Values.getInt(path[path.length-1]); 81 } 81 ID = path[path.length-3]; 82 bioAssaySetId = Values.getInt(path[path.length-2]); 83 fileType = path[path.length-1]; 84 } 82 85 final SessionControl sc = Application.getSessionControl(ID, request.getRemoteAddr()); 83 86 … … 85 88 dc = sc.newDbControl(); 86 89 BioAssaySet bas = BioAssaySet.getById(dc, bioAssaySetId); 87 File mevFile = FileStoreUtil.getDataFile(dc, bas, DataFileType.MEV_TDMS);90 File mevFile = FileStoreUtil.getDataFile(dc, bas, fileType); 88 91 89 92 if (mevFile == null) 90 93 { 91 throw new ItemNotFoundException("No MeV TDMSfile found on bioassay set: " +94 throw new ItemNotFoundException("No " + fileType + " file found on bioassay set: " + 92 95 bas.getName()); 93 96 }
Note: See TracChangeset
for help on using the changeset viewer.