Changeset 974
- Timestamp:
- Feb 26, 2009, 10:48:02 AM (14 years ago)
- Location:
- extensions/net.sf.basedb.mev/trunk
- Files:
-
- 3 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/net.sf.basedb.mev/trunk/META-INF/extensions.xml
r666 r974 12 12 </about> 13 13 <extension 14 id="net.sf.basedb.mev.launch er"14 id="net.sf.basedb.mev.launchmev" 15 15 extends="net.sf.basedb.clients.web.bioassayset.list.tools" 16 16 > … … 19 19 <name>MEV Launcher</name> 20 20 <description> 21 Adds an action to the "Tools" column that starts M EV using Java21 Adds an action to the "Tools" column that starts MeV using Java 22 22 web start and automatically loads data from the current bioassay 23 set. 23 set. The bioassay set must have a MeV TDMS file attached to it. 24 24 </description> 25 25 </about> … … 29 29 </factory-class> 30 30 <parameters> 31 <title>Start MEV</title> 32 <tooltip>Launch MEV with data from this bioassay set</tooltip> 31 <requireMevFile>true</requireMevFile> 32 <title>Start MeV</title> 33 <tooltip>Launch MeV with data from this bioassay set</tooltip> 33 34 <onClick>MeV.launch($ID$)</onClick> 34 <icon>~/images/tm4.png</icon> 35 <icon>~/images/tm4_launch.png</icon> 36 <script>~/scripts/mev.jsp</script> 37 </parameters> 38 </action-factory> 39 </extension> 40 <extension 41 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 Launcher</name> 47 <description> 48 Adds an action to the "Tools" column that exports data to a 49 MeV TDMS file. 50 </description> 51 </about> 52 <action-factory> 53 <factory-class> 54 net.sf.basedb.mev.factory.MevButtonFactory 55 </factory-class> 56 <parameters> 57 <requireMevFile>false</requireMevFile> 58 <requireSpotData>true</requireSpotData> 59 <requireWritePermission>true</requireWritePermission> 60 <title>Generate MeV TDSM 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> 35 64 <script>~/scripts/mev.jsp</script> 36 65 </parameters> -
extensions/net.sf.basedb.mev/trunk/README
r690 r974 1 1 == Requirements == 2 2 3 1. BASE 2. 7.0 or later.3 1. BASE 2.11.0 or later. 4 4 5 5 == Introduction == … … 31 31 == Known issues == 32 32 33 * It is not possible to add more data to M EV. If you try 'File -> Load data'33 * It is not possible to add more data to MeV. If you try 'File -> Load data' 34 34 in MEV the same bioassay set will be loaded a second time. 35 35 … … 48 48 2. Type `ant download-lib` to automatically download the BASE core JAR file that 49 49 are neeed for compilation. You can also do this manually by copying the 50 BASE2Core.jar, BASE2Webclient.jar and BASE2CorePlugins.jar from51 the BASE installation directory (<basedir>/www/WEB-INF/lib/) to the50 BASE2Core.jar, BASE2Webclient.jar, BASE2CorePlugins.jar and BASE2WsClient.jar 51 from the BASE installation directory (<basedir>/www/WEB-INF/lib/) to the 52 52 ./lib/compile directory. 53 53 -
extensions/net.sf.basedb.mev/trunk/build.xml
r697 r974 23 23 <property name="javac.target" value="1.5" /> 24 24 <property name="javac.encoding" value="ISO-8859-1" /> 25 <property name="depend.jars" value="http://base2.thep.lu.se/base/jars/2. 7.0" />25 <property name="depend.jars" value="http://base2.thep.lu.se/base/jars/2.11.0" /> 26 26 27 27 <!-- set up classpath for compiling --> … … 99 99 <target 100 100 name="checkjar" 101 description="Checks that the BASE2Core.jar, BASE2Webclient.jar and BASE2CorePlugins.jar exists."101 description="Checks that the BASE2Core.jar, BASE2Webclient.jar, BASE2CorePlugins.jar and BASE2WSClient.jar exists." 102 102 > 103 103 <available classname="net.sf.basedb.core.Application" … … 107 107 <available classname="net.sf.basedb.clients.web.extensions.toolbar.FixedButtonFactory" 108 108 classpathref="classpath" property="base2web" /> 109 <available classname="net.sf.basedb.info.BioAssaySetInfo" 110 classpathref="classpath" property="base2webservice" /> 109 111 <fail unless="base2core" message="Can't find BASE2Core.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." /> 110 112 <fail unless="base2plugins" message="Can't find BASE2CorePlugins.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." /> 111 113 <fail unless="base2web" message="Can't find BASE2Webclient.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." /> 112 <echo>Found BASE2Core.jar, BASE2CorePlugins.jar and BASE2Webclient.jar.</echo> 114 <fail unless="base2webservice" message="Can't find BASE2WSClient.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." /> 115 <echo>Found BASE2Core.jar, BASE2CorePlugins.jar, BASE2Webclient.jar and BASE2WSClient.jar.</echo> 113 116 </target> 114 117 115 118 <target 116 119 name="download-lib" 117 description="Download BASE2Core.jar, BASE2Webclient.jar and BASE2CorePlugins.jar."120 description="Download BASE2Core.jar, BASE2Webclient.jar, BASE2CorePlugins.jar and BASE2WSClient.jar" 118 121 > 119 122 <echo> … … 127 130 <download-lib file="BASE2CorePlugins.jar" /> 128 131 <download-lib file="BASE2Webclient.jar" /> 132 <download-lib file="BASE2WSClient.jar" /> 129 133 </target> 130 134 -
extensions/net.sf.basedb.mev/trunk/resources/launch_mev.jsp
r666 r974 45 45 final String serverName = request.getServerName(); 46 46 final int serverPort = request.getServerPort(); 47 final String homeUrl = ExtensionsControl.getHomeUrl("net.sf.basedb.mev.launch er");47 final String homeUrl = ExtensionsControl.getHomeUrl("net.sf.basedb.mev.launchmev"); 48 48 final String fullHomeUrl = "http://" + serverName + ":" + serverPort + homeUrl; 49 49 … … 129 129 </resources> 130 130 <application-desc main-class="org.tigr.microarray.mev.TMEV"> 131 <argument>-download_url <%=fullHomeUrl%>/MevExport .servlet?ID=<%=ID%>&bioassayset_id=<%=bioAssaySetId%></argument>131 <argument>-download_url <%=fullHomeUrl%>/MevExport/<%=ID%>/<%=bioAssaySetId%>.servlet</argument> 132 132 <argument>-row <%=row_idx%></argument> 133 133 <argument>-column <%=column_idx%></argument> -
extensions/net.sf.basedb.mev/trunk/resources/others.jsp
r666 r974 33 33 final String serverName = request.getServerName(); 34 34 final int serverPort = request.getServerPort(); 35 final String homeUrl = ExtensionsControl.getHomeUrl("net.sf.basedb.mev.launch er");35 final String homeUrl = ExtensionsControl.getHomeUrl("net.sf.basedb.mev.launchmev"); 36 36 final String fullHomeUrl = "http://" + serverName + ":" + serverPort + homeUrl; 37 37 out.clearBuffer(); -
extensions/net.sf.basedb.mev/trunk/resources/scripts/mev.jsp
r666 r974 5 5 %> 6 6 <%! 7 final String homeUrl = ExtensionsControl.getHomeUrl("net.sf.basedb.mev.launch er");7 final String homeUrl = ExtensionsControl.getHomeUrl("net.sf.basedb.mev.launchmev"); 8 8 %> 9 9 var MeV = new function() … … 16 16 location.href = url; 17 17 } 18 }(); 18 19 this.createTDMS = function(bioAssaySetId) 20 { 21 var url = '<%=homeUrl%>/launch_export.jsp'; 22 url += '?ID='+getSessionId(); 23 url += '&bioassayset_id=' + bioAssaySetId; 24 Main.openPopup(url, 'CreateTDMSFile', 400, 300); 25 } 26 } 27 (); -
extensions/net.sf.basedb.mev/trunk/src/net/sf/basedb/mev/factory/MevButtonFactory.java
r722 r974 28 28 import net.sf.basedb.clients.web.extensions.toolbar.FixedButtonFactory; 29 29 import net.sf.basedb.core.BioAssaySet; 30 import net.sf.basedb.core.DataFileType; 31 import net.sf.basedb.core.DbControl; 32 import net.sf.basedb.core.File; 33 import net.sf.basedb.core.FileStoreUtil; 34 import net.sf.basedb.core.Location; 35 import net.sf.basedb.core.Permission; 36 import net.sf.basedb.util.Values; 30 37 import net.sf.basedb.util.extensions.InvokationContext; 31 38 32 39 /** 33 Button factory for creating the Luanch MeV button. This factory 34 extends the {@link FixedButtonFactory} and supports the same set 35 of parameters. This factory will only create an action if the current 40 Button factory for creating the Luanch MeV button. 41 This factory will only create an action if the current 36 42 item is a {@link BioAssaySet}. The {@link #getOnClick()} value 37 43 is scanned for the substring <code>$ID$</code> which is replaced 38 44 with the ID of the bioassay set. 45 <p> 46 This factory extends the {@link FixedButtonFactory} and supports 47 the same set of parameters as well as two conditional parameters: 48 <ul> 49 <li>requireMevFile: if set, the bioassay set is checked if a 50 MeV TDMS file is attached to it or not. See 51 {@link DataFileType#MEV_TDMS}. 52 <li>requireSpotData: if set, the bioassay set is checked if it 53 has spot data in the database. 54 </ul> 55 An action button is only created if all conditions that are 56 set evaluate to true. 39 57 40 58 @author nicklas … … 45 63 extends FixedButtonFactory 46 64 { 65 private Boolean requireMevFile; 66 private Boolean requireSpotData; 67 private Boolean requireWritePermission; 47 68 48 69 /** … … 64 85 { 65 86 BioAssaySet bas = (BioAssaySet)currentItem; 66 if (bas.getNumSpots() > 0) 87 DbControl dc = context.getClientContext().getDbControl(); 88 boolean hasMevFile = hasAccessibleMevFile(dc, bas); 89 boolean hasSpotData = bas.getNumSpots() > 0; 90 boolean hasWritePermission = bas.hasPermission(Permission.WRITE); 91 boolean createAction = true; 92 if (getRequireMevFile() != null) createAction &= getRequireMevFile() == hasMevFile; 93 if (getRequireSpotData() != null) createAction &= getRequireSpotData() == hasSpotData; 94 if (getRequireWritePermission() != null) createAction &= getRequireWritePermission() == hasWritePermission; 95 if (createAction) 67 96 { 68 97 String ID = String.valueOf(bas.getId()); … … 84 113 // ------------------------------------ 85 114 115 /** 116 @since 1.1 117 */ 118 public void setRequireMevFile(String requireMevFile) 119 { 120 this.requireMevFile = Values.getBoolean(requireMevFile); 121 } 122 123 /** 124 @since 1.1 125 */ 126 public Boolean getRequireMevFile() 127 { 128 return requireMevFile; 129 } 130 131 /** 132 @since 1.1 133 */ 134 public void setRequireSpotData(String requireSpotData) 135 { 136 this.requireSpotData = Values.getBoolean(requireSpotData); 137 } 138 139 /** 140 @since 1.1 141 */ 142 public Boolean getRequireSpotData() 143 { 144 return requireSpotData; 145 } 146 147 /** 148 @since 1.1 149 */ 150 public void setRequireWritePermission(String requireWritePermission) 151 { 152 this.requireWritePermission = Values.getBoolean(requireWritePermission); 153 } 154 155 /** 156 @since 1.1 157 */ 158 public Boolean getRequireWritePermission() 159 { 160 return requireWritePermission; 161 } 162 163 private boolean hasAccessibleMevFile(DbControl dc, BioAssaySet bas) 164 { 165 File mevFile = null; 166 try 167 { 168 mevFile = FileStoreUtil.getDataFile(dc, bas, DataFileType.MEV_TDMS); 169 if (mevFile != null) 170 { 171 if (mevFile.getLocation() != Location.PRIMARY) mevFile = null; 172 } 173 } 174 catch (Throwable t) 175 {} 176 return mevFile != null; 177 } 178 86 179 } -
extensions/net.sf.basedb.mev/trunk/src/net/sf/basedb/mev/servlet/MevExport.java
r666 r974 26 26 import net.sf.basedb.core.Application; 27 27 import net.sf.basedb.core.BioAssaySet; 28 import net.sf.basedb.core.DataFileType; 29 import net.sf.basedb.core.File; 30 import net.sf.basedb.core.FileStoreUtil; 31 import net.sf.basedb.core.ItemNotFoundException; 28 32 import net.sf.basedb.core.SessionControl; 29 33 import net.sf.basedb.core.DbControl; 30 import net.sf.basedb.plugins.BioAssaySetExporter;31 34 import net.sf.basedb.util.Values; 32 35 … … 39 42 40 43 /** 41 A servlet for exporting the spot data of a bioassayset to 42 a MeV-compatible file. The file is sent back to the requesting 43 client in the response. This servlet uses the functionality 44 in the {@link BioAssaySetExporter} to export the data. 44 A servlet for exposing the spot data of a bioassayset that already 45 exists as a MeV TDMS file attached to the bioassay set. The file is 46 sent back to the requesting client in the response. 45 47 46 48 @author Nicklas 47 49 @version 1.0 48 50 @base.modified $Date$ 49 51 */ 50 52 public final class MevExport 51 53 extends HttpServlet … … 58 60 { 59 61 // The session ID 60 final String ID = request.getParameter("ID"); 62 String ID = null; 63 // The bioassay set to export 64 int bioAssaySetId = 0; 61 65 62 // The bioassay set to export63 final int bioAssaySetId = Values.getInt(request.getParameter("bioassayset_id"));64 66 DbControl dc = null; 65 67 try 66 68 { 69 if (request.getQueryString() != null) 70 { 71 // Paremeters where given on query string: ?ID=...&bioassayset_id=... 72 ID = request.getParameter("ID"); 73 bioAssaySetId = Values.getInt(request.getParameter("bioassayset_id")); 74 } 75 else if (request.getPathInfo() != null) 76 { 77 // Parameters are given as path: /ID/bioassayset_id 78 String[] path = request.getPathInfo().split("/"); 79 ID = path[path.length-2]; 80 bioAssaySetId = Values.getInt(path[path.length-1]); 81 } 67 82 final SessionControl sc = Application.getSessionControl(ID, request.getRemoteAddr()); 68 83 69 // Load bioassay set 84 // Load bioassay set and file with MeV data 70 85 dc = sc.newDbControl(); 71 86 BioAssaySet bas = BioAssaySet.getById(dc, bioAssaySetId); 87 File mevFile = FileStoreUtil.getDataFile(dc, bas, DataFileType.MEV_TDMS); 88 89 if (mevFile == null) 90 { 91 throw new ItemNotFoundException("No MeV TDMS file found on bioassay set: " + 92 bas.getName()); 93 } 72 94 73 95 // Set up output stream 74 96 OutputStream out = response.getOutputStream(); 75 97 response.setContentType("text/plain"); 76 98 if (mevFile.getSize() < Integer.MAX_VALUE) 99 { 100 response.setContentLength((int)mevFile.getSize()); 101 } 77 102 // Do the export 78 BioAssaySetExporter exporter = new BioAssaySetExporter(); 79 exporter.exportMeV(bas, out, null); 103 mevFile.download(out, 0); 80 104 out.flush(); 81 105 out.close();
Note: See TracChangeset
for help on using the changeset viewer.