Changeset 3022
- Timestamp:
- Dec 12, 2006, 10:57:50 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/tab2mage_ebi/src/plugins/core/net/sf/basedb/plugins/Tab2MageExporter.java
r3009 r3022 3 3 Copyright (C) Authors contributing to this file. 4 4 5 This file is for NutriBASE - Nutrigenomics BioArray Software Environment. 6 A customisation of the BASE SOFTWARE. 7 5 8 BASE is free software; you can redistribute it and/or 6 9 modify it under the terms of the GNU General Public License … … 18 21 Boston, MA 02111-1307, USA. 19 22 */ 20 package net.sf.basedb.plugins; 21 23 package com.plugin; 22 24 23 25 import java.io.BufferedWriter; 24 26 import java.io.OutputStreamWriter; 25 27 import java.io.Writer; 28 import java.nio.charset.Charset; 26 29 import java.util.ArrayList; 27 30 import java.util.Arrays; … … 29 32 import java.util.Date; 30 33 import java.util.HashMap; 34 import java.util.HashSet; 31 35 import java.util.LinkedHashSet; 36 import java.util.LinkedHashMap; 32 37 import java.util.LinkedList; 38 import java.util.Iterator; 33 39 import java.util.List; 34 40 import java.util.Map; 35 41 import java.util.Set; 42 import java.util.TreeSet; 43 import java.text.DateFormat; 44 import java.util.TreeMap; 36 45 37 import net.sf.basedb.core.Affymetrix; 46 import utils.Values; 47 import net.sf.basedb.core.plugin.About; 48 import net.sf.basedb.core.plugin.AbstractPlugin; 49 import net.sf.basedb.core.plugin.GuiContext; 50 import net.sf.basedb.core.plugin.InteractivePlugin; 51 import net.sf.basedb.core.plugin.AboutImpl; 52 import net.sf.basedb.core.plugin.Plugin; 53 import net.sf.basedb.core.plugin.Request; 54 import net.sf.basedb.core.plugin.Response; 55 import net.sf.basedb.core.plugin.Plugin.MainType; 56 import net.sf.basedb.core.query.Annotations; 57 import net.sf.basedb.core.query.Hql; 58 import net.sf.basedb.core.query.Orders; 59 import net.sf.basedb.core.query.Restrictions; 60 import net.sf.basedb.core.query.Expressions; 38 61 import net.sf.basedb.core.Annotatable; 39 62 import net.sf.basedb.core.Annotation; 40 63 import net.sf.basedb.core.AnnotationSet; 41 64 import net.sf.basedb.core.AnnotationType; 42 import net.sf.basedb.core.Application;43 65 import net.sf.basedb.core.ArrayDesign; 44 66 import net.sf.basedb.core.BaseException; 67 import net.sf.basedb.core.BioMaterial; 45 68 import net.sf.basedb.core.BioMaterialEvent; 69 import net.sf.basedb.core.BooleanParameterType; 46 70 import net.sf.basedb.core.BioSource; 47 import net.sf.basedb.core. BooleanParameterType;71 import net.sf.basedb.core.Client; 48 72 import net.sf.basedb.core.DbControl; 49 73 import net.sf.basedb.core.Experiment; … … 51 75 import net.sf.basedb.core.File; 52 76 import net.sf.basedb.core.Hybridization; 53 import net.sf.basedb.core.Include;54 77 import net.sf.basedb.core.Item; 55 78 import net.sf.basedb.core.ItemAlreadyExistsException; … … 57 80 import net.sf.basedb.core.ItemQuery; 58 81 import net.sf.basedb.core.ItemResultList; 82 import net.sf.basedb.core.Label; 59 83 import net.sf.basedb.core.LabeledExtract; 84 import net.sf.basedb.core.MeasuredBioMaterial; 85 import net.sf.basedb.core.ParameterType; 60 86 import net.sf.basedb.core.Path; 61 87 import net.sf.basedb.core.PathParameterType; 88 import net.sf.basedb.core.PlateMapping; 62 89 import net.sf.basedb.core.PluginParameter; 63 90 import net.sf.basedb.core.ProgressReporter; … … 68 95 import net.sf.basedb.core.Scan; 69 96 import net.sf.basedb.core.StringParameterType; 97 import net.sf.basedb.core.Type; 70 98 import net.sf.basedb.core.User; 71 import net.sf.basedb.core.plugin.About; 72 import net.sf.basedb.core.plugin.AboutImpl; 73 import net.sf.basedb.core.plugin.AbstractPlugin; 74 import net.sf.basedb.core.plugin.GuiContext; 75 import net.sf.basedb.core.plugin.InteractivePlugin; 76 import net.sf.basedb.core.plugin.Plugin; 77 import net.sf.basedb.core.plugin.Request; 78 import net.sf.basedb.core.plugin.Response; 79 import net.sf.basedb.core.query.Hql; 80 import net.sf.basedb.core.query.Orders; 81 import net.sf.basedb.util.Values; 99 import net.sf.basedb.core.Include; 100 import net.sf.basedb.core.ArraySlide; 101 import net.sf.basedb.core.Application; 102 import net.sf.basedb.core.Affymetrix; 82 103 83 104 /** 84 105 A plugin that exports an experiment in tab2mage specification for submission to ArrayExpress public repository. 85 106 @author Dominic 86 @version 2.0107 @version 1.0 87 108 @base.modified $Date$ 88 109 */ … … 253 274 DbControl dc=null; 254 275 Set<Protocol> protocols = new LinkedHashSet<Protocol>(); //to get protocols as they are entered 276 255 277 Set<String> hybSectionHeader= new LinkedHashSet<String>(); 256 278 Set<String> protocolHybSectionHeader= new LinkedHashSet<String>(); 257 279 Set<String> parameterHybSectionHeader= new LinkedHashSet<String>(); 258 Map<AnnotationType, Annotation> factorValues= new HashMap<AnnotationType,Annotation>(); 280 281 //Map<String, String> bioMaterials= new LinkedHashMap<String, String>(); 282 //Map<String, String> arrayDataInfo= new LinkedHashMap<String,String>(); 259 283 List<String> protocolRefId= new LinkedList<String>(); 260 284 List<String> hybridizationDataRows=new LinkedList<String>(); 261 285 List<String> parameterValues= new LinkedList<String>(); 286 262 287 List<Annotation> expFactorValues= new LinkedList<Annotation>(); 263 264 List<String> twoColorHybDataRowsFirstSection=new LinkedList<String>(); 265 List<String> twoColorHybDataRowsSecondSection=new LinkedList<String>(); 266 267 288 Map<AnnotationType, Annotation> factorValues= new HashMap<AnnotationType,Annotation>(); 289 List<String> twoColorHybDataRows=new LinkedList<String>(); 290 List<String> twoColorParameterValues=new LinkedList<String>(); 291 List<String> twoColorFirstParameterValues=new LinkedList<String>(); 292 List<String> twoColorProtocolRefId= new LinkedList<String>(); 293 List<String> twoColorFirstProtocolRefId= new LinkedList<String>(); 294 268 295 boolean overwrite = false; 269 296 boolean twoColorHyb= false; … … 301 328 Writer out= new BufferedWriter(new OutputStreamWriter(file.getUploadStream(false),"ISO-8859-1")); 302 329 303 // Header section 330 /* 331 Tab2Mage Header section 332 */ 304 333 out.write("# This file contains an experiment exported in tab2mage specification from BASE2\n\n"); 305 // Experiment Section 334 335 /* 336 Tab2Mage Experiment Section 337 */ 306 338 out.write("Experiment section \n"); 307 339 out.write("domain\t"+Application.getHostName()+"\n"); … … 327 359 out.write("\n"); 328 360 out.flush(); 329 330 361 331 362 // Get all protocols and hybs 332 363 ItemQuery<RawBioAssay> rawBioAssaysQuery = experiment.getRawBioAssays(); … … 335 366 for (RawBioAssay rba : rawBioAssays) 336 367 { 337 twoColorHybDataRows FirstSection.add("-done-"); //initialise the twocolor hyb row with -done- as the delimeter368 twoColorHybDataRows.add("-done-"); //initialise the twocolor hyb row with -done- as the delimeter 338 369 /* 339 370 Data files and array information section// … … 348 379 hybSectionHeader.add("File[raw]"); 349 380 hybridizationDataRows.add(celFile.getName()); 350 twoColorHybDataRows FirstSection.add(celFile.getName());381 twoColorHybDataRows.add(celFile.getName()); 351 382 hybSectionHeader.add("File[cdf]"); 352 383 hybridizationDataRows.add(cdfFile.getName()); 353 twoColorHybDataRows FirstSection.add(cdfFile.getName());384 twoColorHybDataRows.add(cdfFile.getName()); 354 385 } 355 386 else … … 357 388 hybSectionHeader.add("File[raw]"); 358 389 hybridizationDataRows.add(rba.getName()); 359 twoColorHybDataRows FirstSection.add(rba.getName());390 twoColorHybDataRows.add(rba.getName()); 360 391 } 361 392 hybSectionHeader.add("Array[accession]"); 362 393 hybridizationDataRows.add(arrayDesign.getName()); 363 twoColorHybDataRows FirstSection.add(arrayDesign.getName());394 twoColorHybDataRows.add(arrayDesign.getName()); 364 395 365 //Raw BioAssay protocol 396 //Raw BioAssay protocol and parameters 366 397 protocolRefId.add(getFormattedProtocolId(rba.getProtocol())); 398 twoColorFirstProtocolRefId.add(getFormattedProtocolId(rba.getProtocol())); 367 399 protocolHybSectionHeader.add("Protocol[image_analysis]"); 368 //if (rba.getProtocol()!=null) 369 //{ 370 protocols.add(rba.getProtocol()); //rawbioassay protocol 371 372 // System.out.println("raw bioassay protocol: P-BASE-"+rba.getProtocol().getId()); 373 //} 400 protocols.add(rba.getProtocol()); //rawbioassay protocol 374 401 if (rba.isAnnotated()) 375 402 { … … 383 410 for (int i=0; i<annotation.getValues().size(); i++) 384 411 { 385 parameterValues.add(annotation.getValues().get(i).toString()); 412 if (annotation.getValues().get(i)!=null) 413 { 414 parameterValues.add(annotation.getValues().get(i).toString()); 415 //twoColorParameterValues.add(annotation.getValues().get(i).toString()); 416 twoColorFirstParameterValues.add(annotation.getValues().get(i).toString()); 417 } 418 else 419 { 420 System.out.println("Here becuase the annotation value for parameter at raw bioassay is null"); 421 parameterValues.add("\t"); 422 } 386 423 } 387 424 } 388 //else 389 //{ 390 // parameterValues.add("\t"); 391 //} 425 392 426 } 393 427 } 394 //Scanning and Protocol428 //Scanning Protocol and Parameters 395 429 Scan scan= rba.getScan(); 396 430 Protocol scanProtocol =scan.getProtocol(); 397 431 protocolRefId.add(getFormattedProtocolId(scanProtocol)); 432 twoColorFirstProtocolRefId.add(getFormattedProtocolId(scanProtocol)); 398 433 protocolHybSectionHeader.add("Protocol[scanning]"); 399 protocols.add(scanProtocol); //scan ing protocol434 protocols.add(scanProtocol); //scanning protocol 400 435 if (scan.isAnnotated()) 401 436 { … … 409 444 for (int i=0; i<annotation.getValues().size(); i++) 410 445 { 411 parameterValues.add(annotation.getValues().get(i).toString()); 446 if (annotation.getValues().get(i)!=null) 447 { 448 parameterValues.add(annotation.getValues().get(i).toString()); 449 //if (twoColorHyb)twoColorParameterValues.add(annotation.getValues().get(i).toString()); 450 twoColorFirstParameterValues.add(annotation.getValues().get(i).toString()); 451 } 452 else 453 { 454 parameterValues.add("\t"); 455 twoColorFirstParameterValues.add("\t"); 456 } 412 457 } 413 458 } 414 //else 415 //{ 416 // parameterValues.add("\t"); 417 // } 459 418 460 } 419 461 } 420 462 421 //Hybridization463 //Hybridization 422 464 Hybridization hyb= scan.getHybridization(); 423 465 hybSectionHeader.add("Array[serial]"); 424 466 hybridizationDataRows.add(hyb.getArraySlide().getName()); 425 twoColorHybDataRows FirstSection.add(hyb.getArraySlide().getName());467 twoColorHybDataRows.add(hyb.getArraySlide().getName()); 426 468 /* 427 469 Names of materials and processes section … … 429 471 hybSectionHeader.add("Hybridization"); 430 472 hybridizationDataRows.add(hyb.getName()); 431 twoColorHybDataRows FirstSection.add(hyb.getName());473 twoColorHybDataRows.add(hyb.getName()); 432 474 433 475 System.out.println("The number of scans: "+hyb.countScans()); // count scans that created the hyb … … 437 479 protocols.add(hybProtocol); 438 480 protocolRefId.add(getFormattedProtocolId(hybProtocol)); 481 twoColorFirstProtocolRefId.add(getFormattedProtocolId(hybProtocol)); 439 482 protocolHybSectionHeader.add("Protocol[hybridization]"); 440 483 if (hyb.isAnnotated()) … … 450 493 { 451 494 parameterValues.add(annotation.getValues().get(i).toString()); 495 //if (twoColorHyb)twoColorParameterValues.add(annotation.getValues().get(i).toString()); 496 twoColorFirstParameterValues.add(annotation.getValues().get(i).toString()); 452 497 } 453 498 } … … 463 508 int hybsize=labeledExtracts.size(); 464 509 int count=1; 465 //STOPPED HERE (LAST CODE) TRYING TO IMPLEMENT TWO COLOR HYBS 466 //if (hybsize==2 && !hybridizationDataRows.contains("-done-")) 467 //{ 468 // twoColorHybDataRowsFirstSection.addAll(hybridizationDataRows); //create anew data row for 2 color experiment 469 // twoColorHybDataRowsSecondSection.addAll(hybridizationDataRows); 470 // twoColorHyb=true; 471 //}else if(hybsize==2 && twoColorHyb ) 472 //{ //NOTE THE OUTPUT SHOWS THAT i AM ADDING THE LAST INFORMATION, SO FIX THIS 473 // twoColorHybDataRowsFirstSection.addAll(twoColorHybDataRowsSecondSection); 474 //} 475 // END OF LAST CODE 476 System.out.println("The size of the two color data hyb data row before the labeled extract section: " +twoColorHybDataRowsFirstSection.size()); 477 System.out.println("The size of the hyb data row before adding to tow color hyb row: " +hybridizationDataRows.size()); 510 System.out.println("The size of the two color data hyb data row before the labeled extract section: " +twoColorHybDataRows.size()); 511 System.out.println("The size of the tow color param value before adding the labeled extract section is: " +twoColorFirstParameterValues.size()); 478 512 System.out.println(hybsize ==1 ? "Affy Expriment. Hyb size:"+hybsize :"2 - color Expreriment. Hyb size : "+hybsize ); 479 513 for (LabeledExtract labeledExtract :labeledExtracts) // can have more than one labeled extract (2 color experiments) 480 514 { 481 482 515 // labeled extract 483 516 hybSectionHeader.add("LabeledExtract"); 484 if (count<hybsize) 485 { 486 hybridizationDataRows.add(labeledExtract.getName()); 487 } 488 else if (count==2) 489 { 490 twoColorHyb=true; 491 twoColorHybDataRowsFirstSection.add(labeledExtract.getName()); 492 } 493 517 protocolHybSectionHeader.add("Protocol[labeling]"); 494 518 Protocol lbExtractProtocol= labeledExtract.getCreationEvent().getProtocol(); 495 519 protocols.add(lbExtractProtocol); // labeled extract protocol 496 protocolRefId.add(getFormattedProtocolId(lbExtractProtocol)); 497 protocolHybSectionHeader.add("Protocol[labeling]"); 520 if (count<hybsize || count==1) 521 { 522 hybridizationDataRows.add(labeledExtract.getName()); 523 protocolRefId.add(getFormattedProtocolId(lbExtractProtocol)); 524 525 } 526 else if (count==2) 527 { 528 twoColorHyb=true; 529 twoColorHybDataRows.add(labeledExtract.getName()); 530 twoColorProtocolRefId.add(getFormattedProtocolId(lbExtractProtocol)); 531 } 498 532 if (labeledExtract.isAnnotated()) 499 533 { … … 507 541 for (int i=0; i<annotation.getValues().size(); i++) 508 542 { 509 parameterValues.add(annotation.getValues().get(i).toString()); 543 if (count < hybsize || count==1) 544 { 545 parameterValues.add(annotation.getValues().get(i).toString()); 546 } 547 else if(count==2) 548 { 549 twoColorParameterValues.add(annotation.getValues().get(i).toString()); 550 } 510 551 } 511 552 } … … 516 557 } 517 558 } 559 // Label 518 560 String labelName= labeledExtract.getLabel().getName(); // the name of the label 519 561 hybSectionHeader.add("Dye"); … … 524 566 else if (count==2) 525 567 { 526 twoColorHybDataRows FirstSection.add(labelName);568 twoColorHybDataRows.add(labelName); 527 569 } 528 570 // Extract … … 533 575 { 534 576 hybSectionHeader.add("Extract"); 535 if (count < hybsize) 536 { 537 hybridizationDataRows.add(extract.getName()); 538 } 539 else if (count==2) 540 { 541 twoColorHybDataRowsFirstSection.add(extract.getName()); 542 } 543 577 protocolHybSectionHeader.add("Protocol[extraction]"); 544 578 Protocol extractProtocol =extract.getCreationEvent().getProtocol(); //extract protocol 545 579 protocols.add(extractProtocol); 546 protocolRefId.add(getFormattedProtocolId(extractProtocol)); 547 protocolHybSectionHeader.add("Protocol[extraction]"); 580 if (count < hybsize || count==1) 581 { 582 hybridizationDataRows.add(extract.getName()); 583 protocolRefId.add(getFormattedProtocolId(extractProtocol)); 584 } 585 else if (count==2) 586 { 587 twoColorHybDataRows.add(extract.getName()); 588 twoColorProtocolRefId.add(getFormattedProtocolId(extractProtocol)); 589 } 590 548 591 if (extract.isAnnotated()) 549 592 { … … 558 601 { 559 602 System.out.println("The extract protocol parameter is :" + annotation.getValues().get(i).toString()); 560 parameterValues.add(annotation.getValues().get(i).toString()); 603 if (count < hybsize || count==1) 604 { 605 parameterValues.add(annotation.getValues().get(i).toString()); 606 } 607 else if(count==2) 608 { 609 twoColorParameterValues.add(annotation.getValues().get(i).toString()); 610 } 561 611 } 562 612 } … … 570 620 571 621 //Sample 572 Set<Annotatable>sampleOrPooledExtract= extract.getAnnotatableParents(); //get the sample or pooled extract622 //Set<Annotatable>sampleOrPooledExtract= extract.getAnnotatableParents(); //get the sample or pooled extract 573 623 Sample sample =extract.getSample(); // The sample, extract is created from 574 624 if (sample != null) 575 625 { 576 626 hybSectionHeader.add("Sample"); 577 if (count < hybsize) 627 protocolHybSectionHeader.add("Protocol[treatment]"); 628 Protocol sampleProtocol=sample.getCreationEvent().getProtocol(); //sampling protocol 629 protocols.add(sampleProtocol); 630 if (count < hybsize || count==1) 578 631 { 579 632 hybridizationDataRows.add(sample.getName()); 633 protocolRefId.add(getFormattedProtocolId(sampleProtocol)); 580 634 } 581 635 else if (count==2) 582 636 { 583 twoColorHybDataRowsFirstSection.add(sample.getName()); 637 twoColorHybDataRows.add(sample.getName()); 638 twoColorProtocolRefId.add(getFormattedProtocolId(sampleProtocol)); 584 639 } 585 640 586 Protocol sampleProtocol=sample.getCreationEvent().getProtocol(); //sampling protocol 587 protocols.add(sampleProtocol); 588 protocolRefId.add(getFormattedProtocolId(sampleProtocol)); 589 protocolHybSectionHeader.add("Protocol[treatment]"); 590 // sample protocol parameter 641 // sampling protocol parameter 591 642 if (sample.isAnnotated()) 592 643 { 593 644 ItemQuery<Annotation> annotationsQuery = sample.getAnnotationSet().getAnnotations(); 645 annotationsQuery.include(Include.MINE,Include.IN_PROJECT, Include.SHARED); 594 646 ItemResultList<Annotation> annotations= annotationsQuery.list(dc); 595 647 for (Annotation annotation: annotations) 596 648 { 649 597 650 if (sampleProtocol.isParameter(annotation.getAnnotationType())) 598 651 { … … 600 653 for (int i=0; i<annotation.getValues().size(); i++) 601 654 { 602 System.out.println("The sample protocl parameter is :" + annotation.getValues().get(i).toString()); 603 parameterValues.add(annotation.getValues().get(i).toString()); 655 System.out.println("The sample protocol parameter is :" + annotation.getValues().get(i).toString()); 656 if (annotation.getValues().get(i)!=null) 657 { 658 if (count < hybsize || count==1) 659 { 660 parameterValues.add(annotation.getValues().get(i).toString()); 661 } 662 else if(count==2) 663 { 664 twoColorParameterValues.add(annotation.getValues().get(i).toString()); 665 } 666 } 667 else if(annotation.getValues().get(i)!=null) 668 { 669 System.out.println(annotation.getAnnotationType().getName()+ " is not a PARAMETER"); 670 parameterValues.add("\t"); 671 } 672 604 673 } 605 674 } 606 675 //else 607 676 //{ 608 // parameterValues.add("\t"); 677 //System.out.println(annotation.getAnnotationType().getName()+ " is not a PARAMETER"); 678 //parameterValues.add("\t"); 609 679 //} 610 680 } … … 618 688 619 689 hybSectionHeader.add("Biosource"); 620 if (count < hybsize )690 if (count < hybsize || count==1) 621 691 { 622 692 hybridizationDataRows.add(bioSource.getName()); … … 624 694 else if(count==2) 625 695 { 626 twoColorHybDataRows FirstSection.add(bioSource.getName());696 twoColorHybDataRows.add(bioSource.getName()); 627 697 } 628 698 AnnotationSet bsAnnotationSet =bioSource.getAnnotationSet(); … … 637 707 for (int i=0; i<annotation.getValues().size(); i++) 638 708 { 639 if (count < hybsize )709 if (count < hybsize || count==1) 640 710 { 641 711 hybridizationDataRows.add(annotation.getValues().get(i).toString()); … … 643 713 else if(count==2) 644 714 { 645 twoColorHybDataRows FirstSection.add(annotation.getValues().get(i).toString());715 twoColorHybDataRows.add(annotation.getValues().get(i).toString()); 646 716 } 647 648 717 } 649 718 } … … 655 724 } //end of labeled extract loop 656 725 657 System.out.println("THE VALUE OF COUNT IS: "+ count); 658 //for (String protcolId : protocolRefId) //add protocol id 659 //{ 726 //System.out.println("THE VALUE OF COUNT IS: "+ count); 727 // add protocol hyb ref ids 728 for (String protcolId : protocolRefId) //add protocol id 729 { 660 730 //System.out.println("----Test protocol id added----"); 661 731 //System.out.println("Id: "+protcolId); 662 /// hybridizationDataRows.add(protcolId); 663 //} 664 //for (String paramValue : parameterValues ) //add parameter values 665 //{ 732 hybridizationDataRows.add(protcolId); 733 } 734 if (twoColorHyb) 735 { 736 twoColorFirstProtocolRefId.addAll(twoColorProtocolRefId); 737 for (String protocolId : twoColorFirstProtocolRefId ) 738 { 739 twoColorHybDataRows.add(protocolId); 740 } 741 } 742 // add parameter values 743 for (String paramValue : parameterValues ) 744 { 666 745 //System.out.println("----Test parametervalue added----"); 667 // hybridizationDataRows.add(paramValue); 668 //} 746 hybridizationDataRows.add(paramValue); 747 } 748 if (twoColorHyb) 749 { 750 twoColorFirstParameterValues.addAll(twoColorParameterValues); 751 for (String paramValue : twoColorFirstParameterValues ) 752 { 753 twoColorHybDataRows.add(paramValue); 754 } 755 } 756 669 757 /* 670 758 Experimental Factor Section … … 678 766 { 679 767 hybridizationDataRows.add(Values.getEmptyStringIfNull(value.getValues().get(i).toString()).toString()); 768 if (twoColorHyb) twoColorHybDataRows.add(Values.getEmptyStringIfNull(value.getValues().get(i).toString()).toString()); 680 769 } 681 770 } … … 683 772 { 684 773 hybridizationDataRows.add("\t"); 685 } 686 } 687 if (twoColorHyb) 688 { 689 //twoColorHybDataRowsFirstSection.add("-done-"); 690 hybridizationDataRows.addAll(twoColorHybDataRowsFirstSection); 691 //hybridizationDataRows.add("-done-"); 692 } 774 if (twoColorHyb) twoColorHybDataRows.add("\t"); 775 } 776 } 777 778 if (twoColorHyb)hybridizationDataRows.addAll(twoColorHybDataRows); 779 // clear all necessary data holder for reuse 693 780 protocolRefId.clear(); 694 781 parameterValues.clear(); 695 782 factorValues.clear(); 696 if (!twoColorHybDataRowsFirstSection.isEmpty()) 697 { 698 twoColorHybDataRowsFirstSection.clear(); 783 twoColorParameterValues.clear(); 784 twoColorFirstParameterValues.clear(); 785 twoColorFirstProtocolRefId.clear(); 786 twoColorProtocolRefId.clear(); 787 if (!twoColorHybDataRows.isEmpty()) 788 { 789 twoColorHybDataRows.clear(); 699 790 twoColorHyb=false; 700 791 } … … 716 807 } 717 808 718 //Protocol Section 809 /* 810 Tab2Mage Protocol Section 811 */ 719 812 out.write("Protocol section \n"); 720 813 out.write("accession\ttext\tname\ttype\tparameters\n"); … … 745 838 out.flush(); 746 839 747 //Hybridization Section 840 /* 841 Tab2Mage Hybridization Section 842 */ 748 843 out.write("Hybridization section \n"); 844 //header 749 845 for (String header:hybSectionHeader) 750 846 { … … 753 849 754 850 out.write("\n"); 755 //values851 //values 756 852 for (String hybRow: hybridizationDataRows) 757 853 { … … 765 861 } 766 862 } 767 //for (String twoColor :twoColorHybDataRowsFirstSection )768 //{769 // if (twoColor!="-done-")770 // {771 // out.write(twoColor+"\t");772 // }773 // else if("-done-".equals(twoColor))774 // {775 // out.write("\n");776 // }777 //}778 863 out.write("\n"); 779 864 … … 792 877 } 793 878 } 794 // get all the experimental factors for this experiments, 879 /** 880 get all the experimental factors for an experiments 881 @param DcControl dc, the database control 882 @param Experiment experiment, the experiment 883 @param RawBioassay, the rawbioassay that the experimental factors are obtained from 884 @return List, list of annotations 885 */ 795 886 private static List<Annotation> getExperimentalFactorValues(DbControl dc, Experiment experiment, RawBioAssay rba) 796 887 { … … 799 890 experimentalFactorsQuery.include(Include.MINE,Include.IN_PROJECT, Include.SHARED, Include.OTHERS); 800 891 ItemResultList<AnnotationType> experimentalFactors = experimentalFactorsQuery.list(dc); 801 for (AnnotationType exprFactor :experimentalFactors) //create the factor value for this experimentobtaining annotations from rawbioassay892 for (AnnotationType exprFactor :experimentalFactors) //create the expr factor value for this experiment, obtaining annotations from rawbioassay 802 893 { 803 894 factorValuesHybSectionHeader.add("FactorValue["+exprFactor.getName()+"]"); … … 811 902 return values; 812 903 } 813 // get the base format id for the protocol if protocol is null and empty string is returned , this helps to mentain the tab delim format 904 /** 905 Gets the base format id for the protocol, if protocol is null and tab string is returned 906 this is required to have consistent tab delimeted format 907 @param protocol, the protocol used in the experiment 908 @return protocol id, this is a tab when the protocol is null 909 */ 814 910 private static String getFormattedProtocolId (Protocol protocol) 815 911 { 816 String empty="";912 String tab="\t"; 817 913 String protocolId; 818 914 if (protocol!=null) … … 822 918 else 823 919 { 824 protocolId= empty;920 protocolId= tab; 825 921 } 826 922 return protocolId ;
Note: See TracChangeset
for help on using the changeset viewer.