Changeset 396


Ignore:
Timestamp:
Aug 15, 2007, 11:56:47 AM (14 years ago)
Author:
dominic
Message:

added util jar files and build file etc

Location:
trunk/uk/ac/ebi/Tab2MageExporter
Files:
10 added
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/uk/ac/ebi/Tab2MageExporter/src/uk/ac/ebi/nugo/plugins/Tab2MageExporter.java

    r360 r396  
    2222*/
    2323package uk.ac.ebi.nugo.plugins;
    24 
    2524import java.io.Writer;
    2625import java.util.ArrayList;
     
    7978import net.sf.basedb.core.query.Hql;
    8079import net.sf.basedb.core.query.Orders;
    81 import uk.ac.ebi.nugo.plugins.ta2mageexport.Tab2MageConstants;
    82 import uk.ac.ebi.nugo.plugins.ta2mageexport.Tab2MageHelper;
     80import net.sf.basedb.util.Values;
     81import uk.ac.ebi.nugo.common.Helper;
     82import uk.ac.ebi.nugo.common.Tab2MageConstants;
     83import uk.ac.ebi.nugo.plugins.ta2mageexport.ExporHelper;
    8384import uk.ac.ebi.nugo.plugins.ta2mageexport.Tab2MageWriter;
    84 import uk.ac.ebi.nugo.plugins.util.Values;
    8585
    8686
     
    243243    {
    244244      response.setError(ex.getMessage(), Arrays.asList(ex));
    245       ex.printStackTrace();
    246245    }   
    247246  }
     
    305304      if ((Boolean)job.getValue("overwrite") != null) overwrite = (Boolean)job.getValue("overwrite");
    306305      String p = (String)job.getValue("exportPath");
    307       File file=Tab2MageHelper.processFilePath(user,overwrite, dc,p);     
     306      File file=Helper.processFilePath(user,overwrite, dc,p);     
    308307      String statusp=(String)job.getValue("statusPath");
    309       File statusFile=Tab2MageHelper.processFilePath(user,overwrite, dc,statusp);
     308      File statusFile=Helper.processFilePath(user,overwrite, dc,statusp);
    310309      Experiment experiment= (Experiment)job.getValue("experiment");
    311310      experiment= Experiment.getById(dc,experiment.getId());
     
    322321 
    323322      }
    324       //intialise, count resources used, create concurrentmap for all parameter headers
     323      //initialise, count resources used, create concurrentmap for all parameter headers
    325324      getResourceCounter(experiment,dc);
    326325           
     
    518517            poolSampleHeader.addAll(hybridizationDataRows);
    519518           
    520             bioSources.addAll(Tab2MageHelper.getBiosources(sample, dc));
     519            bioSources.addAll(ExporHelper.getBiosources(sample, dc));
    521520          }
    522521          else if (!sample.isPooled())
     
    858857        newParameterHybSectionHeader.add(annotation.getAnnotationType().getName());
    859858    }
    860     //Tab2MageHelper.displayParameterHeader(newParameterHybSectionHeader);
     859    //Helper.displayParameterHeader(newParameterHybSectionHeader);
    861860  }
    862861  /**
  • trunk/uk/ac/ebi/Tab2MageExporter/src/uk/ac/ebi/nugo/plugins/ta2mageexport/Tab2MageWriter.java

    r360 r396  
    1313import net.sf.basedb.core.AnnotationType;
    1414import net.sf.basedb.core.Application;
    15 import net.sf.basedb.core.BaseException;
    1615import net.sf.basedb.core.DbControl;
    1716import net.sf.basedb.core.Experiment;
     
    2322import net.sf.basedb.core.plugin.ParameterValues;
    2423import net.sf.basedb.core.plugin.Response;
    25 import uk.ac.ebi.nugo.plugins.util.Values;
     24import net.sf.basedb.util.Values;
     25import uk.ac.ebi.nugo.common.NutribasePluginException;
     26import uk.ac.ebi.nugo.common.Tab2MageConstants;
     27import uk.ac.ebi.nugo.common.ValueFormatter;
    2628
    2729/**
     
    2931  @author Dominic Oyeniran
    3032  @version 1.0
    31   @base.modified $Date
    3233*/
    33 public class Tab2MageWriter {
     34public class Tab2MageWriter
     35{
    3436
    3537  private static Writer out;
     
    4042    creates the buffered output stream file writers for the specified files
    4143      @param outputFile, the tab2mage output file
    42       @param statusFile, the status fiel for failure, errors and exeptions
     44      @param statusFile, the status file for failure, errors and exceptions
    4345   */
    4446 
     
    5456    catch(UnsupportedEncodingException e)
    5557    {
    56       new BaseException(e);
     58      new NutribasePluginException(e.getMessage());
    5759    }
    5860   
     
    107109      out.write(Tab2MageConstants.accession.getName()+"\t"+"E-BASE-"+experiment.getId()+"\n");
    108110      out.write(Tab2MageConstants.quality_control.getName()+"\t\n");
    109       out.write(Tab2MageConstants.experiment_design_type.getName()+"\t"+ Tab2MageHelper.getEmptyStringIfNull(experiment.getExperimentDesign())+"\n");
     111      out.write(Tab2MageConstants.experiment_design_type.getName()+"\t"+ ValueFormatter.getEmptyStringIfNull(experiment.getExperimentDesign())+"\n");
    110112      out.write(Tab2MageConstants.experiment_name.getName()+"\t"+experiment.getName() +"\n");
    111       String description = experiment.getDescription()!=null && experiment.getDescription().length()!=0 ? experiment.getDescription(): Tab2MageHelper.getEmptyStringIfNull(experiment.getAbstract()).toString();
     113      String description = experiment.getDescription()!=null && experiment.getDescription().length()!=0 ? experiment.getDescription(): ValueFormatter.getEmptyStringIfNull(experiment.getAbstract()).toString();
    112114      out.write(Tab2MageConstants.description.getName()+"\t"+description +"\n");
    113115      out.write(Tab2MageConstants.release_date.getName()+"\t"+job.getValue("releaseDate")+"\n");
    114116      out.write(Tab2MageConstants.submission_date.getName()+"\t"+Values.formatDate(new Date())+"\n");
    115117      out.write(Tab2MageConstants.submitter.getName()+"\t"+experiment.getOwner().getName()+"\n");
    116       out.write(Tab2MageConstants.submitter_email.getName()+"\t"+Tab2MageHelper.getEmptyStringIfNull(experiment.getOwner().getEmail())+"\n");
    117       out.write(Tab2MageConstants.organization.getName()+"\t"+ Tab2MageHelper.getEmptyStringIfNull(experiment.getOwner().getOrganisation()) +"\n");
    118       out.write(Tab2MageConstants.publication_title.getName()+"\t"+Tab2MageHelper.getEmptyStringIfNull(experiment.getTitle()) +"\n");
    119       out.write(Tab2MageConstants.authors.getName()+"\t"+Tab2MageHelper.getEmptyStringIfNull(experiment.getAuthors())+"\n");
    120       out.write(Tab2MageConstants.journal.getName()+"\t"+Tab2MageHelper.getEmptyStringIfNull(experiment.getPublication())+"\n");
     118      out.write(Tab2MageConstants.submitter_email.getName()+"\t"+ValueFormatter.getEmptyStringIfNull(experiment.getOwner().getEmail())+"\n");
     119      out.write(Tab2MageConstants.organization.getName()+"\t"+ ValueFormatter.getEmptyStringIfNull(experiment.getOwner().getOrganisation()) +"\n");
     120      out.write(Tab2MageConstants.publication_title.getName()+"\t"+ValueFormatter.getEmptyStringIfNull(experiment.getTitle()) +"\n");
     121      out.write(Tab2MageConstants.authors.getName()+"\t"+ValueFormatter.getEmptyStringIfNull(experiment.getAuthors())+"\n");
     122      out.write(Tab2MageConstants.journal.getName()+"\t"+ValueFormatter.getEmptyStringIfNull(experiment.getPublication())+"\n");
    121123      out.write(Tab2MageConstants.volume.getName()+"\t\n");
    122124      out.write(Tab2MageConstants.issue.getName()+"\t\n");
    123125      out.write(Tab2MageConstants.pages.getName()+"\t\n");
    124126      out.write(Tab2MageConstants.year.getName()+"\t"+ String.format("%1$tY", experiment.getPublicationDate())+"\n");
    125       out.write(Tab2MageConstants.pubmed_id.getName()+"\t"+Tab2MageHelper.getEmptyStringIfNull(experiment.getPubMedId())+"\n");
     127      out.write(Tab2MageConstants.pubmed_id.getName()+"\t"+ValueFormatter.getEmptyStringIfNull(experiment.getPubMedId())+"\n");
    126128      out.write("\n");
    127129      out.flush();
     
    135137    writes Tab2Mage protocol section
    136138    @param protocols, list of protocols to write
    137     @param response, the reponse object to return failures or exceptions
     139    @param response, the response object to return failures or exceptions
    138140    @param dc, database control object
    139141   */
     
    152154        {
    153155          out.write("P-BASE-"+protocol.getId()+"\t");
    154           out.write(Tab2MageHelper.getEmptyStringIfNull(protocol.getDescription())+"\t");
    155           out.write(Tab2MageHelper.getEmptyStringIfNull(protocol.getName())+"\t");
    156           out.write(Tab2MageHelper.getEmptyStringIfNull(protocol.getProtocolType().getName())+"\t");
     156          out.write(ValueFormatter.getEmptyStringIfNull(protocol.getDescription())+"\t");
     157          out.write(ValueFormatter.getEmptyStringIfNull(protocol.getName())+"\t");
     158          out.write(ValueFormatter.getEmptyStringIfNull(protocol.getProtocolType().getName())+"\t");
    157159          ItemQuery<AnnotationType> parameterQuery= protocol.getParameters();
    158160          parameterQuery.include(Include.MINE, Include.SHARED,Include.IN_PROJECT);
     
    165167          }
    166168          length=0;
     169         
     170          if (parameters.size()==0 || parameters.isEmpty())
     171          {
     172            out.write("");
     173          }
    167174          out.write("\t\n");
    168175        }
     
    180187     writes Tab2Mage hybridization  header section
    181188     @param hybSectionHeader, the header to display
    182      @param response, the reponse object to reytun failures or expceptions
     189     @param response, the response object to return failures or exceptions
    183190   */
    184191
     
    205212     Tab2Mage Hybridization  Channel Line Section
    206213     @param hybDataRow, the data rows to display
    207      @param response, the reponse object to return failures or expceptions
     214     @param response, the response object to return failures or exceptions
    208215   */
    209216
     
    231238      response.setError(ex.getMessage(), Arrays.asList(ex));
    232239    }
    233    
    234240  }
    235241 
     
    254260   * @return
    255261   */
    256   public static Writer getOut() {
     262  public static Writer getOut()
     263  {
    257264    return out;
    258265  }
    259266
    260   static void setOut(Writer out) {
     267  static void setOut(Writer out)
     268  {
    261269    Tab2MageWriter.out = out;
    262270  }
     
    266274   */
    267275 
    268   public static Writer getStatusOut() {
     276  public static Writer getStatusOut()
     277  {
    269278    return statusOut;
    270279  }
    271280
    272   static void setStatusOut(Writer statusOut) {
     281  static void setStatusOut(Writer statusOut)
     282  {
    273283    Tab2MageWriter.statusOut = statusOut;
    274284  }
Note: See TracChangeset for help on using the changeset viewer.