Changeset 1188 for plugins/base2
- Timestamp:
- Feb 11, 2010, 2:58:17 PM (13 years ago)
- Location:
- plugins/base2/uk.ac.ebi.tab2mage/trunk/Tab2MageExporter
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/base2/uk.ac.ebi.tab2mage/trunk/Tab2MageExporter/ChangeLog.txt
-
Property
svn:keywords
set to
Id
r500 r1188 1 $Id$ 2 1 3 ,____This file will contain information about changes in subsequent releases. 2 4 3 Latest version 2.0 4 - Pooling of biomaterials - Pooled sample, extract, and labeled extract are now supported in this release. 5 version 1.0 6 - Pooling of biomaterials - Pooled sample, extract, and labeled 7 extract are now supported in this release. 5 8 - Redesigned code to improve reuse. 9 10 version 1.01 : 08/02/2010 - lecorguille 11 - Fix a problem with pooling which was not supported ... for me 12 - Modification : Filenames are use instead of RawBioAssays' names for 13 File[raw] column in the Hybridization section 14 - Add the possibility to have several Files[raw] per RawBioAssay (ex : 15 one cy3 and one cy5) 16 - Add a scan column in the Hybridization section 17 - Add a BioSourceDescription column in the Hybridization section 18 - Fix a problem with protocols in the Hybridization section -
Property
svn:keywords
set to
-
plugins/base2/uk.ac.ebi.tab2mage/trunk/Tab2MageExporter/README.txt
-
Property
svn:keywords
set to
Id
r502 r1188 1 $Id$ 2 1 3 Release Note: Tab2Mage Export Current Implementation 2 4 ============================================== … … 9 11 Note: If you get a class Loader error while installing the exporter, you have two options: 10 12 11 i) Upgrade to BASE 2. 4.6or13 i) Upgrade to BASE 2.14.1 or 12 14 ii) Place the two jar files: Tab2MageExporter.jar and ebi-plugins-utils.jar in your base installation classpath - i.e. : $BASE2_HOME/web-inf/lib, restart the tomcat server and proceed to install the plugin. In step (3) below, do not specify the plugin's path. Note that BASE do not recommend this approach but it's just a work around for a bug in base versions earlier than 2.4.6. 13 15 … … 39 41 - If experimental factors have not been specified for an experiment. 40 42 - Also, note that if experimental factors (annotation type) for an experiment have been specified, and the annotation types are shared to Project. Do set the Project active before exporting in Tab2mage otherwise export fails. 41 - Finally, if an array slide or array design has not been provided for Hybridization.43 - Finally, if an array slide or array design has not been provided for Hybridization. 42 44 43 45 Besides, using the experiment overview functionality would help to prevent most of these failure points. -
Property
svn:keywords
set to
-
plugins/base2/uk.ac.ebi.tab2mage/trunk/Tab2MageExporter/credit.txt
-
Property
svn:keywords
set to
Id
r447 r1188 1 $Id$ 2 1 3 At this release, Nutribase developement team are : 2 4 … … 5 7 6 8 both based at the European Bioinformatics Institute, Cambridge, UK 9 10 Release 1.01 : 11 - Gildas Le Corguillé (lecorguille@sb-roscoff.fr) - Université Pierre 12 et Marie Curie (UPMC), Station Biologique de Roscoff, FR -
Property
svn:keywords
set to
-
plugins/base2/uk.ac.ebi.tab2mage/trunk/Tab2MageExporter/src/uk/ac/ebi/nugo/common/Tab2MageConstants.java
-
Property
svn:keywords
set to
Id
r449 r1188 1 /* $Id: Tab2MageConstants.java 2006-08-08 dominic $ 1 /* $Id$ 2 3 Copyright (C) 2007, 2010 Authors contributing to this file. 2 4 3 5 This file is for NutriBASE - Nutrigenomics BioArray Software Environment. 4 6 A customisation of the BASE SOFTWARE. 5 Developed at the EBI , Cambridge. 6 Author: Dominic Oyeniran: oyeniran@ebi.ac.uk 7 8 BASE is free software; you can redistribute it and/or 9 modify it under the terms of the GNU General Public License 10 as published by the Free Software Foundation; either version 2 11 of the License, or (at your option) any later version. 12 13 BASE is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 GNU General Public License for more details. 17 18 You should have received a copy of the GNU General Public License 19 along with this program; if not, write to the Free Software 20 Foundation, Inc., 59 Temple Place - Suite 330, 21 Boston, MA 02111-1307, USA. 7 22 */ 23 8 24 package uk.ac.ebi.nugo.common; 9 25 … … 17 33 @author Dominic Oyeniran 18 34 @version 1.0 35 36 37 @author Gildas Le Corguillé 38 @email lecorguille@sb-roscoff.fr 39 @version 1.01 40 41 ChangeLog : 42 05/02/2010 - lecorguille : addition of Scan 43 08/02/2010 - lecorguille : addition of BioSourceDescription 44 19 45 */ 20 46 public enum Tab2MageConstants … … 112 138 array_serial(26,"Array[serial]"), 113 139 140 scan(52, "Scan"), 141 114 142 hybridization(27, "Hybridization"), 115 143 … … 123 151 124 152 biosource(32, "BioSource"), 153 154 biosourcedescription(32, "BioSourceDescription"), 125 155 126 156 protocol_transformation(33,"Protocol[transformation]"), -
Property
svn:keywords
set to
-
plugins/base2/uk.ac.ebi.tab2mage/trunk/Tab2MageExporter/src/uk/ac/ebi/nugo/common/ValueFormatter.java
-
Property
svn:keywords
set to
Id
r449 r1188 1 /* 2 This file is for NutriBASE - Nutrigenomics BioArray Software Environment. 1 /* $Id$ 2 3 Copyright (C) 2007, 2010 Authors contributing to this file. 4 5 This file is for NutriBASE - Nutrigenomics BioArray Software Environment. 3 6 A customisation of the BASE SOFTWARE. 4 Developed at the EBI , Cambridge. 5 Author: Dominic Oyeniran: oyeniran@ebi.ac.uk 6 */ 7 8 BASE is free software; you can redistribute it and/or 9 modify it under the terms of the GNU General Public License 10 as published by the Free Software Foundation; either version 2 11 of the License, or (at your option) any later version. 12 13 BASE is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 GNU General Public License for more details. 17 18 You should have received a copy of the GNU General Public License 19 along with this program; if not, write to the Free Software 20 Foundation, Inc., 59 Temple Place - Suite 330, 21 Boston, MA 02111-1307, USA. 22 */ 23 7 24 package uk.ac.ebi.nugo.common; 8 25 … … 19 36 @email oyeniran@ebi.ac.uk 20 37 @version 1.0 38 39 40 @author Gildas Le Corguillé 41 @email lecorguille@sb-roscoff.fr 42 @version 1.01 43 44 ChangeLog : 45 05/02/2010 - lecorguille : addition of getStringWithoutLineBreaker() 21 46 */ 22 47 … … 24 49 { 25 50 26 p rivatestatic final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd");51 public static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd"); 27 52 28 53 /** … … 72 97 return obj; 73 98 } 99 100 /** 101 * @author lecorguille 102 This methods replace line breakers by space or nothing 103 @param str<String> 104 @return <String> 105 */ 106 public static final String getStringWithoutLineBreaker (String str) 107 { 108 String myreturn = new String(); 109 if (str != null && str != ""){ 110 myreturn = str.replaceAll("\n", " ").replaceAll("\r", ""); 111 } 112 return myreturn; 113 } 74 114 75 115 /** … … 97 137 return value; 98 138 } 99 100 101 139 102 140 } -
Property
svn:keywords
set to
-
plugins/base2/uk.ac.ebi.tab2mage/trunk/Tab2MageExporter/src/uk/ac/ebi/nugo/plugins/Tab2MageExporter.java
-
Property
svn:keywords
set to
Id
r488 r1188 1 /* $Id : Tab2MageExporter.java 2007-09-01 dominic$2 3 Copyright (C) 2007 Authors contributing to this file.1 /* $Id$ 2 3 Copyright (C) 2007, 2010 Authors contributing to this file. 4 4 5 5 This file is for NutriBASE - Nutrigenomics BioArray Software Environment. … … 24 24 25 25 26 import java.io.Writer;27 26 import java.util.ArrayList; 28 27 import java.util.Arrays; … … 35 34 import java.util.concurrent.ConcurrentHashMap; 36 35 37 import net.sf.basedb.core.Affymetrix;38 36 import net.sf.basedb.core.Annotatable; 39 37 import net.sf.basedb.core.Annotation; … … 80 78 import uk.ac.ebi.nugo.common.Helper; 81 79 import uk.ac.ebi.nugo.common.Tab2MageConstants; 80 import uk.ac.ebi.nugo.common.ValueFormatter; 82 81 import uk.ac.ebi.nugo.plugins.ta2mageexport.ExportHelper; 83 82 import uk.ac.ebi.nugo.plugins.ta2mageexport.Tab2MageFileWriter; … … 92 91 @email oyeniran@ebi.ac.uk /doyeniran@gmail.com 93 92 @version 1.0 93 94 95 @author Gildas Le Corguillé 96 @email lecorguille@sb-roscoff.fr 97 @version 1.01 98 99 ChangeLog : 100 05/02/2010 - lecorguille : modification of a lot of things about pooling depending of the other class 101 now, lines are repeated if there are several files per RawBioAssay or pooling of Sample, Extract or LabeledExtract 102 Tab2Mage format doesn't support pooling like Base2 does : 103 - Base2 pool 2 Samples in a Ref Sample 104 - Tab2Mage format pool 2 BioSources in the Ref Sample 105 08/02/2010 - lecorguille : addition of BioSourceDescription 94 106 95 107 */ … … 277 289 Set<String> hybSectionHeader= new LinkedHashSet<String>(); 278 290 Set<String> protocolHybSectionHeader= new LinkedHashSet<String>(); 279 291 280 292 boolean overwrite = false; 281 293 … … 284 296 dc=sc.newDbControl(); 285 297 User user = User.getById(dc, sc.getLoggedInUserId()); 298 299 300 /* -- output files -- */ 286 301 if ((Boolean)job.getValue("overwrite") != null) overwrite = (Boolean)job.getValue("overwrite"); 287 302 String p = (String)job.getValue("exportPath"); … … 289 304 String statusp=(String)job.getValue("statusPath"); 290 305 File statusFile=Helper.processFilePath(user,overwrite, dc,statusp); 306 Tab2MageFileWriter.createFileWriters(file, statusFile); 307 308 309 /* --- Experiment --- */ 291 310 Experiment experiment= (Experiment)job.getValue("experiment"); 292 experiment= Experiment.getById(dc,experiment.getId()); 293 311 experiment= Experiment.getById(dc,experiment.getId()); 312 294 313 // check if the logged in user owned the experiment, if not the export exit with a message. 295 296 if (!(experiment.getOwner().equals(user))) 297 { 314 if (!(experiment.getOwner().equals(user))) { 298 315 response.setError("[EXPORT FAILED: User - "+user.getName()+ " do not own this experiment or have permission to export it].", Arrays.asList(new Throwable())); 299 316 return; 300 317 } 301 if (experiment.getExperimentalFactors().list(dc).size()==0) 302 { 318 if (experiment.getExperimentalFactors().list(dc).size()==0) { 303 319 response.setError("[EXPORT FAILED: Experimental factors have not been specified for this experiment].", Arrays.asList(new Throwable())); 304 320 return; 305 321 } 306 307 // check that raw bio assays have been added to experiment, otherwise fails308 322 323 324 /* --- RawBioAssay --- */ 309 325 ItemQuery<RawBioAssay> rawBioAssaysQuery = experiment.getRawBioAssays(); 310 326 rawBioAssaysQuery.order(Orders.asc(Hql.property("name"))); 311 327 ItemResultList<RawBioAssay> rawBioAssays= rawBioAssaysQuery.list(dc); 312 if (rawBioAssays==null || rawBioAssays.size()==0) 313 { 328 329 // check that raw bio assays have been added to experiment, otherwise fails 330 if (rawBioAssays==null || rawBioAssays.size()==0) { 314 331 response.setError("[EXPORT FAILED: Experiment - "+ experiment+ " do not have a rawbiosay specified].",Arrays.asList(new Throwable())); 315 332 return; 316 333 } 317 334 318 // create all the required writers for the status file and the export file 319 320 Tab2MageFileWriter.createFileWriters(file, statusFile); 321 322 //initialise, count resources used, create concurrentmap for all parameter and biomaterial headers 323 Tab2MageValidator validator = new Tab2MageValidator (experiment, sc, response); 324 325 //Tab2MageHybridization hybridization= new Tab2MageHybridization (); 335 336 // initialise, count resources used, create concurrentmap for all parameter and biomaterial headers 337 Tab2MageValidator validator = new Tab2MageValidator (rawBioAssays, sc, response); 338 326 339 327 340 for (RawBioAssay rba : rawBioAssays) 328 341 { 329 // create the Tab2MageHybridization object 330 Tab2MageHybridization hybridization= new Tab2MageHybridization (); 331 // create the Tab2MageHybridizationLine object 332 Tab2MageHybridizationLine hybRow = new Tab2MageHybridizationLine(); 333 334 // set the number of channels for the Hybridization 335 hybridization.setChannelNumber(validator.getChannelNumber()); // mainly useful during the writing stage 336 337 /* 338 Experimental Factor Section 339 */ 340 AnnotationSet annotationSet =rba.isAnnotated() ? rba.getAnnotationSet() : null; 341 ItemQuery<AnnotationType> experimentalFactorsQuery= experiment.getExperimentalFactors(); 342 experimentalFactorsQuery.include(Include.MINE, Include.SHARED, Include.OTHERS, Include.IN_PROJECT, Include.NOT_REMOVED); 343 ItemResultList<AnnotationType> experimentalFactors = experimentalFactorsQuery.list(dc); 344 for (AnnotationType exprFactor :experimentalFactors) 345 { 346 if (!exprFactor.isRemoved()) 342 Set<Tab2MageHybridizationLine> hybRows = ExportHelper.getRawBioAssayFiles(rba, dc, response); 343 for (Tab2MageHybridizationLine hybRow : hybRows) { 344 345 346 /* --- Array design ---*/ 347 ArrayDesign arrayDesign = rba.getArrayDesign(); 348 hybRow.set("Array",Tab2MageConstants.array_accession.getName(),arrayDesign.getName()); 349 setProtocolAndParameterAtrributes(hybRow,rba,Tab2MageValidator.getFeProtocolCount(), Tab2MageConstants.protocol_featureextraction.getName(), response, dc); 350 351 352 /* --- Scan --- */ 353 Scan scan= rba.getScan(); 354 hybRow.set(Tab2MageConstants.scan.getName(), null,scan.getName()); 355 setProtocolAndParameterAtrributes(hybRow,scan,Tab2MageValidator.getScanningProtocolCount(), Tab2MageConstants.protocol_scanning.getName(),response, dc); 356 357 358 /* --- Experimental factor section --- */ 359 AnnotationSet annotationSet = rba.isAnnotated() ? rba.getAnnotationSet() : null; 360 ItemQuery<AnnotationType> experimentalFactorsQuery = experiment.getExperimentalFactors(); 361 experimentalFactorsQuery.include(Include.MINE, Include.SHARED, Include.OTHERS, Include.IN_PROJECT, Include.NOT_REMOVED); 362 ItemResultList<AnnotationType> experimentalFactors = experimentalFactorsQuery.list(dc); 363 for (AnnotationType exprFactor :experimentalFactors) 347 364 { 348 if (annotationSet!=null) 349 { 350 Annotation an= annotationSet.findAnnotation(exprFactor); 351 /* 352 Please use the line below instead of the one above for base 2.5 API to get inherited annotation types. 353 Annotation an = annotationSet.findAnnotations(exprFactor); 354 List<Annotation> findAnnotations(dc, exprFactor, true); 355 Loop through the list.....needs more check 356 */ 357 358 if (an!=null) //exprFacor has annotations 359 { 360 List<?> values= an.getValues(); 361 hybRow.set("FactorValue", exprFactor.getName(), values==null || values.size()==0 ? "" : Values.getString(values, ", ", true)); 365 if (!exprFactor.isRemoved()) { 366 if (annotationSet!=null) { 367 Annotation an= annotationSet.findAnnotation(exprFactor); 368 /* 369 Please use the line below instead of the one above for base 2.5 API to get inherited annotation types. 370 Annotation an = annotationSet.findAnnotations(exprFactor); 371 List<Annotation> findAnnotations(dc, exprFactor, true); 372 Loop through the list.....needs more check 373 */ 374 375 if (an!=null) { //exprFacor has annotations 376 List<?> values= an.getValues(); 377 hybRow.set("FactorValue", exprFactor.getName(), values==null || values.size()==0 ? "" : Values.getString(values, ", ", true)); 378 } 379 else { // exprFactor has no annotations 380 hybRow.set("FactorValue", exprFactor.getName(), "" ); 381 } 362 382 } 363 else // exprFactor has no annotations 364 { 383 else { //The raw bio assay is not annotated 365 384 hybRow.set("FactorValue", exprFactor.getName(), "" ); 366 385 } 367 386 } 368 else //The raw bio assay is not annotated369 {370 hybRow.set("FactorValue", exprFactor.getName(), "" );371 }372 387 } 373 } 374 375 //Array Design 376 ArrayDesign arrayDesign = null; 377 try 378 { 379 arrayDesign= rba.getArrayDesign(); 380 } 381 catch(Throwable tr) 382 { 383 response.setError("[EXPORT FAILED: All Array Design(s) must be provided in BASE to continue].",Arrays.asList(tr)); 384 } 385 // Populate the Array file map in HybLine 386 setArraysAttributes(hybRow, arrayDesign ); 387 388 // Populate the Data file map in HybLine 389 setFileAttributes(hybRow, arrayDesign, rba, response); 390 391 //Raw BioAssay protocol and parameter 392 setProtocolAndParameterAtrributes(hybRow,rba,Tab2MageValidator.getFeProtocolCount(), 393 Tab2MageConstants.protocol_featureextraction.getName(), response, dc); 394 395 //Scanning Protocol and Parameters 396 Scan scan= rba.getScan(); 397 setProtocolAndParameterAtrributes(hybRow,scan,Tab2MageValidator.getScanningProtocolCount(), 398 Tab2MageConstants.protocol_scanning.getName(),response, dc); 399 400 /* 401 Array Slide 402 */ 403 Hybridization hyb= scan.getHybridization(); 404 if (hyb.getArraySlide()==null) 405 { 406 response.setError("[Export Failed] please add an array slide for Hybridization:"+hyb.getName(), Arrays.asList(new Throwable())); 407 return; 408 } 409 else 410 { 388 389 390 391 /* --- Hybridization --- */ 392 Hybridization hyb = scan.getHybridization(); 393 hybRow.set(Tab2MageConstants.hybridization.getName(), null,hyb.getName()); 394 setProtocolAndParameterAtrributes(hybRow,hyb,Tab2MageValidator.getHybridizationProtocolCount(), Tab2MageConstants.protocol_hyb.getName(), response, dc); 395 396 /* --- Array slide --- */ 411 397 hybRow.set("Array","serial", hyb.getArraySlide().getName()); 412 } 413 414 /* 415 Hybridization 416 */ 417 hybRow.set(Tab2MageConstants.hybridization.getName(), null,hyb.getName()); 418 BioMaterialEvent bioMaterialEvent= hyb.getCreationEvent(); // an event that created the hyridization 419 420 // Hybridization protocol and parameter 421 setProtocolAndParameterAtrributes(hybRow,hyb,Tab2MageValidator.getHybridizationProtocolCount(), 422 Tab2MageConstants.protocol_hyb.getName(), response, dc); 423 424 ItemQuery<LabeledExtract> labeledExtractQuery =(ItemQuery<LabeledExtract>) bioMaterialEvent.getSources(); // get all the labeled extract 425 ItemResultList<LabeledExtract> labeledExtracts= labeledExtractQuery .list(dc); 426 int size = labeledExtracts.size(); 427 428 // create the Tab2MageSubHybLine object List 429 List<Tab2MageSubHybLine> subLines = new ArrayList<Tab2MageSubHybLine>(); 430 431 int count=1; // initialise the count variable to 1 432 // Loop through all the labeled extracts 433 for (LabeledExtract labeledExtract :labeledExtracts) // can have more than one labeled extract (e.g. 2 color experiments) 434 { 435 //create the new SubHyb Line 436 Tab2MageSubHybLine subLine = new Tab2MageSubHybLine(); 437 438 /* 439 labeled extract 440 */ 441 Protocol lbExtractProtocol= labeledExtract.getCreationEvent().getProtocol(); 442 subLine.set(Tab2MageConstants.labeledextract.getName(), null, labeledExtract.getName()); 443 444 // labelling protocol and parameter 445 setProtocolAndParameterAtrributes(dc, subLine,labeledExtract,Tab2MageValidator.getLabelingProtocolCount(), 446 Tab2MageConstants.protocol_labeling.getName(),lbExtractProtocol, response); 447 /* 448 Label 449 */ 450 String labelName= labeledExtract.getLabel().getName(); // the name of the label 451 subLine.set(Tab2MageConstants.dye.getName(), null,labelName); 452 453 /* 454 Extract 455 */ 456 457 Extract extract= ExportHelper.getExtract(labeledExtract, dc); 458 if (extract!=null) 459 { 460 Protocol extractProtocol =extract.getCreationEvent().getProtocol(); //extract protocol 461 subLine.set(Tab2MageConstants.extract.getName(), null, extract.getName()); 398 399 // create the Tab2MageSubHybLine object List 400 List<Tab2MageSubHybLine> subLines = new ArrayList<Tab2MageSubHybLine>(); 401 402 /* --- labeled extract --- */ 403 BioMaterialEvent bioMaterialEvent= hyb.getCreationEvent(); // an event that created the hyridization 404 ItemQuery<LabeledExtract> labeledExtractQuery =(ItemQuery<LabeledExtract>) bioMaterialEvent.getSources(); // get all the labeled extract 405 ItemResultList<LabeledExtract> labeledExtracts= labeledExtractQuery.list(dc); 406 int size = labeledExtracts.size(); 407 for (LabeledExtract labeledExtract :labeledExtracts) { // can have more than one labeled extract (e.g. 2 color experiments) 408 409 /* --- Label --- */ 410 String labelName = labeledExtract.getLabel().getName(); // the name of the label 411 462 412 463 // extraction protocol and parameter 464 setProtocolAndParameterAtrributes(dc, subLine,extract,Tab2MageValidator.getExtractProtocolCount(), 465 Tab2MageConstants.protocol_extraction.getName(), extractProtocol, response); 466 } 467 468 /* 469 Sample 470 */ 471 472 Sample sample= ExportHelper.getSample(extract, dc); 473 if (sample != null) 474 { 475 Protocol sampleProtocol=sample.getCreationEvent().getProtocol(); //sampling protocol 476 subLine.set(Tab2MageConstants.sample.getName(), null, sample.getName()); 477 478 // sampling protocol and parameter 479 setProtocolAndParameterAtrributes(dc, subLine,sample,Tab2MageValidator.getSamplingProtocolCount(), 480 Tab2MageConstants.protocol_treatment.getName(),sampleProtocol, response ); 481 } 482 483 /* 484 Biosource 485 */ 486 487 BioSource bioSource=ExportHelper.getBioSource(sample, dc); 488 if (bioSource != null) 489 { 490 subLine.set(Tab2MageConstants.biosource.getName(), null, bioSource.getName()); 491 492 //section for biomaterial xterixtics 493 ItemQuery<Annotation> query = bioSource.getAnnotationSet().getAnnotations(); 494 query.include(Include.MINE, Include.NOT_REMOVED, Include.IN_PROJECT,Include.SHARED); 495 List<Annotation> annotations = query.list(dc); 496 for (Annotation annotation: annotations) 497 { 498 AnnotationType at=annotation.getAnnotationType(); 499 if(!at.isRemoved()) 500 { 501 List<?> values= annotation==null? null:annotation.getValues(); 502 subLine.set(Tab2MageConstants.bio_mat_charact.getName(), annotation.getAnnotationType().getName(), 503 values==null || values.size()==0 ? ExportHelper.getDefaultValue(at) : Values.getString(values, ", ", true)); 413 /* --- Extracts --- */ 414 Set<Extract> extracts = ExportHelper.getExtracts(labeledExtract, dc); 415 for (Extract extract : extracts) { 416 417 /* --- Samples --- */ 418 Set<Sample> samples = ExportHelper.getSamples(extract, dc); 419 for (Sample sample : samples) { 420 421 /* --- Biosources --- */ 422 Set<BioSource> bioSources = ExportHelper.getBioSources(sample, dc); 423 for (BioSource bioSource : bioSources) { 424 425 //create the new SubHyb Line 426 Tab2MageSubHybLine subLine = new Tab2MageSubHybLine(); 427 428 subLine.set(Tab2MageConstants.labeledextract.getName(), null, labeledExtract.getName()); 429 setProtocolAndParameterAtrributes(subLine,labeledExtract,Tab2MageValidator.getLabelingProtocolCount(), Tab2MageConstants.protocol_labeling.getName(),response, dc); 430 subLine.set(Tab2MageConstants.dye.getName(), null,labelName); 431 subLine.set(Tab2MageConstants.extract.getName(), null, extract.getName()); 432 setProtocolAndParameterAtrributes(subLine,extract,Tab2MageValidator.getExtractProtocolCount(), Tab2MageConstants.protocol_extraction.getName(), response, dc); 433 subLine.set(Tab2MageConstants.sample.getName(), null, sample.getName()); 434 setProtocolAndParameterAtrributes(subLine,sample,Tab2MageValidator.getSamplingProtocolCount(), Tab2MageConstants.protocol_treatment.getName(), response, dc); 435 subLine.set(Tab2MageConstants.biosource.getName(), null, bioSource.getName()); 436 subLine.set(Tab2MageConstants.biosourcedescription.getName(), null, ValueFormatter.getStringWithoutLineBreaker(bioSource.getDescription())); 437 438 //section for biomaterial xterixtics 439 ItemQuery<Annotation> query = bioSource.getAnnotationSet().getAnnotations(); 440 query.include(Include.MINE, Include.NOT_REMOVED, Include.IN_PROJECT,Include.SHARED); 441 List<Annotation> annotations = query.list(dc); 442 for (Annotation annotation: annotations) 443 { 444 AnnotationType at=annotation.getAnnotationType(); 445 if(!at.isRemoved()) 446 { 447 List<?> values= annotation==null? null:annotation.getValues(); 448 subLine.set(Tab2MageConstants.bio_mat_charact.getName(), annotation.getAnnotationType().getName(), 449 values==null || values.size()==0 ? ExportHelper.getDefaultValue(at) : Values.getString(values, ", ", true)); 450 } 451 } 452 453 454 subLines.add(subLine); //make a list of subLines 455 } 504 456 } 505 457 } 506 } 507 508 subLines.add(subLine); //make a list of subLines 509 count++; 510 } //end of labeled extract loop 511 512 hybRow.addHybSubLines(size, hybRow.getName(), subLines); // add the subLines (i.e. Tab2MageSubHybLine objectc list to Tab2MageHybridizationLine Object 513 514 hybridization.addLine(hybRow); // add Tab2MageHybridizationLine Object to Tab2MageHybridization object 515 if(!hybs.contains(hybridization)) 516 hybs.add(hybridization); // add Tab2MageHybridization Object to the List of Tab2MageHybridization object 458 } //end of labeled extract loop 459 hybRow.addHybSubLines(size, hybRow.getName(), subLines); // add the subLines (i.e. Tab2MageSubHybLine object list to Tab2MageHybridizationLine Object 460 461 462 // create the Tab2MageHybridization object 463 Tab2MageHybridization hybridization= new Tab2MageHybridization (); 464 // set the number of channels for the Hybridization 465 hybridization.setChannelNumber(validator.getChannelNumber()); // mainly useful during the writing stage 466 hybridization.addLine(hybRow); // add Tab2MageHybridizationLine Object to Tab2MageHybridization object 467 if(!hybs.contains(hybridization)) 468 hybs.add(hybridization); // add Tab2MageHybridization Object to the List of Tab2MageHybridization object 469 } 517 470 518 471 }// end of raw biossay for loop 519 520 472 // create headers for biomaterial xteristics 521 473 Set<String> bioMatHeaders = new LinkedHashSet<String>(); … … 547 499 factorValueHeaders.addAll(ExportHelper.getHeaderWithValuesOnly(l.getFactorValues())); 548 500 } 549 550 501 /* 551 502 Create all the used protocols objects 552 503 */ 553 504 protocols = ExportHelper.createProtocols(rawBioAssays, dc); 554 555 505 /* 556 506 create all used Tab2Mage Hybridization sections protocol headers 557 507 */ 558 508 protocolHybSectionHeader= Tab2MageValidator.getProtocolHybSectionHeader(); 559 560 509 /* 561 510 Create Tab2Mage Hybridization Section Header … … 570 519 Tab2MageFileWriter.writeTab2MageFile(experiment, protocols,hybs, hybSectionHeader,bioMatHeaders, 571 520 protocolHybSectionHeader, paramHeaders,factorValueHeaders, job, response, dc); 572 573 //statusOut.close(); 574 Writer out= Tab2MageFileWriter.getOut(); 575 out.flush(); 576 out.close(); 521 Tab2MageFileWriter.getStatusOut().write("DONE\n"); 522 Tab2MageFileWriter.closeWriter(); 523 577 524 dc.commit(); 578 525 response.setDone("Experiment " + experiment.getName() + " exported successfully"); … … 580 527 catch (Throwable ex) 581 528 { 529 Tab2MageFileWriter.closeWriter(); 582 530 response.setError(ex.getMessage(), Arrays.asList(ex)); 583 531 } 584 532 finally 585 533 { 534 Tab2MageFileWriter.closeWriter(); 586 535 if (dc != null) dc.close(); 587 536 } 588 537 } 589 590 /** 591 set the array attributes of the the <code>Tab2MageHybridizationLine</code> object 592 @param hybRow, the <code>Tab2MageHybridizationLine</code> object 593 @param arrayDesign, the Array Design 594 */ 595 private void setArraysAttributes (Tab2MageHybridizationLine hybRow, ArrayDesign arrayDesign ) 596 { 597 hybRow.set("Array",Tab2MageConstants.array_accession.getName(),arrayDesign.getName()); 598 } 599 600 /** 601 set the file attributes of the the <code>Tab2MageHybridizationLine</code> object 602 @param hybRow, the Tab2MageHybridizationLine object 603 @param arrayDesign, the Array Design 604 @param rba, the raw bio assay 605 @param response, the response object to return errors in case of failure during the setting of file values 606 */ 607 private void setFileAttributes(Tab2MageHybridizationLine hybRow, ArrayDesign arrayDesign, RawBioAssay rba, Response response) 608 { 609 try 610 { 611 if (arrayDesign.isAffyChip()) 612 { 613 File cdfFile= Affymetrix.getCdfFile(arrayDesign); 614 File celFile=Affymetrix.getCelFile(rba); 615 hybRow.set("File", Tab2MageConstants.raw_file.getName(), celFile.getName()); 616 hybRow.set("File",Tab2MageConstants.cdf_file.getName(), cdfFile.getName()); 617 } 618 else 619 { 620 hybRow.set("File", Tab2MageConstants.raw_file.getName(), rba.getName()); 621 } 622 623 } 624 catch(Throwable tr) 625 { 626 response.setError(tr.getMessage(), Arrays.asList(tr)); 627 } 628 } 538 629 539 /** 630 540 set the protocol and parameters attributes/values for Labeling -to- Sampling protocol and parameters … … 637 547 @param response, the response object to return errors in case of failure during the setting of parameter values 638 548 */ 639 private void setProtocolAndParameterAtrributes( DbControl dc,Tab2MageSubHybLine subLine, Annotatable anotatable, int protocolCount, String keyEntry, Protocol protocol, Response response)549 private void setProtocolAndParameterAtrributes(Tab2MageSubHybLine subLine, Annotatable anotatable, int protocolCount, String keyEntry, Response response, DbControl dc) 640 550 { 641 551 if (protocolCount>0) 642 552 { 643 subLine.set("Protocol",keyEntry,ExportHelper.getFormattedProtocolId( protocol));553 subLine.set("Protocol",keyEntry,ExportHelper.getFormattedProtocolId(anotatable.getProtocol())); 644 554 } 645 555 … … 662 572 if (protocolCount>0) 663 573 { 664 hybRow.set("Protocol", keyEntry,ExportHelper.getFormattedProtocolId(anotatable.getProtocol()));574 hybRow.set("Protocol",keyEntry,ExportHelper.getFormattedProtocolId(anotatable.getProtocol())); 665 575 } 666 576 // protocol parameter -
Property
svn:keywords
set to
-
plugins/base2/uk.ac.ebi.tab2mage/trunk/Tab2MageExporter/src/uk/ac/ebi/nugo/plugins/ta2mageexport/ExportHelper.java
-
Property
svn:keywords
set to
Id
r449 r1188 1 /* $Id$ 2 3 Copyright (C) 2007, 2010 Authors contributing to this file. 4 5 This file is for NutriBASE - Nutrigenomics BioArray Software Environment. 6 A customisation of the BASE SOFTWARE. 7 8 BASE is free software; you can redistribute it and/or 9 modify it under the terms of the GNU General Public License 10 as published by the Free Software Foundation; either version 2 11 of the License, or (at your option) any later version. 12 13 BASE is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 GNU General Public License for more details. 17 18 You should have received a copy of the GNU General Public License 19 along with this program; if not, write to the Free Software 20 Foundation, Inc., 59 Temple Place - Suite 330, 21 Boston, MA 02111-1307, USA. 22 */ 23 1 24 package uk.ac.ebi.nugo.plugins.ta2mageexport; 2 25 26 import java.util.Arrays; 3 27 import java.util.LinkedHashSet; 4 28 import java.util.List; … … 6 30 import java.util.Set; 7 31 32 import net.sf.basedb.core.Affymetrix; 8 33 import net.sf.basedb.core.Annotatable; 9 34 import net.sf.basedb.core.AnnotationType; 35 import net.sf.basedb.core.ArrayDesign; 10 36 import net.sf.basedb.core.BaseException; 11 37 import net.sf.basedb.core.BioSource; … … 13 39 import net.sf.basedb.core.Directory; 14 40 import net.sf.basedb.core.Extract; 41 import net.sf.basedb.core.File; 42 import net.sf.basedb.core.FileSetMember; 15 43 import net.sf.basedb.core.Hybridization; 44 import net.sf.basedb.core.ItemQuery; 16 45 import net.sf.basedb.core.ItemResultList; 17 46 import net.sf.basedb.core.LabeledExtract; … … 23 52 import net.sf.basedb.core.SessionControl; 24 53 import net.sf.basedb.core.User; 54 import net.sf.basedb.core.plugin.Response; 25 55 import uk.ac.ebi.nugo.common.Tab2MageConstants; 26 56 … … 30 60 @author Dominic Oyeniran 31 61 @version 1.0 62 63 64 @author Gildas Le Corguillé 65 @email lecorguille@sb-roscoff.fr 66 @version 1.01 67 68 ChangeLog : 69 05/02/2010 - lecorguille : modifification of the getItems fonctions to allow pooling 70 05/02/2010 - lecorguille : substitution of RawBioAssay names in the File[Raw] be the filenames 71 32 72 */ 33 73 34 74 public class ExportHelper 35 75 { 36 public static Set<Sample> getSamples(Annotatable item, DbControl dc) 76 77 /** 78 * @deprecated by lecorguille 79 * @param item 80 * @param dc 81 * @return 82 */ 83 public static Set<Sample> getSamplesBk(Annotatable item, DbControl dc) 37 84 { 38 85 Set<Sample> itemList= new LinkedHashSet<Sample>(); … … 54 101 55 102 /** 103 * @deprecated by lecorguille 56 104 gets a sample from extract. 57 105 returns the first item at random, if extract is pooled … … 60 108 @return Sample 61 109 */ 62 public static Sample getSample (Annotatable extract, DbControl dc)110 public static Sample getSampleBk(Annotatable extract, DbControl dc) 63 111 { 64 112 Sample sample=null; … … 87 135 88 136 /** 137 * @deprecated by lecorguille 89 138 gets an extract from a labeled extract. 90 139 returns the first item at random, if labeled extract is pooled … … 93 142 @return extract 94 143 */ 95 public static Extract getExtract (Annotatable labeledExtract, DbControl dc)144 public static Extract getExtractBk(Annotatable labeledExtract, DbControl dc) 96 145 { 97 146 Extract extract=null; … … 118 167 return extract; 119 168 } 120 121 122 public static Set<Extract> getExtracts(Annotatable item, DbControl dc) 123 { 124 Set<Extract> itemList= new LinkedHashSet<Extract>(); 125 Set<Annotatable> pooledObjects= item.getAnnotatableParents(); 126 for (Annotatable pooled: pooledObjects) 127 { 128 if (pooled instanceof LabeledExtract) 129 { 130 Set<Annotatable> extracts= pooled.getAnnotatableParents(); 131 for (Annotatable extractItem: extracts) 132 { 133 Extract extract= Extract.getById(dc, extractItem.getId()); 134 itemList.add(extract); 135 } 136 } 137 } 138 return itemList; 139 } 140 141 142 public static Set<BioSource> getBiosources(MeasuredBioMaterial item, DbControl dc) 169 170 /** 171 * @deprecated by lecorguille 172 * @param item 173 * @param dc 174 * @return 175 */ 176 public static Set<BioSource> getBiosourcesBk(MeasuredBioMaterial item, DbControl dc) 143 177 { 144 178 Set<BioSource> bioSourceList= new LinkedHashSet<BioSource>(); … … 159 193 } 160 194 161 162 /**195 /** 196 * @deprecated by lecorguille 163 197 gets a biosource from sample. 164 198 returns the first item at random, if sample is pooled … … 167 201 @return BioSource 168 202 */ 169 170 public static BioSource getBioSource(Annotatable sample, DbControl dc) 203 public static BioSource getBioSourceBk(Annotatable sample, DbControl dc) 171 204 { 172 205 BioSource biosource=null; … … 194 227 195 228 } 229 230 /** 231 * @author lecorguille 232 * Return a Extract from a non-pooling LabeledExtract. 233 * @param labeledExtract 234 * @param dc the database control 235 * @return Extract 236 */ 237 private static Extract getExtract(LabeledExtract labeledExtract, DbControl dc) { 238 Extract extract=null; 239 240 Set<Annotatable> extractAnnots = labeledExtract.getAnnotatableParents(); 241 for (Annotatable extractAnnot : extractAnnots) { 242 extract = Extract.getById(dc, extractAnnot.getId()); 243 } 244 return extract; 245 } 246 247 /** 248 * @author lecorguille 249 * Return a set of Extract from a LabeledExtract. 250 * this method can return several Extracts if there is a LabeledExtract pooling 251 * @param labeledExtract 252 * @param dc the database control 253 * @return Set<Extract> 254 */ 255 public static Set<Extract> getExtracts(LabeledExtract labeledExtract, DbControl dc) { 256 257 Set<Extract> itemList= new LinkedHashSet<Extract>(); 258 259 // not pooled 260 if (!labeledExtract.isPooled()) { 261 itemList.add(getExtract(labeledExtract, dc)); 262 } 263 // pooled 264 else { 265 Set<Annotatable> labeledExtractPoolAnnots = labeledExtract.getAnnotatableParents(); 266 for (Annotatable labeledExtractPoolAnnot : labeledExtractPoolAnnots) { 267 LabeledExtract labeledExtractPooled = LabeledExtract.getById(dc, labeledExtractPoolAnnot.getId()); 268 itemList.add(getExtract(labeledExtractPooled, dc)); 269 } 270 } 271 272 return (itemList); 273 } 274 275 /** 276 * @author lecorguille 277 * Return a Sample from a non-pooling Extract. 278 * @param extract 279 * @param dc the database control 280 * @return Sample 281 */ 282 private static Sample getSample(Extract extract, DbControl dc) { 283 Sample sample=null; 284 285 Set<Annotatable> sampleAnnots = extract.getAnnotatableParents(); 286 for (Annotatable sampleAnnot : sampleAnnots) { 287 sample = Sample.getById(dc, sampleAnnot.getId()); 288 } 289 return sample; 290 } 291 292 /** 293 * @author lecorguille 294 * Return a set of Sample from a Extract. 295 * this method can return several Samples if there is a Extract pooling 296 * @param extract 297 * @param dc the database control 298 * @return Set<Sample> 299 */ 300 public static Set<Sample> getSamples(Extract extract, DbControl dc) 301 { 302 Set<Sample> itemList= new LinkedHashSet<Sample>(); 303 304 // not pooled 305 if (!extract.isPooled()) { 306 itemList.add(getSample(extract, dc)); 307 } 308 // pooled 309 else { 310 Set<Annotatable> extractPoolAnnots = extract.getAnnotatableParents(); 311 for (Annotatable extractPoolAnnot : extractPoolAnnots) { 312 Extract extractPooled = Extract.getById(dc, extractPoolAnnot.getId()); 313 itemList.add(getSample(extractPooled, dc)); 314 } 315 } 316 317 return (itemList); 318 } 319 320 /** 321 * @author lecorguille 322 * Return a Biosource from a non-pooling Sample. 323 * @param sample 324 * @param dc the database control 325 * @return BioSource 326 */ 327 private static BioSource getBioSource(Sample sample, DbControl dc) { 328 BioSource bioSource=null; 329 330 Set<Annotatable> bioSourceAnnots = sample.getAnnotatableParents(); 331 for (Annotatable bioSourceAnnot : bioSourceAnnots) { 332 bioSource = BioSource.getById(dc, bioSourceAnnot.getId()); 333 } 334 return bioSource; 335 } 336 337 /** 338 * @author lecorguille 339 * Return a set of Biosource from a Sample. 340 * this method can return several Biosources if there is a Sample pooling 341 * @param sample 342 * @param dc the database control 343 * @return Set<BioSource> 344 */ 345 public static Set<BioSource> getBioSources(Sample sample, DbControl dc) 346 { 347 Set<BioSource> itemList= new LinkedHashSet<BioSource>(); 348 349 // not pooled 350 if (!sample.isPooled()) { 351 itemList.add(getBioSource(sample, dc)); 352 } 353 // pooled 354 else { 355 Set<Annotatable> samplePoolAnnots = sample.getAnnotatableParents(); 356 for (Annotatable samplePoolAnnot : samplePoolAnnots) { 357 Sample samplePooled = Sample.getById(dc, samplePoolAnnot.getId()); 358 itemList.add(getBioSource(samplePooled, dc)); 359 } 360 } 361 362 return (itemList); 363 } 364 365 /** 366 * @author lecorguille 367 * Return a set of Tab2MageHybridizationLine from a RawBioAssay. 368 * This method can return several lines if there is several Files for the RawBioAssay (ex: Nimblegen 2 channels <=> 2 files per scan) 369 * @param rba 370 * @param dc the database control 371 * @param response 372 * @return Set<Tab2MageHybridizationLine> 373 * @TODO use non-deprecated methods for Affymetrix 374 * @TODO it's not very clean but it's work without huge modifications 375 */ 376 public static Set<Tab2MageHybridizationLine> getRawBioAssayFiles(RawBioAssay rba, DbControl dc, Response response) { 377 Set<Tab2MageHybridizationLine> itemList= new LinkedHashSet<Tab2MageHybridizationLine>(); 378 379 try 380 { 381 if (rba.getArrayDesign().isAffyChip()) 382 { 383 Tab2MageHybridizationLine hybRow = new Tab2MageHybridizationLine(); 384 385 File celFile=Affymetrix.getCelFile(rba); 386 File cdfFile= Affymetrix.getCdfFile(rba.getArrayDesign()); 387 388 hybRow.set("File", Tab2MageConstants.raw_file.getName(), celFile.getName()); 389 hybRow.set("File",Tab2MageConstants.cdf_file.getName(), cdfFile.getName()); 390 391 itemList.add(hybRow); 392 } 393 else 394 { 395 ItemQuery<FileSetMember> fileSetMemberQuery =(ItemQuery<FileSetMember>) rba.getFileSet().getMembers(); // get all the labeled extract 396 ItemResultList<FileSetMember> fileSetMembers= fileSetMemberQuery.list(dc); 397 398 for (FileSetMember fileSetMember :fileSetMembers) { 399 Tab2MageHybridizationLine hybRow = new Tab2MageHybridizationLine(); 400 hybRow.set("File", Tab2MageConstants.raw_file.getName(), fileSetMember.getFile().getName()); 401 itemList.add(hybRow); 402 } 403 } 404 } 405 catch(Throwable tr) 406 { 407 response.setError(tr.getMessage(), Arrays.asList(tr)); 408 } 409 410 return itemList; 411 } 196 412 197 413 /** … … 227 443 return at.getDefaultValue()!=null? at.getDefaultValue():""; 228 444 } 229 230 445 231 446 /** … … 235 450 */ 236 451 237 @SuppressWarnings("unchecked")238 452 public static Set<String> createHybridizationSectionHeader( DbControl dc, List<Tab2MageHybridization> hybList, 239 453 Set<String> bioXterHybSectionHeader, Set<String> protocolHybSectionHeader, … … 266 480 hybHeader.add("FactorValue["+factorValueHeader+"]"); 267 481 } 482 483 if (l.getScan()!=null && l.getScan().length()!=0) 484 hybHeader.add(Tab2MageConstants.scan.getName()); 268 485 269 486 if (l.getHybridization()!=null && l.getHybridization().length()!=0) … … 311 528 } 312 529 313 314 530 /** 315 531 create the set of protocol objects for the tab2mage protocol section … … 345 561 346 562 // add extract protocol 347 Extract extract= getExtract(labeledExtract, dc); 348 if (extract!=null) 349 { 350 Protocol extractProtocol =extract.getCreationEvent().getProtocol(); 351 protocols.add(extractProtocol); 352 } 353 // add sample protocol 354 355 Sample sample = getSample(extract, dc); 356 if (sample != null) 357 { 358 Protocol sampleProtocol=sample.getCreationEvent().getProtocol(); 359 protocols.add(sampleProtocol); 563 Set<Extract> extracts = ExportHelper.getExtracts(labeledExtract, dc); 564 for (Extract extract : extracts) { 565 if (extract!=null) 566 { 567 Protocol extractProtocol =extract.getCreationEvent().getProtocol(); 568 protocols.add(extractProtocol); 569 } 570 // add sample protocol 571 Set<Sample> samples = ExportHelper.getSamples(extract, dc); 572 for (Sample sample : samples) { 573 if (sample != null) 574 { 575 Protocol sampleProtocol=sample.getCreationEvent().getProtocol(); 576 protocols.add(sampleProtocol); 577 } 578 } 360 579 } 361 580 } … … 390 609 return p; 391 610 } 611 392 612 /** 393 613 utility method for the tab2mage exporter -
Property
svn:keywords
set to
-
plugins/base2/uk.ac.ebi.tab2mage/trunk/Tab2MageExporter/src/uk/ac/ebi/nugo/plugins/ta2mageexport/Tab2MageFileWriter.java
-
Property
svn:keywords
set to
Id
r449 r1188 1 /* $Id : Tab2MageFileWriter.java 2007-09-01 dominic$2 3 Copyright (C) 2007 Authors contributing to this file.1 /* $Id$ 2 3 Copyright (C) 2007, 2010 Authors contributing to this file. 4 4 5 5 This file is for NutriBASE - Nutrigenomics BioArray Software Environment. … … 62 62 @email oyeniran@ebi.ac.uk/doyeniran@gmail.com 63 63 @version 1.0 64 65 @author Gildas Le Corguillé 66 @email lecorguille@sb-roscoff.fr 67 @version 1.01 68 69 ChangeLog : 70 05/02/2010 - lecorguille : addition of a Scan column to the output file 71 08/02/2010 - lecorguille : addition of a BioSourceDescription column to the output file 72 displaying of the protocol descriptions in one line 64 73 */ 65 74 public class Tab2MageFileWriter … … 84 93 out= new BufferedWriter(new OutputStreamWriter(outputFile.getUploadStream(false),encoding)); 85 94 statusOut= new BufferedWriter(new OutputStreamWriter(statusFile.getUploadStream(false),encoding)); 86 } 87 catch(UnsupportedEncodingException e) 95 96 statusOut.write(" Please check the messages below for the status of the export\n\n"); 97 } 98 catch (IOException e) 88 99 { 89 100 new NutribasePluginException(e.getMessage()); … … 139 150 try 140 151 { 141 statusOut.write(" Please check the messages below for the status of the export"); //not part of experiment and may be moved elsewhere.152 142 153 143 154 out.write("# This file contains an experiment exported in tab2mage specification from BASE\n\n"); … … 151 162 out.write(Tab2MageConstants.description.getName()+"\t"+description +"\n"); 152 163 out.write(Tab2MageConstants.release_date.getName()+"\t"+job.getValue("releaseDate").toString()+"\n"); 153 out.write(Tab2MageConstants.submission_date.getName()+"\t"+Value s.formatDate(new Date())+"\n");164 out.write(Tab2MageConstants.submission_date.getName()+"\t"+ValueFormatter.DATE_FORMAT.format(new Date())+"\n"); 154 165 out.write(Tab2MageConstants.submitter.getName()+"\t"+experiment.getOwner().getName()+"\n"); 155 166 out.write(Tab2MageConstants.submitter_email.getName()+"\t"+ValueFormatter.getEmptyStringIfNull(experiment.getOwner().getEmail())+"\n"); … … 171 182 } 172 183 } 184 173 185 /** 174 186 writes Tab2Mage protocol section … … 191 203 { 192 204 out.write("P-BASE-"+protocol.getId()+"\t"); 193 out.write(ValueFormatter.get EmptyStringIfNull(protocol.getDescription())+"\t");205 out.write(ValueFormatter.getStringWithoutLineBreaker(String.valueOf(ValueFormatter.getEmptyStringIfNull(protocol.getDescription())))+"\t"); 194 206 out.write(ValueFormatter.getEmptyStringIfNull(protocol.getName())+"\t"); 195 207 out.write(ValueFormatter.getEmptyStringIfNull(protocol.getProtocolType().getName())+"\t"); … … 248 260 249 261 /** 262 * @deprecated 250 263 Tab2Mage Hybridization Channel Line Section 251 264 @param hybDataRow, the data rows to display 252 265 @param response, the response object to return failures or exceptions 253 266 */ 254 255 267 public static void writeTab2MageHybridizationRow( List<String> hybDataRows,Response response) 256 268 { … … 277 289 } 278 290 } 291 279 292 /** 280 293 write the Tab2Mage File Hybridization Section … … 286 299 @param response, response object 287 300 */ 288 289 301 private static void writeTab2MageHybridizationRows(List<Tab2MageHybridization> hybList,Set<String> bioXterHybSectionHeader, 290 302 Set<String> protocolHeaders,Set<String>parameterHeaders,Set<String>factorValueHeaders, … … 300 312 tempList.add(ValueFormatter.getEmptyStringIfNull(h.getLine().getFileRaw())+"\t"); 301 313 302 int channelNo = h.getChannelNumber();303 314 304 315 Tab2MageHybridizationLine l= h.getLine(); … … 344 355 parameterMap.putAll(l.getParameter()); 345 356 357 //Scan 358 out.write(ValueFormatter.getEmptyStringIfNull(l.getScan())+"\t") ; 359 tempList.add(ValueFormatter.getEmptyStringIfNull(l.getScan())+"\t") ; 360 346 361 //Hybridization 347 362 out.write(ValueFormatter.getEmptyStringIfNull(l.getHybridization())+"\t") ; … … 366 381 out.write(ValueFormatter.getEmptyStringIfNull(sl.getSample())+"\t") ; 367 382 out.write(ValueFormatter.getEmptyStringIfNull(sl.getBioSource())+"\t") ; 383 out.write(ValueFormatter.getEmptyStringIfNull(sl.getBioSourceDescription())+"\t") ; 368 384 369 385 // biomaterial xteristics … … 412 428 } 413 429 430 /** NOT USE 431 * @deprecated */ 414 432 public static void createZipFile(User user, File tab2mageFile, DbControl dc ) 415 433 { … … 426 444 427 445 } 428 /** 446 447 /** 429 448 closes the file writers 430 449 */ … … 433 452 try 434 453 { 454 out.flush(); 455 statusOut.flush(); 435 456 if (out!= null) out.close(); 436 457 if (statusOut!=null) statusOut.close(); -
Property
svn:keywords
set to
-
plugins/base2/uk.ac.ebi.tab2mage/trunk/Tab2MageExporter/src/uk/ac/ebi/nugo/plugins/ta2mageexport/Tab2MageHybridization.java
-
Property
svn:keywords
set to
Id
r449 r1188 1 /* $Id : Tab2MageHyridization.java 2007-10-01 dominic$2 3 Copyright (C) 2007 Authors contributing to this file.1 /* $Id$ 2 3 Copyright (C) 2007, 2010 Authors contributing to this file. 4 4 5 5 This file is for NutriBASE - Nutrigenomics BioArray Software Environment. … … 38 38 @author Dominic Oyeniran 39 39 @email oyeniran@ebi.ac.uk/doyeniran@gmail.com 40 @version 1.0 41 42 43 @author Gildas Le Corguillé 44 @email lecorguille@sb-roscoff.fr 45 @version 1.01 46 47 ChangeLog : 48 05/02/2010 - lecorguille : addition of SCAN 40 49 */ 41 50 public class Tab2MageHybridization … … 45 54 46 55 public static final String BIOSOURCE = "BioSource"; 56 public static final String BIOSOURCEDESCRIPTION = "BioSourceDescription"; 47 57 public static final String SAMPLE = "Sample"; 48 58 public static final String EXTRACT = "Extract"; … … 50 60 public static final String DYE = "Dye"; 51 61 public static final String HYBRIDIZATION = "Hybridization"; 62 public static final String SCAN = "Scan"; 52 63 public static final String BIOMATERIALCHARACTERISTICS = "BioMaterialCharacteristics"; 53 64 public static final String PROTOCOL = "Protocol"; … … 124 135 125 136 /** 137 * @deprecated by lecorguille 126 138 Get the size of the <code>Tab2MageHybridization</code> object. 127 139 The size is the number of <code>Tab2MageHybridizationLine</code> … … 142 154 143 155 /** 156 * @deprecated by lecorguille 144 157 Get the set of all <code>Tab2MageHybridizationLine</code> objects. 145 158 @return A <code>HashMap</code> with a String as key and a <code>TAB2MAGEHybridizationLine</code> as value … … 151 164 152 165 /** 166 * @deprecated by lecorguille 153 167 Get the name of the raw data file. 154 168 @return The name of the raw data file … … 178 192 179 193 /** 194 * @deprecated by lecorguille 180 195 Get the information about the Array[...] entries in 181 196 the Tab2Mage files. … … 204 219 205 220 /** 221 * @deprecated by lecorguille 206 222 Has the Hyb object a pooled property 207 223 */ … … 211 227 } 212 228 /** 229 * @deprecated by lecorguille 213 230 check if the Hyb line object a re pooled abnd set the global variable pooled 214 231 * @param pooled … … 220 237 221 238 /** 239 * @deprecated by lecorguille 222 240 get the name of the Hybridization from the HybLine objects 223 241 @return -
Property
svn:keywords
set to
-
plugins/base2/uk.ac.ebi.tab2mage/trunk/Tab2MageExporter/src/uk/ac/ebi/nugo/plugins/ta2mageexport/Tab2MageHybridizationLine.java
-
Property
svn:keywords
set to
Id
r449 r1188 1 /* $Id : Tab2MageHybridizationLine.java 2007-10-01 dominic$2 3 Copyright (C) 2007 Authors contributing to this file.1 /* $Id$ 2 3 Copyright (C) 2007, 2010 Authors contributing to this file. 4 4 5 5 This file is for NutriBASE - Nutrigenomics BioArray Software Environment. … … 37 37 @author Dominic Oyeniran 38 38 @email oyeniran@ebi.ac.uk/doyeniran@gmail.com 39 40 41 @author Gildas Le Corguillé 42 @email lecorguille@sb-roscoff.fr 43 @version 1.01 44 45 ChangeLog : 46 05/02/2010 - lecorguille : addition of scan methods 47 05/02/2010 - lecorguille : deletion of number of line control which was limited by the comparison the channel number 39 48 */ 40 49 public class Tab2MageHybridizationLine … … 48 57 protected String dye; 49 58 protected String hybridization; 59 protected String scan; 50 60 protected Map<String, String> file = new HashMap<String, String>(); 51 61 protected Map<String, String> protocol = new HashMap<String, String>(); … … 88 98 { 89 99 this.hybridization = hybridization; 100 } 101 102 /* 103 Scan 104 */ 105 public String getScan() 106 { 107 return scan; 108 } 109 110 public void setScan(String scan) 111 { 112 this.scan = scan; 90 113 } 91 114 … … 199 222 return; 200 223 } 224 225 // Scan 226 if (key == Tab2MageHybridization.SCAN) 227 { 228 setScan((String)value); 229 return; 230 } 201 231 202 232 // Parameters … … 264 294 else 265 295 { 266 if (lines.size()!= channelNumber) // check the the line numbers matches the channel number296 /*if (lines.size()!= channelNumber) // check the the line numbers matches the channel number 267 297 { 268 298 log.error("The Hybridization " + name + " doesn't have the right number of lines!"); … … 270 300 } 271 301 else 272 { 302 {*/ 273 303 subLineSet.addAll(lines); 274 304 return true; 275 }305 //} 276 306 } 277 307 } -
Property
svn:keywords
set to
-
plugins/base2/uk.ac.ebi.tab2mage/trunk/Tab2MageExporter/src/uk/ac/ebi/nugo/plugins/ta2mageexport/Tab2MageSubHybLine.java
-
Property
svn:keywords
set to
Id
r449 r1188 1 /* $Id : Tab2MageSubHybLine.java 2007-10-01 dominic$1 /* $Id$ 2 2 3 3 Copyright (C) 2007 Authors contributing to this file. … … 31 31 @email oyeniran@ebi.ac.uk/doyeniran@gmail.com 32 32 @version 1.0 33 34 35 @author Gildas Le Corguillé 36 @email lecorguille@sb-roscoff.fr 37 @version 1.01 38 39 ChangeLog : 40 05/02/2010 - lecorguille : addition of BioSourceDescription 33 41 */ 34 42 … … 36 44 { 37 45 protected String bioSource; 46 protected String bioSourceDescription; 38 47 protected String sample; 39 48 protected String extract; … … 75 84 } 76 85 86 87 public String getBioSourceDescription() 88 { 89 return bioSourceDescription; 90 } 91 92 public void setBioSourceDescription(String bioSourceDescription) 93 { 94 this.bioSourceDescription = bioSourceDescription; 95 } 96 77 97 /* 78 98 Sample … … 183 203 return; 184 204 } 205 206 //set BioSource 207 if (key == Tab2MageHybridization.BIOSOURCEDESCRIPTION) 208 { 209 setBioSourceDescription((String)value); 210 return; 211 } 185 212 186 // set sample213 // set Sample 187 214 if (key == Tab2MageHybridization.SAMPLE) 188 215 { -
Property
svn:keywords
set to
-
plugins/base2/uk.ac.ebi.tab2mage/trunk/Tab2MageExporter/src/uk/ac/ebi/nugo/plugins/ta2mageexport/Tab2MageValidator.java
-
Property
svn:keywords
set to
Id
r449 r1188 1 /* $Id : Tab2MageValidator.java 2007-10-01 dominic$2 3 Copyright (C) 2007 Authors contributing to this file.1 /* $Id$ 2 3 Copyright (C) 2007, 2010 Authors contributing to this file. 4 4 5 5 This file is for NutriBASE - Nutrigenomics BioArray Software Environment. … … 23 23 package uk.ac.ebi.nugo.plugins.ta2mageexport; 24 24 25 import java.io.IOException; 25 26 import java.util.Arrays; 26 27 import java.util.LinkedHashSet; … … 57 58 @email oyeniran@ebi.ac.uk/doyeniran@gmail.com 58 59 @version 1.0 60 61 62 @author Gildas Le Corguillé 63 @email lecorguille@sb-roscoff.fr 64 @version 1.01 65 66 ChangeLog : 67 05/02/2010 - lecorguille : addition a pooling management for the setting of protocols 68 08/02/2010 - lecorguille : fix a problem with protocols 59 69 */ 60 70 public class Tab2MageValidator … … 81 91 private static int samplingProtocolCount=0; 82 92 93 /** @deprecated by lecorguille */ 83 94 private Set<String> parameterHeaders= new LinkedHashSet<String>(); 84 95 96 /** @deprecated by lecorguille */ 85 97 private Set<String> bioMaterialXteristicsHeaders= new LinkedHashSet<String>(); 86 98 99 /** @deprecated by lecorguille */ 87 100 private static Set<String> factorValuesHybSectionHeader= new LinkedHashSet<String>(); 88 101 … … 96 109 private int channelNumber = 0; 97 110 // the experiment 98 private Experiment experiment;111 private ItemResultList<RawBioAssay> rawBioAssays; 99 112 100 113 private SessionControl sc; … … 108 121 @param response 109 122 */ 110 public Tab2MageValidator( Experiment experiment, SessionControl sc, Response response)111 { 112 this. experiment=experiment;123 public Tab2MageValidator(ItemResultList<RawBioAssay> rawBioAssays, SessionControl sc, Response response) 124 { 125 this.rawBioAssays=rawBioAssays; 113 126 this.sc = sc; 114 127 this.response= response; … … 127 140 { 128 141 dc = sc.newDbControl(); 129 ItemResultList<RawBioAssay> rbas= experiment.getRawBioAssays().list(dc); 130 for (RawBioAssay rba : rbas) 142 for (RawBioAssay rba : rawBioAssays) 131 143 { 132 144 if (rba.getProtocol()!=null) … … 148 160 labelingProtocolCount++; 149 161 150 //Extract extract = labeledExtract.getExtract(); // RefExtract 151 Extract extract = ExportHelper.getExtract(labeledExtract, dc); 152 if (extract.getProtocol()!=null) 153 extractProtocolCount++; 154 155 //sample 156 Sample sample = ExportHelper.getSample(extract, dc); 157 if (sample.getProtocol()!=null) 158 samplingProtocolCount++; 159 162 Set<Extract> extracts = ExportHelper.getExtracts(labeledExtract, dc); 163 for (Extract extract : extracts) { 164 if (extract.getProtocol()!=null) 165 extractProtocolCount++; 166 167 Set<Sample> samples = ExportHelper.getSamples(extract, dc); 168 for (Sample sample : samples) { 169 if (sample.getProtocol()!=null) 170 samplingProtocolCount++; 171 } 172 } 160 173 } 161 174 } … … 177 190 create both the parameter [AT] header and BioMaterialCharactertistic[AT] headers found in the whole experiment 178 191 */ 179 @SuppressWarnings({"deprecation","unchecked"})180 192 private void createHeaders() 181 193 { … … 184 196 { 185 197 dc = sc.newDbControl(); 186 ItemResultList<RawBioAssay> rbas= experiment.getRawBioAssays().list(dc); 187 for (RawBioAssay rba : rbas) 198 for (RawBioAssay rba : rawBioAssays) 188 199 { 189 200 if (rba.getProtocol()!=null) 190 201 { 191 createParameterSectionHeaders(rba, dc);202 //createParameterSectionHeaders(rba, dc); 192 203 createProtocolHybSectionHeader(Tab2MageValidator.getFeProtocolCount(),Tab2MageConstants.protocol_featureextraction.getName()); 193 204 } 194 205 if (rba.getScan().getProtocol()!=null) 195 206 { 196 createParameterSectionHeaders(rba.getScan(), dc );207 //createParameterSectionHeaders(rba.getScan(), dc ); 197 208 createProtocolHybSectionHeader(Tab2MageValidator.getScanningProtocolCount(), Tab2MageConstants.protocol_scanning.getName()); 198 209 } 199 210 if (rba.getScan().getHybridization().getProtocol()!=null) 200 211 { 201 createParameterSectionHeaders(rba.getScan().getHybridization(), dc );212 //createParameterSectionHeaders(rba.getScan().getHybridization(), dc ); 202 213 createProtocolHybSectionHeader(Tab2MageValidator.getHybridizationProtocolCount(), Tab2MageConstants.protocol_hyb.getName()); 203 214 } 204 ItemResultList<LabeledExtract> labeledExtracts = (ItemResultList<LabeledExtract>)215 ItemResultList<LabeledExtract> labeledExtracts = (ItemResultList<LabeledExtract>) 205 216 rba.getScan().getHybridization().getCreationEvent().getSources().list(dc); 206 217 for (LabeledExtract labeledExtract :labeledExtracts) … … 208 219 if (labeledExtract.getProtocol()!=null) 209 220 { 210 createParameterSectionHeaders(labeledExtract, dc );221 //createParameterSectionHeaders(labeledExtract, dc ); 211 222 createProtocolHybSectionHeader(Tab2MageValidator.getLabelingProtocolCount(), Tab2MageConstants.protocol_labeling.getName()); 212 223 } 213 //Extract extract= labeledExtract.getExtract(); 214 Extract extract = ExportHelper.getExtract(labeledExtract, dc); 215 if (extract.getProtocol()!=null) 216 { 217 createParameterSectionHeaders(labeledExtract.getExtract(), dc ); 218 createProtocolHybSectionHeader(Tab2MageValidator.getExtractProtocolCount(), Tab2MageConstants.protocol_extraction.getName()); 224 Set<Extract> extracts = ExportHelper.getExtracts(labeledExtract, dc); 225 for (Extract extract : extracts) { 226 if (extract.getProtocol()!=null) 227 { 228 //createParameterSectionHeaders(labeledExtract.getExtract(), dc ); 229 createProtocolHybSectionHeader(Tab2MageValidator.getExtractProtocolCount(), Tab2MageConstants.protocol_extraction.getName()); 230 } 231 Set<Sample> samples = ExportHelper.getSamples(extract, dc); 232 for (Sample sample : samples) { 233 if (sample.getProtocol()!=null) 234 { 235 //createParameterSectionHeaders(sample, dc ); 236 createProtocolHybSectionHeader(Tab2MageValidator.getSamplingProtocolCount(), Tab2MageConstants.protocol_treatment.getName()); 237 } 238 Set<BioSource> bioSources = ExportHelper.getBioSources(sample, dc); 239 for (BioSource bioSource : bioSources) { 240 if (bioSource!=null) 241 createBioMatXteristicsSectionHeader(bioSource,dc); 242 } 243 } 219 244 } 220 Sample sample = ExportHelper.getSample(extract, dc);221 if (sample.getProtocol()!=null)222 {223 createParameterSectionHeaders(sample, dc );224 createProtocolHybSectionHeader(Tab2MageValidator.getSamplingProtocolCount(), Tab2MageConstants.protocol_treatment.getName());225 }226 BioSource bioSource= ExportHelper.getBioSource(sample, dc);227 if (bioSource!=null)228 createBioMatXteristicsSectionHeader(bioSource,dc);229 245 } 230 246 } … … 241 257 dc.close(); 242 258 } 243 244 }245 /**259 } 260 /** 261 * @deprecated by lecorguille 246 262 Gets the used annotation types (parameters) for an annotatable item and add it to a set of PARAMETER[AT] headers 247 263 @param annotatable, an item that implements annotatable 248 264 @param dc, the database control object 249 265 */ 250 251 266 private void createParameterSectionHeaders(Annotatable anotatable, DbControl dc ) 252 267 { … … 259 274 } 260 275 261 /** 276 /** @deprecated by lecorguille 262 277 Gets the annotation types used as biomaterial characteristics for an annotatable item 263 278 @param annotatable, an item that implements annotatable … … 298 313 299 314 /** 315 * @deprecated 300 316 initialises the maps required to manage tab2mage data 301 317 @param map, the map to be intitialised … … 327 343 328 344 /** 345 * @deprecated 329 346 get all the experimental factors for an experiments 330 347 @param DcControl dc, the database control … … 355 372 356 373 /** 374 * @deprecated 357 375 get all the experimental factors headers for an experiments 358 376 @param DcControl dc, the database control … … 415 433 } 416 434 417 // get the parameter headers 418 public Set<String> getParameterHeaders() 435 /** @deprecated by lecorguille 436 * get the parameter headers 437 * */ 438 public Set<String> getParameterHead() 419 439 { 420 440 return parameterHeaders; 421 441 } 422 // get the bio material characteristics headers 442 /** @deprecated by lecorguille 443 * get the bio material characteristics headers 444 * */ 423 445 public Set<String> getBioMaterialXteristicsHeaders() 424 446 { 425 447 return bioMaterialXteristicsHeaders; 426 448 } 427 428 // get the factor values header used in the experiment 449 450 /** @deprecated by lecorguille 451 * get the factor values header used in the experiment 452 * */ 429 453 public static Set<String> getFactorValuesHybSectionHeader() 430 454 { -
Property
svn:keywords
set to
Note: See TracChangeset
for help on using the changeset viewer.