Changeset 530
- Timestamp:
- Jan 10, 2008, 1:44:06 PM (13 years ago)
- Location:
- branches/uk_ac_ebi_Tab2MageImporter
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/uk_ac_ebi_Tab2MageImporter/jsp/uk/ac/ebi/nugo/plugins/experiment.jsp
r529 r530 4 4 <%@ page import="java.util.*"%> 5 5 6 <jsp:useBean id="inputDataBean" class="uk.ac.ebi.nugo.plugins.DataBean" scope=" application"/>6 <jsp:useBean id="inputDataBean" class="uk.ac.ebi.nugo.plugins.DataBean" scope="session"/> 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="*"/> … … 11 11 final SessionControl sc = Base.getExistingSessionControl(pageContext, true); 12 12 final String ID = sc.getId(); 13 final String requestI D = request.getParameter("requestID");13 final String requestId = request.getParameter("requestId"); 14 14 15 15 //we also need to figure out the name/id of the currently selected experiment that this import is getting initiated from … … 130 130 <form name="experimentData" action="<%= request.getContextPath()%>/plugins/uk/ac/ebi/nugo/plugins/protocols.jsp" method="post"> 131 131 <input type="hidden" name="ID" value="<%=ID%>"> 132 <input type="hidden"name="requestI D" value="<%=requestID%>">132 <input type="hidden"name="requestId" value="<%=requestId%>"> 133 133 134 134 <table cellpadding="0" cellspacing="0"> -
branches/uk_ac_ebi_Tab2MageImporter/jsp/uk/ac/ebi/nugo/plugins/hybridizations.jsp
r529 r530 4 4 <%@ page import="java.util.*"%> 5 5 6 <jsp:useBean id="inputDataBean" class="uk.ac.ebi.nugo.plugins.DataBean" scope=" application" />6 <jsp:useBean id="inputDataBean" class="uk.ac.ebi.nugo.plugins.DataBean" scope="session" /> 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="*" /> … … 11 11 final SessionControl sc = Base.getExistingSessionControl(pageContext, true); 12 12 final String ID = sc.getId(); 13 final String requestI D = request.getParameter("requestID");13 final String requestId = request.getParameter("requestId"); 14 14 %> 15 15 … … 87 87 <form name="hybridizations"action="<%= request.getContextPath()%>/plugins/uk/ac/ebi/nugo/plugins/mappings.jsp" method="post"> 88 88 <input type="hidden" name="ID" value="<%=ID%>"> <input type="hidden" name="cmd" value="SetParameters"> 89 <input type="hidden"name="requestI D" value="<%=requestID%>">89 <input type="hidden"name="requestId" value="<%=requestId%>"> 90 90 91 91 <input type="hidden" name="file_id" value=""> -
branches/uk_ac_ebi_Tab2MageImporter/jsp/uk/ac/ebi/nugo/plugins/mappings.jsp
r529 r530 7 7 <%@ page import="uk.ac.ebi.nugo.plugins.*"%> 8 8 9 <jsp:useBean id="inputDataBean" class="uk.ac.ebi.nugo.plugins.DataBean" scope=" application" />9 <jsp:useBean id="inputDataBean" class="uk.ac.ebi.nugo.plugins.DataBean" scope="session" /> 10 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 11 <jsp:setProperty name="inputDataBean" property="*" /> … … 14 14 final SessionControl sc = Base.getExistingSessionControl(pageContext, true); 15 15 final String ID = sc.getId(); 16 final String requestI D = request.getParameter("requestID");16 final String requestId = request.getParameter("requestId"); 17 17 %> 18 18 … … 31 31 function submit() 32 32 { 33 gatherValues(); 34 document.mappings.submit(); 35 } 36 37 38 function getRoot() 39 { 40 return '/base/'; 41 } 42 43 function getScale() 44 { 45 return 1.0; 46 } 47 48 49 //collects all the values from the file selector boxes and strings them together so they can be 50 //passed on as a single parameter for plugin configuration 51 function gatherValues() 52 { 53 var fileString = ''; 33 54 var frm = document.forms['mappings']; 34 frm.submit(); 35 } 36 37 38 function getRoot() 39 { 40 return '/base/'; 41 } 42 43 function getScale() 44 { 45 return 1.0; 46 } 55 var numElements = frm.elements.length; 56 //document.write(numElements); 57 //document.write("<br />"); 58 for(var i = 0; i < numElements; i++) 59 { 60 var value = frm.elements[i].value; 61 var id = frm.elements[i].id; 62 63 if(id.match("fileinput")) 64 { 65 //document.write("id = " + id); 66 //document.write("<br />"); 67 //document.write("value = " + value); 68 //document.write("<br />"); 69 fileString += frm.elements[i].value + '\t'; 70 } 71 } 72 //document.write('combined output = ' + fileString); 73 frm.fileStringParam.value = fileString; 74 //document.write('value of hidden input = ' + frm.fileStringParam.value); 75 } 76 47 77 </script> 48 78 … … 57 87 <input type="hidden" name="ID" value="<%=ID%>"> 58 88 <input type="hidden" name="cmd" value="SetParameters"> 59 <input type="hidden" name="requestI D" value="<%=requestID%>">60 <input type="hidden" id="fileStringParam" name="param :fileStringParam" value""/>89 <input type="hidden" name="requestId" value="<%=requestId%>"> 90 <input type="hidden" id="fileStringParam" name="parameter:fileStringParam" value""/> 61 91 62 92 <!-- these are the parameters from the previous input pages; need to pick them up individually from the bean here; ugly as hell but can't be done any other way --> … … 249 279 </form> 250 280 251 <script language="JavaScript" type="text/javascript"> 252 //collects all the values from the file selector boxes and strings them together so they can be 253 //passed on as a single parameter for plugin configuration 254 { 255 var fileString = ''; 256 var frm = document.forms['mappings']; 257 var numElements = frm.elements.length; 258 document.write(numElements); 259 document.write("<br />"); 260 for(var i = 0; i < numElements; i++) 261 { 262 var value = frm.elements[i].value; 263 var id = frm.elements[i].id; 264 265 if(id.match("fileinput")) 266 { 267 document.write("id = " + id); 268 document.write("<br />"); 269 document.write("value = " + value); 270 document.write("<br />"); 271 fileString += frm.elements[i].value + '\t'; 272 } 273 } 274 document.write('combined output = ' + fileString); 275 frm.fileStringParam.value = fileString; 276 document.write('value of hidden input = ' + frm.fileStringParam.value); 277 } 278 </script> 281 279 282 280 283 </body> -
branches/uk_ac_ebi_Tab2MageImporter/jsp/uk/ac/ebi/nugo/plugins/protocols.jsp
r529 r530 5 5 <%@ page import="java.lang.*"%> 6 6 7 <jsp:useBean id="inputDataBean" class="uk.ac.ebi.nugo.plugins.DataBean" scope=" application" />7 <jsp:useBean id="inputDataBean" class="uk.ac.ebi.nugo.plugins.DataBean" scope="session" /> 8 8 <!-- 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 --> 9 9 <jsp:setProperty name="inputDataBean" property="*" /> … … 34 34 final SessionControl sc = Base.getExistingSessionControl(pageContext, true); 35 35 final String ID = sc.getId(); 36 final String requestI D = request.getParameter("requestID");36 final String requestId = request.getParameter("requestId"); 37 37 38 38 … … 120 120 <form name="protocols" action="<%= request.getContextPath()%>/plugins/uk/ac/ebi/nugo/plugins/hybridizations.jsp" method="post"> 121 121 <input type="hidden" name="ID" value="<%=ID%>"> 122 <input type="hidden"name="requestI D" value="<%=requestID%>">122 <input type="hidden"name="requestId" value="<%=requestId%>"> 123 123 124 124 <h1>Tab2MAGE Importer -- Your Protocols</h1> -
branches/uk_ac_ebi_Tab2MageImporter/src/uk/ac/ebi/nugo/plugins/Tab2MageImporter.java
r529 r530 156 156 System.out.println(" configure request = " +request + ", command = " + request.getCommand()); 157 157 158 158 159 try 159 160 { … … 180 181 //set the response as done 181 182 //response.setDone("Job configuration complete", Job.ExecutionTime.SHORT); 182 183 184 183 185 //print out current values 184 186 System.out.println("================================================================="); … … 191 193 } 192 194 System.out.println("================================================================="); 193 } 194 } 195 catch (Exception ex) 195 196 } 197 } 198 catch (Throwable ex) 196 199 { 197 200 System.out.println("exception in configure method"); … … 257 260 requestInformation = new RequestInformation(Request.COMMAND_CONFIGURE_JOB, null, null, params, "experiment.jsp"); 258 261 } 259 catch ( Exceptione)262 catch (Throwable e) 260 263 { 261 264 e.printStackTrace(); -
branches/uk_ac_ebi_Tab2MageImporter/src/uk/ac/ebi/nugo/plugins/Tab2MageWriter.java
r526 r530 25 25 ParameterValues job; 26 26 String[] paramNames; 27 HashMap<String,LinkedList> factors; 27 28 String[][] cartesianProduct; 29 String[] factorNames; 30 String [] fileNames; 28 31 29 32 String domain; … … 67 70 String zipFile; 68 71 String experimentId; 72 String fileStringParam; 73 69 74 70 75 // ===================================================c'tor================================================ … … 101 106 102 107 //now extract the factor values and store them suitably so we can access them 103 extractFactorValues();108 makeFactorValueCombinations(); 104 109 } 105 110 catch (Exception e) … … 110 115 111 116 // ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 112 //extracts the factor names and their list of possible values from the single string that we obtain from the web page113 public void extractFactorValues()114 {115 factors = new HashMap<String,LinkedList>();116 117 117 String [] rawFactors = expFactors.split("\n"); 118 private void makeFactorValueCombinations() 119 { 120 //first extract the factor names and the possible values 121 String[] rawFactors = expFactors.split("\n"); 122 123 String[][] factorValues = new String[rawFactors.length][]; 124 factorNames = new String[rawFactors.length]; 125 118 126 for (int i = 0; i < rawFactors.length; i++) 119 127 { 120 128 //extract the factor name 121 129 String factorName = rawFactors[i].substring(0, rawFactors[i].indexOf("(")); 130 factorNames[i] = factorName; 122 131 //extract the possible values from between the parentheses 123 String allValues = rawFactors[i].substring(rawFactors[i].indexOf("(")+1,rawFactors[i].length()-1); 124 String [] values = allValues.split(","); 125 System.out.println("factorName = " + factorName); 126 System.out.println("allValues = "+ allValues); 127 //add them to a linkedlist object 128 LinkedList<String> valueList = new LinkedList<String>(); 129 for (int j = 0; j < values.length; j++) 132 String allValues = rawFactors[i].substring(rawFactors[i].indexOf("(") + 1, 133 rawFactors[i].indexOf(")")); 134 String[] values = allValues.split(","); 135 factorValues[i] = values; 136 } 137 138 //here we get hold of the cartesian product of all the factor values 139 cartesianProduct = CartesianProduct.getCartesianProduct(factorValues); 140 for (int i = 0; i < cartesianProduct.length; i++) 141 { 142 System.out.print("factor value combination: "); 143 for (int j = 0; j < factorValues.length; j++) 130 144 { 131 System.out.println("value: " + values[j]); 132 valueList.add(values[j]); 133 145 System.out.print(cartesianProduct[i][j] + " "); 134 146 } 135 //add this pair to the hashmap 136 factors.put(factorName, valueList); 137 } 138 } 147 System.out.println(); 148 } 149 150 //now we want the filenames in a separate array so we can add them to their appropriate combinations as selected 151 //by the user in the UI 152 //this requires us to parse out the file string (which had to be sent as a single parameter from the web page) and add the files to the 153 //array in the order we find them in the string 154 //they then match the order of the combinations in the cartesian product 155 fileNames = fileStringParam.split("\t"); 156 } 157 139 158 140 159 // ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- … … 227 246 "Extract", "Protocol[extraction]", "LabeledExtract", 228 247 "Protocol[labeling]", "Dye", "Hybridization", 229 "Protocol[hybridization]", "Scan", "Protocol[scanning]", 230 "FactorValue[Treatment Type]" }; 248 "Protocol[hybridization]", "Scan", "Protocol[scanning]" }; 231 249 for (int i = 0; i < colHeaders.length; i++) 232 250 { 233 251 t2mContent += colHeaders[i] + "\t"; 234 252 } 253 235 254 //now print the factorvalue headers 236 for (Iterator iter = factors.entrySet().iterator(); iter.hasNext();) 237 { 238 Map.Entry<String, LinkedList> entry = (Map.Entry<String, LinkedList>)iter.next(); 239 String factorName = entry.getKey(); 255 for (int i = 0; i < factorNames.length; i++) 256 { 257 t2mContent += "FactorValue["+factorNames[i] + "]\t"; 240 258 } 241 259 … … 257 275 for (int i = 1; i <= numGroups; i++) 258 276 { 277 System.out.println("i=" +i); 259 278 int subjectCount = 0; 260 279 // for each subject within each group … … 267 286 268 287 // file count first 269 t2mContent += "file" + count + ".CEL"+ "\t" +288 t2mContent += fileNames[count-1] + "\t" + 270 289 // accession no. i.e the array 271 290 // design … … 300 319 "scan-" + count + "\t" + 301 320 // Protocol[scanning] 302 "P-SCAN-1" + "\t" + 321 "P-SCAN-1" + "\t"; 322 323 //now print all the factor values 303 324 // FactorValue[Treatment Type] 304 "trt_group" + i + "\t"; 325 //"trt_group" + i + "\t"; 326 System.out.println("cartesianProduct[0].length = " + cartesianProduct[0].length); 327 for(int n=0; n< cartesianProduct[0].length; n++) 328 { 329 System.out.println("count = " + count); 330 System.out.println("n = "+ n); 331 t2mContent +=cartesianProduct[i-1][n]+ "\t"; 332 } 305 333 306 334 // new line … … 338 366 339 367 // file count first 340 t2mContent += "file" + count + ".gpr"+ "\t" +368 t2mContent += fileNames[count-1] + "\t" + 341 369 // accession no. i.e the array 342 370 // design … … 382 410 383 411 // file count first 384 t2mContent += "file" + count + ".gpr"+ "\t" +412 t2mContent += fileNames[count-1] + "\t" + 385 413 // accession no. i.e the array 386 414 // design … … 436 464 public void writeTab2MageFile() 437 465 { 466 DbControl dc = null; 438 467 try 439 468 { 440 469 // set up a file writer 441 DbControldc = sc.newDbControl();470 dc = sc.newDbControl(); 442 471 net.sf.basedb.core.File t2mFile = net.sf.basedb.core.File.getNew(dc, dir); 443 472 System.out.println("dir for writing new tab2mage file = " + dir.getName()); … … 455 484 456 485 dc.commit(); 486 487 } 488 catch (Exception e) 489 { 490 e.printStackTrace(); 491 } 492 finally 493 { 457 494 if (dc != null) 458 495 dc.close(); 459 }460 catch (Exception e)461 {462 e.printStackTrace();463 496 } 464 497 } … … 522 555 experimentId = "2"; 523 556 domain = "scri.ac.uk"; 524 accession = "A gilent1";557 accession = "Affymetrix1"; 525 558 qualityControl = "biological replicate,spike quality control"; 526 559 experimentalDesign = "cell_component_comparison_design,RNA_stability_design,family_history_design,"; … … 554 587 // hybs 555 588 platform = "Affymetrix"; 556 organism = " Homo_sapiens";589 organism = "Solanum tuberosum"; 557 590 numDesigns = "1"; 558 591 dyeSwap = "no"; 559 592 refSample = "yes"; 560 numTreatmentGroups = " 6";561 expFactors = " compound(aspirin,ibuprofen)\ndose(none,medium,high)";562 numReplicates = " 4";563 tissues = " liver,heart,brain";593 numTreatmentGroups = "4"; 594 expFactors = "Strain(mutant,wildtype)\nTreatment(treated,control)"; 595 numReplicates = "2"; 596 tissues = "stem"; 564 597 pooling = "no"; 565 598 zipFile = "/home/michab/potato_small.zip"; 599 fileStringParam = "file1.CEL\tfile2.CEL\tfile3.CEL\tfile4.CEL\tfile5.CEL\tfile6.CEL\tfile7.CEL\tfile8.CEL"; 566 600 567 extractFactorValues(); 568 601 602 //now extract the factor values and store them suitably so we can access them 603 makeFactorValueCombinations(); 604 569 605 } 570 606 // -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.