Changeset 518
- Timestamp:
- Dec 12, 2007, 12:19:07 PM (16 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/hybridizations.jsp
r517 r518 145 145 <tr> 146 146 <td class="boldText">Name of the experimental organism:</td> 147 <td class="input"><input type="text" size="60" name="parameter:organism" value=" barley"/></td>147 <td class="input"><input type="text" size="60" name="parameter:organism" value="Solanum tuberosum"/></td> 148 148 </tr> 149 149 … … 172 172 <tr> 173 173 <td class="boldText">Number of treatment groups:</td> 174 <td class="input"><input type="text" size="3" name="parameter:numTreatmentGroups" value=" 12"/></td>174 <td class="input"><input type="text" size="3" name="parameter:numTreatmentGroups" value="2"/></td> 175 175 </tr> 176 176 … … 179 179 <td class="boldText">Please list your experimental factors and value ranges using the following format (one per 180 180 line):<br> 181 <i>Factor 1(value1,value2,...valueN)<br> 182 Factor 2(value1,value2,...valueN)</i> 181 <i>Factor 1(value1,value2,...valueN)<br></i> 183 182 <p>Example: <i><br> 184 183 Compound(aspirin,ibuprofen,acetaminophen) <br> 185 184 Dose(control,low,medium,high)</i> 186 185 </td> 187 <td class="input"><textarea rows="7" cols="40" name="parameter:expFactors"> Factor 1(value1,value2,...valueN)</textarea></td>186 <td class="input"><textarea rows="7" cols="40" name="parameter:expFactors">Strain(mutant,wildtype)</textarea></td> 188 187 </tr> 189 188 … … 191 190 <tr> 192 191 <td class="boldText">Number of subjects per group (i.e. number of biological replicates):</td> 193 <td class="input"><input type="text" size="3" name="parameter:numReplicates" value=" 3"/></td>192 <td class="input"><input type="text" size="3" name="parameter:numReplicates" value="2"/></td> 194 193 </tr> 195 194 … … 198 197 <td class="boldText">List all target tissues (as a comma separated list).<br> 199 198 Example: liver,heart,adipose tissue</td> 200 <td class="input"><textarea rows="2" cols="40" name="parameter:tissues"> tissues1,tissue2</textarea></td>199 <td class="input"><textarea rows="2" cols="40" name="parameter:tissues">stem</textarea></td> 201 200 </tr> 202 201 … … 220 219 <div class="buttonclass" onmouseover="this.className='buttonclass_hover';" 221 220 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>221 <div class="buttonclass_inner"> 222 <table border="0" cellspacing="0" cellpadding="0"> 223 <tr> 224 <td><img src="/base/images/browse.png" border="0"></td> 226 225 <td>Browse…</td> 227 226 </tr> 228 227 </table> 229 228 </div> 230 229 </div> 231 230 </td> -
branches/uk_ac_ebi_Tab2MageImporter/src/uk/ac/ebi/nugo/common/Helper.java
r477 r518 70 70 71 71 72 public static File processFilePath (User user,boolean overwrite, SessionControl sc, String pathString) 72 public static File processFilePath (User user,boolean overwrite, SessionControl sc, String pathString) throws Exception 73 73 { 74 74 DbControl dc= null; … … 97 97 { 98 98 dc.close(); 99 throw new Exception(e.getMessage()); 99 100 } 100 101 finally -
branches/uk_ac_ebi_Tab2MageImporter/src/uk/ac/ebi/nugo/plugins/Tab2MageImporter.java
r517 r518 382 382 // save the new subDir 383 383 dc.saveItem(subDir); 384 dc.commit(); 384 385 385 386 if(dc==null) … … 398 399 RawDataType rdt= experiment.getRawDataType(); // experiment platform 399 400 400 // String statusp=(String)job.getValue("statusPath"); 401 // File statusFile=Helper.processFilePath(user,overwrite, sc,statusp); 401 //write a log file in the same directory where the files were unzipped 402 // String statusFilePath = subDir.getPath().toString()+"/importerLog.txt"; 403 // System.out.println("statusFile path = "+ statusFilePath); 404 // File statusFile=Helper.processFilePath(user,true, sc,statusFilePath); 405 // statusFile = File.getById(dc, statusFile.getId()); 406 // System.out.println("statusFile = " +statusFile); 407 408 409 /////////////////////////////////////////////////////////////////////////////////////////////////// 410 411 //now write the tab2mage file to the user's home dir on the server so it can be consumed by the plugin 412 //this takes all the inputs provided by the user on the custom interface (input.jsp) 413 //give the file a unique name so we don't get any conflicts 414 Tab2MageWriter t2mWriter = new Tab2MageWriter(job, subDir,sc,paramNames); 415 t2mWriter.writeTab2MageFile(); 416 File statusFile = t2mWriter.makeStatusFile(); 417 System.out.println("statusFile = " +statusFile.getPath()); 418 419 ///////////////////////////////////////////////////////////////////////////////////////////////// 420 402 421 403 422 //FILE UNZIP MODULE: unzip the files into user specified directory … … 414 433 415 434 // -- end of file unzip module 416 417 ///////////////////////////////////////////////////////////////////////////////////////////////////418 419 //now write the tab2mage file to the user's home dir on the server so it can be consumed by the plugin420 //this takes all the inputs provided by the user on the custom interface (input.jsp)421 //give the file a unique name so we don't get any conflicts422 Tab2MageWriter t2mWriter = new Tab2MageWriter(job, dir,sc,paramNames);423 t2mWriter.writeTab2MageFile();424 425 426 /////////////////////////////////////////////////////////////////////////////////////////////////427 428 /*429 435 430 436 //VALIDATION MODULE … … 461 467 return; 462 468 } 463 469 470 464 471 Map<ValidationConstants, Boolean> validations= validator.validateTab2MageFile(); 465 472 StringBuffer failureMessage = new StringBuffer(); … … 555 562 // -- end of experiment configuration and loading module 556 563 557 //MESSAGING MODULE 558 559 // send an email to the user on the success of the experiment (if email server name and email address are provided) 560 if (hostName!= null && hostName.length()>=5) 561 { 562 if (!user.getEmail().equals("") && user.getEmail()!=null ) 563 { 564 Tab2MageEMessaging message= new Tab2MageEMessaging(writtenExp,"", user.getEmail(),tab2MageFileName, user.getName(), experiment.getName(),hostName ); 565 message.sendEmail(); 566 } 567 } 568 // -- end of messaging module 569 */ 570 //dc.commit(); 564 565 dc.commit(); 571 566 response.setDone("Import plugin ended successfully"); 572 567 } -
branches/uk_ac_ebi_Tab2MageImporter/src/uk/ac/ebi/nugo/plugins/Tab2MageWriter.java
r517 r518 8 8 import net.sf.basedb.core.DbControl; 9 9 import net.sf.basedb.core.Directory; 10 import net.sf.basedb.core.File; 10 11 import net.sf.basedb.core.SessionControl; 11 12 import net.sf.basedb.core.plugin.ParameterValues; … … 76 77 public Tab2MageWriter() 77 78 { 78 initTestParamValues(); 79 } 79 } 80 81 80 82 81 83 // ===================================================methods================================================ … … 86 88 try 87 89 { 88 Class cls = Class.forName("uk.ac.ebi.nugo.plugins.Tab2MageWriter"); 90 Tab2MageWriter writer = new Tab2MageWriter(); 91 92 Class cls = writer.getClass(); 93 //Class cls = Class.forName("uk.ac.ebi.nugo.plugins.Tab2MageWriter"); 94 89 95 for (int i = 0; i < paramNames.length; i++) 90 96 { 91 Field field = cls.get Field(paramNames[i]);97 Field field = cls.getDeclaredField(paramNames[i]); 92 98 field.set(this, job.getValue(paramNames[i])); 93 99 } 94 } 100 101 //chop off any potential commas at the end of the experimentalDesign String 102 //these arise because we string together values form multiple inputs in the web forms 103 if(experimentalDesign.endsWith(",")) 104 { 105 experimentalDesign = experimentalDesign.substring(0, experimentalDesign.length()-2); 106 } 107 } 95 108 catch (Exception e) 96 109 { … … 150 163 { "P-DIET-1", "P-EXTR-1", "P-LABL-1", "P-HYBR-1", "P-SCAN-1" }; 151 164 String[] names = new String[] 152 { " treatment", "extraction", "labeling", "hybridization", "scanning" };165 { "Treatment", "Extraction", "Labeling", "Hybridization", "Scanning" }; 153 166 String[] values = new String[] 154 167 { treatmentProtocol, extractionProtocol, labelingProtocol, hybridizationProtocol, scanningProtocol }; … … 157 170 hybridizationProtocolParams, scanningProtocolParams }; 158 171 String[] types = new String[] 159 { " grow", "extraction", "labeling", "hybridization", "scanning" };172 { "Sampling", "Extraction", "Labeling", "Hybridization", "Scanning" }; 160 173 161 174 // print header … … 180 193 181 194 // print column headers for the section 182 String [] colHeaders = new String [] {"File[raw]"," array[accession]"," BioSource"," BioMaterialCharacteristics[Organism]"," BioMaterialCharacteristics[OrganismPart]"," BioMaterialCharacteristics[CellType]"," Sample"," Protocol[grow]"," Extract"," Protocol[extraction]"," LabeledExtract"," Protocol[labeling]"," Dye"," Hybridization"," Protocol[hybridization]"," Scan"," Protocol[scanning]"," FactorValue[Treatment Type]"};195 String [] colHeaders = new String [] {"File[raw]"," Array[accession]"," BioSource"," BioMaterialCharacteristics[Organism]"," BioMaterialCharacteristics[OrganismPart]"," BioMaterialCharacteristics[CellType]"," Sample"," Protocol[Sampling]"," Extract"," Protocol[Extraction]"," LabeledExtract"," Protocol[Labeling]"," Dye"," Hybridization"," Protocol[Hybridization]"," Scan"," Protocol[Scanning]"," FactorValue[Treatment Type]"}; 183 196 for (int i = 0; i < colHeaders.length; i++) 184 197 { … … 187 200 t2mContent += "\n"; 188 201 189 190 // ////////////////////////////////////////////////////////////////////////////////////////////////////////// 191 192 202 //the following is a direct translation of Philippe's Perl script code 193 203 int count = 1; 194 204 … … 212 222 213 223 // file count first 214 t2mContent += "file-" + count + ". txt" + "\t" +224 t2mContent += "file-" + count + ".gpr" + "\t" + 215 225 // accession no. i.e the array design 216 226 accession + "\t" + … … 254 264 255 265 // file count first 256 t2mContent += "file-" + count + ". txt" + "\t" +266 t2mContent += "file-" + count + ".gpr" + "\t" + 257 267 // accession no. i.e the array design 258 268 accession + "\t" + … … 296 306 } 297 307 } 298 } 299 300 301 // ////////////////////////////////////////////////////////////////////////////////////////////////////////// 302 308 } 303 309 } 304 310 … … 316 322 dc.saveItem(t2mFile); 317 323 318 if (dc == null)319 dc = sc.newDbControl();320 321 324 Writer out = new BufferedWriter(new OutputStreamWriter(t2mFile.getUploadStream(false), "ISO-8859-1")); 322 325 323 326 // write content to file 327 generateFileContents(); 324 328 out.write(t2mContent); 325 329 … … 337 341 } 338 342 } 343 344 // ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 345 346 public File makeStatusFile() 347 { 348 net.sf.basedb.core.File statusFile = null; 349 try 350 { 351 DbControl dc = sc.newDbControl(); 352 statusFile = net.sf.basedb.core.File.getNew(dc, dir); 353 statusFile.setName("importerLog.txt"); 354 dc.saveItem(statusFile); 355 dc.commit(); 356 if (dc != null) 357 dc.close(); 358 } 359 catch (Exception e) 360 { 361 e.printStackTrace(); 362 } 363 return statusFile; 364 } 365 366 339 367 340 368 // ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- … … 352 380 // ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 353 381 354 p rivatevoid initTestParamValues()382 public void initTestParamValues() 355 383 { 356 384 /* 385 * Philippe's hybs params for testing (rest is made up): 386 * 357 387 --org Homo_sapiens 358 388 --array Agilent1 … … 370 400 domain = "scri.ac.uk"; 371 401 accession = "Agilent1"; 372 qualityControl = "biological replicate ,spike quality control";373 experimentalDesign = " cell_component_comparison_design,RNA_stability_design,family_history_design,";402 qualityControl = "biological replicate"; 403 experimentalDesign = "strain_or_line_design"; 374 404 experimentName = "New experiment"; 375 405 description = "description goes here"; … … 400 430 401 431 //hybs 402 platform = " Agilent";403 organism = " Homo_sapiens";432 platform = "Genepix"; 433 organism = "Solanum tuberosum"; 404 434 numDesigns = "1"; 405 435 dyeSwap = "no"; 406 436 refSample = "yes"; 407 numTreatmentGroups = " 6";437 numTreatmentGroups = "2"; 408 438 expFactors = "compound(aspirin,ibuprofen);dose(none,medium,high) )"; 409 numReplicates = " 4";410 tissues = " liver,heart,brain";439 numReplicates = "2"; 440 tissues = "stem"; 411 441 pooling = "no"; 412 442 zipFile = "/home/michab/potato_small.zip"; -
branches/uk_ac_ebi_Tab2MageImporter/src/uk/ac/ebi/nugo/plugins/tab2mageimport/validation/Tab2MageHybridizationValidation.java
r468 r518 183 183 public static boolean validateHeader(ArrayList<String> header, Writer writer) 184 184 { 185 System.out.println("/////////////////////////////////////////////"); 186 System.out.println("hybs headers:"); 187 for (String string : header) 188 { 189 System.out.println(string); 190 } 191 System.out.println("/////////////////////////////////////////////"); 192 193 185 194 //[TODO] convert all headers to lowercase, to facilitate matching of hyb section header to Tab2mageConstants/Spec 186 195 //header= header2LowerCase(header); … … 189 198 try 190 199 { 191 if(!header.contains(Tab2MageConstants.hybridization.getName() ))200 if(!header.contains(Tab2MageConstants.hybridization.getName().trim())) 192 201 { 193 202 log.error("The column \"" + Tab2MageConstants.hybridization.getName() + "\" wasn't found!");
Note: See TracChangeset
for help on using the changeset viewer.