1 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> |
---|
2 | <%@ page import="java.util.*"%> |
---|
3 | <%@ page import="java.util.zip.*"%> |
---|
4 | <%@ page import="net.sf.basedb.core.*"%> |
---|
5 | <%@ page import="net.sf.basedb.clients.web.*"%> |
---|
6 | <%@ page import="net.sf.basedb.util.*"%> |
---|
7 | <%@ page import="uk.ac.ebi.nugo.plugins.*"%> |
---|
8 | |
---|
9 | <jsp:useBean id="inputDataBean" class="uk.ac.ebi.nugo.plugins.DataBean" scope="application" /> |
---|
10 | <!-- 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 --> |
---|
11 | <jsp:setProperty name="inputDataBean" property="*" /> |
---|
12 | |
---|
13 | <% |
---|
14 | final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
---|
15 | final String ID = sc.getId(); |
---|
16 | final String requestID = request.getParameter("requestId"); |
---|
17 | %> |
---|
18 | |
---|
19 | <html> |
---|
20 | |
---|
21 | <head> |
---|
22 | |
---|
23 | <link rel="stylesheet" type="text/css" href="<%= request.getContextPath()%>/plugins/uk/ac/ebi/nugo/plugins/styles.css" /> |
---|
24 | <link rel="stylesheet" type="text/css" href="/base/include/styles/main.css"> |
---|
25 | <link rel="stylesheet" type="text/css" href="/base/include/styles/size_m.css"> |
---|
26 | |
---|
27 | <script language="JavaScript" src="<%= request.getContextPath()%>/include/scripts/main.js" type="text/javascript"></script> |
---|
28 | <script language="JavaScript" type="text/javascript"> |
---|
29 | //submits form |
---|
30 | function submit() |
---|
31 | { |
---|
32 | document.mappings.submit(); |
---|
33 | } |
---|
34 | function getRoot() |
---|
35 | { |
---|
36 | return '/base/'; |
---|
37 | } |
---|
38 | function getScale() |
---|
39 | { |
---|
40 | return 1.0; |
---|
41 | } |
---|
42 | </script> |
---|
43 | |
---|
44 | </head> |
---|
45 | |
---|
46 | <body> |
---|
47 | |
---|
48 | |
---|
49 | |
---|
50 | <form name="mappings" action="<%= request.getContextPath()%>/common/plugin/index.jsp" method="post"> |
---|
51 | |
---|
52 | <input type="hidden" name="ID" value="<%=ID%>"> |
---|
53 | <input type="hidden" name="cmd" value="SetParameters"> <input type="hidden" name="requestID" value="<%=requestID%>"> |
---|
54 | |
---|
55 | <!-- these are the parameters from the input pages; need to pick them up individually from the bean here; ugly as hell but can't be done any other way --> |
---|
56 | |
---|
57 | <!-- inputs from experiment.jsp page --> |
---|
58 | <input type="hidden" name="parameter:domain" value="<%=inputDataBean.getDomain()%>"> |
---|
59 | <input type="hidden" name="parameter:accession" value="<%=inputDataBean.getAccession()%>"> |
---|
60 | <input type="hidden" name="parameter:qualityControl" value="<%=inputDataBean.getQualityControl()%>"> |
---|
61 | <input type="hidden" name="parameter:experimentalDesign" value="<%=inputDataBean.getExperimentalDesign()%>"> |
---|
62 | <input type="hidden" name="parameter:experimentName" value="<%=inputDataBean.getExperimentName()%>"> |
---|
63 | <input type="hidden" name="parameter:description" value="<%=inputDataBean.getDescription()%>"> |
---|
64 | <input type="hidden" name="parameter:releaseDate" value="<%=inputDataBean.getReleaseDate()%>"> |
---|
65 | <input type="hidden" name="parameter:submissionDate" value="<%=inputDataBean.getSubmissionDate()%>"> |
---|
66 | <input type="hidden" name="parameter:submitter" value="<%=inputDataBean.getSubmitter()%>"> |
---|
67 | <input type="hidden" name="parameter:organization" value="<%=inputDataBean.getOrganization()%>"> |
---|
68 | <input type="hidden" name="parameter:publicationTitle" value="<%=inputDataBean.getPublicationTitle()%>"> |
---|
69 | <input type="hidden" name="parameter:authors" value="<%=inputDataBean.getAuthors()%>"> |
---|
70 | <input type="hidden" name="parameter:journal" value="<%=inputDataBean.getJournal()%>"> |
---|
71 | <input type="hidden" name="parameter:volume" value="<%=inputDataBean.getVolume()%>"> |
---|
72 | <input type="hidden" name="parameter:issue" value="<%=inputDataBean.getIssue()%>"> |
---|
73 | <input type="hidden" name="parameter:pages" value="<%=inputDataBean.getPages()%>"> |
---|
74 | <input type="hidden" name="parameter:year" value="<%=inputDataBean.getYear()%>"> |
---|
75 | <input type="hidden" name="parameter:pubmedId" value="<%=inputDataBean.getPubmedId()%>"> |
---|
76 | <input type="hidden" name="parameter:experimentId" value="<%=inputDataBean.getExperimentId()%>"> |
---|
77 | <!-- inputs from protocols.jsp page --> |
---|
78 | <input type="hidden" name="parameter:treatmentProtocol" value="<%=inputDataBean.getTreatmentProtocol()%>"> |
---|
79 | <input type="hidden" name="parameter:extractionProtocol" value="<%=inputDataBean.getExtractionProtocol()%>"> |
---|
80 | <input type="hidden" name="parameter:labelingProtocol" value="<%=inputDataBean.getLabelingProtocol()%>"> |
---|
81 | <input type="hidden" name="parameter:hybridizationProtocol" value="<%=inputDataBean.getHybridizationProtocol()%>"> |
---|
82 | <input type="hidden" name="parameter:scanningProtocol" value="<%=inputDataBean.getScanningProtocol()%>"> |
---|
83 | <input type="hidden" name="parameter:treatmentProtocolParams" value="<%=inputDataBean.getTreatmentProtocolParams()%>"> |
---|
84 | <input type="hidden" name="parameter:extractionProtocolParams" value="<%=inputDataBean.getExtractionProtocolParams()%>"> |
---|
85 | <input type="hidden" name="parameter:labelingProtocolParams" value="<%=inputDataBean.getLabelingProtocolParams()%>"> |
---|
86 | <input type="hidden" name="parameter:hybridizationProtocolParams" value="<%=inputDataBean.getHybridizationProtocolParams()%>"> |
---|
87 | <input type="hidden" name="parameter:scanningProtocolParams" value="<%=inputDataBean.getScanningProtocolParams()%>"> |
---|
88 | <!-- inputs from hybridizations.jsp page --> |
---|
89 | <input type="hidden" name="parameter:platform" value="<%=inputDataBean.getPlatform()%>"> |
---|
90 | <input type="hidden" name="parameter:organism" value="<%=inputDataBean.getOrganism()%>"> |
---|
91 | <input type="hidden" name="parameter:numDesigns" value="<%=inputDataBean.getNumDesigns()%>"> |
---|
92 | <input type="hidden" name="parameter:dyeSwap" value="<%=inputDataBean.getDyeSwap()%>"> |
---|
93 | <input type="hidden" name="parameter:refSample" value="<%=inputDataBean.getRefSample()%>"> |
---|
94 | <input type="hidden" name="parameter:numTreatmentGroups" value="<%=inputDataBean.getNumTreatmentGroups()%>"> |
---|
95 | <input type="hidden" name="parameter:expFactors" value="<%=inputDataBean.getExpFactors()%>"> |
---|
96 | <input type="hidden" name="parameter:numReplicates" value="<%=inputDataBean.getNumReplicates()%>"> |
---|
97 | <input type="hidden" name="parameter:tissues" value="<%=inputDataBean.getTissues()%>"> |
---|
98 | <input type="hidden" name="parameter:pooling" value="<%=inputDataBean.getPooling()%>"> |
---|
99 | <input type="hidden" name="file_id" value="<%=(String)request.getAttribute("file_id") %>"> |
---|
100 | <input type="hidden" name="parameter:zipFile" value="<%=(String)request.getParameter("path") %>" id="zipFile"> |
---|
101 | |
---|
102 | <% |
---|
103 | System.out.println("all parameter values in mappings.jsp:"); |
---|
104 | for (java.util.Enumeration e = request.getParameterNames(); e.hasMoreElements();) |
---|
105 | { |
---|
106 | String name = (String) e.nextElement(); |
---|
107 | String value = request.getParameter(name); |
---|
108 | System.out.println("parameter " + name + " = " + value); |
---|
109 | } |
---|
110 | |
---|
111 | //first extract the factor names and the possible values |
---|
112 | String expFactors = inputDataBean.getExpFactors().trim(); |
---|
113 | String[] rawFactors = expFactors.split("\n"); |
---|
114 | |
---|
115 | String[][] factorValues = new String[rawFactors.length][]; |
---|
116 | String[] factorNames = new String[rawFactors.length]; |
---|
117 | |
---|
118 | for (int i = 0; i < rawFactors.length; i++) |
---|
119 | { |
---|
120 | //extract the factor name |
---|
121 | String factorName = rawFactors[i].substring(0, rawFactors[i].indexOf("(")); |
---|
122 | factorNames[i] = factorName; |
---|
123 | //extract the possible values from between the parentheses |
---|
124 | String allValues = rawFactors[i].substring(rawFactors[i].indexOf("(") + 1, |
---|
125 | rawFactors[i].indexOf(")")); |
---|
126 | String[] values = allValues.split(","); |
---|
127 | factorValues[i] = values; |
---|
128 | } |
---|
129 | |
---|
130 | //here we get hold of the cartesian product of all the factor values |
---|
131 | String[][] products = CartesianProduct.getCartesianProduct(factorValues); |
---|
132 | |
---|
133 | //now inspect the content of the zip file and list all the individual files therein |
---|
134 | |
---|
135 | //first parse the filepath from the input page |
---|
136 | String zipFilePath = (String) request.getParameter("path"); |
---|
137 | String zipFileDirStr = zipFilePath.substring(0, zipFilePath.lastIndexOf("/")); |
---|
138 | String zipFileName = zipFilePath.substring(zipFilePath.lastIndexOf("/")+1); |
---|
139 | |
---|
140 | //get hold of the appropriate BASE objects for this |
---|
141 | DbControl dc = sc.newDbControl(); |
---|
142 | Directory zipFileDir = Directory.getByPath(dc, new Path(zipFileDirStr, Path.Type.DIRECTORY)); |
---|
143 | File zipFile = File.getFile(dc, zipFileDir, zipFileName, false); |
---|
144 | |
---|
145 | //now inspect the file content and store the names in the List |
---|
146 | Vector<String> fileNames = new Vector<String>(); |
---|
147 | ZipInputStream zipStream = new ZipInputStream(zipFile.getDownloadStream(0)); |
---|
148 | ZipEntry entry = zipStream.getNextEntry(); |
---|
149 | while (entry != null) |
---|
150 | { |
---|
151 | fileNames.add(entry.getName()); |
---|
152 | entry = zipStream.getNextEntry(); |
---|
153 | } |
---|
154 | |
---|
155 | String [] fileNamesArr = new String[fileNames.size()]; |
---|
156 | fileNames.toArray(fileNamesArr); |
---|
157 | Arrays.sort(fileNamesArr); |
---|
158 | |
---|
159 | dc.close(); |
---|
160 | %> |
---|
161 | |
---|
162 | <h1>Tab2MAGE Importer -- File Mappings</h1> |
---|
163 | Page 4 of 4 |
---|
164 | <p> |
---|
165 | |
---|
166 | The table below holds a list of all possible factor value combinations used in your experiment. |
---|
167 | Please select, for each combination, the appropriate file name from the drop down menu.</p><p> |
---|
168 | |
---|
169 | <!-- this table holds the combinations of factor values --> |
---|
170 | |
---|
171 | <table align="center" cellpadding="15"> |
---|
172 | |
---|
173 | <!-- column header row factor names --> |
---|
174 | |
---|
175 | <tr> |
---|
176 | |
---|
177 | <!-- file selector header --> |
---|
178 | <td class="header"><h3>File</h3></td> |
---|
179 | |
---|
180 | <!-- factor names --> |
---|
181 | <% |
---|
182 | for (int i = 0; i < products[i].length; i++) |
---|
183 | { |
---|
184 | %> |
---|
185 | <td class="header"><h3><%=factorNames[i]%></h3></td> |
---|
186 | <% |
---|
187 | } |
---|
188 | %> |
---|
189 | </tr> |
---|
190 | |
---|
191 | <!-- now add as many rows as we have discrete combinations of factor values --> |
---|
192 | |
---|
193 | <% |
---|
194 | for (int i = 0; i < products.length; i++) |
---|
195 | { |
---|
196 | %> |
---|
197 | |
---|
198 | <tr> |
---|
199 | |
---|
200 | <!-- first we need a cell with a drop down menu where we can select a filename to match the combination of factor values--> |
---|
201 | |
---|
202 | <td class="input" name="fileinput<%=i %>"><select> |
---|
203 | <% |
---|
204 | for (int k = 0; k < fileNamesArr.length; k++) |
---|
205 | { |
---|
206 | %> |
---|
207 | |
---|
208 | <option><%=fileNamesArr[k]%></option> |
---|
209 | |
---|
210 | <% |
---|
211 | } |
---|
212 | %> |
---|
213 | </select></td> |
---|
214 | |
---|
215 | <!-- now print the values of this factor value combination, each in a separate cell --> |
---|
216 | <% |
---|
217 | for (int j = 0; j < products[i].length; j++) |
---|
218 | { |
---|
219 | %> |
---|
220 | <td class="border"><%=products[i][j]%></td> |
---|
221 | <% |
---|
222 | } |
---|
223 | %> |
---|
224 | |
---|
225 | |
---|
226 | </tr> |
---|
227 | |
---|
228 | <% |
---|
229 | } |
---|
230 | %> |
---|
231 | |
---|
232 | </table> |
---|
233 | |
---|
234 | <p> |
---|
235 | |
---|
236 | <table align="center" class="noBorder" cellspacing="5" cellpadding="5"> |
---|
237 | <tr class="noBorder"> |
---|
238 | <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;">Start Import</td></tr></table></div></div></td> |
---|
239 | <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> |
---|
240 | </table> |
---|
241 | |
---|
242 | |
---|
243 | </form> |
---|
244 | |
---|
245 | </body> |
---|
246 | </html> |
---|