Changeset 518


Ignore:
Timestamp:
Dec 12, 2007, 12:19:07 PM (14 years ago)
Author:
mbayer
Message:

integration of generated tab2mage file with the rest of the code is now partially implemented but not complete (routine check-in for rollback)

Location:
branches/uk_ac_ebi_Tab2MageImporter
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/uk_ac_ebi_Tab2MageImporter/jsp/uk/ac/ebi/nugo/plugins/hybridizations.jsp

    r517 r518  
    145145  <tr>
    146146    <td class="boldText">Name of the experimental organism:</td>
    147     <td class="input"><input type="text" size="60" name="parameter:organism" value="barley"/></td>
     147    <td class="input"><input type="text" size="60" name="parameter:organism" value="Solanum tuberosum"/></td>
    148148  </tr>
    149149
     
    172172  <tr>
    173173    <td class="boldText">Number of treatment groups:</td>
    174     <td class="input"><input type="text" size="3" name="parameter:numTreatmentGroups" value="12"/></td>
     174    <td class="input"><input type="text" size="3" name="parameter:numTreatmentGroups" value="2"/></td>
    175175  </tr>
    176176
     
    179179    <td class="boldText">Please list your experimental factors and value ranges using the following format (one per
    180180    line):<br>
    181     <i>Factor 1(value1,value2,...valueN)<br>
    182     Factor 2(value1,value2,...valueN)</i>
     181    <i>Factor 1(value1,value2,...valueN)<br></i>
    183182    <p>Example: <i><br>
    184183    Compound(aspirin,ibuprofen,acetaminophen) <br>
    185184    Dose(control,low,medium,high)</i>
    186185    </td>
    187     <td class="input"><textarea rows="7" cols="40" name="parameter:expFactors">Factor 1(value1,value2,...valueN)</textarea></td>
     186    <td class="input"><textarea rows="7" cols="40" name="parameter:expFactors">Strain(mutant,wildtype)</textarea></td>
    188187  </tr>
    189188
     
    191190  <tr>
    192191    <td class="boldText">Number of subjects per group (i.e. number of biological replicates):</td>
    193     <td class="input"><input type="text" size="3" name="parameter:numReplicates" value="3"/></td>
     192    <td class="input"><input type="text" size="3" name="parameter:numReplicates" value="2"/></td>
    194193  </tr>
    195194 
     
    198197    <td class="boldText">List all target tissues (as a comma separated list).<br>
    199198    Example: liver,heart,adipose tissue</td>
    200     <td class="input"><textarea rows="2" cols="40" name="parameter:tissues">tissues1,tissue2</textarea></td>
     199    <td class="input"><textarea rows="2" cols="40" name="parameter:tissues">stem</textarea></td>
    201200  </tr>
    202201 
     
    220219        <div class="buttonclass" onmouseover="this.className='buttonclass_hover';"
    221220          onmouseout="this.className='buttonclass';" onclick="browseOnClick()">
    222 
    223         <table border="0" cellspacing="0" cellpadding="0" class="noBorder">
    224           <tr class="noBorder">
    225             <td class="centered"><img src="/base/images/browse.png" border="0"></td>
     221        <div class="buttonclass_inner">
     222        <table border="0" cellspacing="0" cellpadding="0">
     223          <tr>
     224            <td><img src="/base/images/browse.png" border="0"></td>
    226225            <td>Browse&hellip;</td>
    227226          </tr>
    228227        </table>
    229 
     228        </div>
    230229        </div>
    231230        </td>
  • branches/uk_ac_ebi_Tab2MageImporter/src/uk/ac/ebi/nugo/common/Helper.java

    r477 r518  
    7070 
    7171   
    72    public static File processFilePath (User user,boolean overwrite, SessionControl sc, String pathString)
     72   public static File processFilePath (User user,boolean overwrite, SessionControl sc, String pathString) throws Exception
    7373   {
    7474    DbControl dc= null;
     
    9797    {
    9898      dc.close();
     99      throw new Exception(e.getMessage());
    99100    }
    100101    finally
  • branches/uk_ac_ebi_Tab2MageImporter/src/uk/ac/ebi/nugo/plugins/Tab2MageImporter.java

    r517 r518  
    382382      // save the new subDir
    383383      dc.saveItem(subDir);
     384      dc.commit();
    384385     
    385386      if(dc==null)
     
    398399      RawDataType rdt= experiment.getRawDataType(); // experiment platform
    399400
    400 //      String statusp=(String)job.getValue("statusPath");
    401 //      File statusFile=Helper.processFilePath(user,overwrite, sc,statusp);
     401      //write a log file in the same directory where the files were unzipped
     402//      String statusFilePath = subDir.getPath().toString()+"/importerLog.txt";
     403//      System.out.println("statusFile path = "+ statusFilePath);
     404//      File statusFile=Helper.processFilePath(user,true, sc,statusFilePath);       
     405//      statusFile = File.getById(dc, statusFile.getId());     
     406//      System.out.println("statusFile = " +statusFile);
     407     
     408     
     409      ///////////////////////////////////////////////////////////////////////////////////////////////////
     410     
     411      //now write the tab2mage file to the user's home dir on the server so it can be consumed by the plugin
     412      //this takes all the inputs provided by the user on the custom interface (input.jsp)
     413      //give the file a unique name so we don't get any conflicts
     414      Tab2MageWriter t2mWriter = new Tab2MageWriter(job, subDir,sc,paramNames);
     415      t2mWriter.writeTab2MageFile();
     416      File statusFile = t2mWriter.makeStatusFile();
     417      System.out.println("statusFile = " +statusFile.getPath());
     418     
     419      /////////////////////////////////////////////////////////////////////////////////////////////////
     420     
    402421
    403422        //FILE UNZIP MODULE: unzip the files into user specified directory
     
    414433
    415434      // -- end of file unzip module
    416      
    417       ///////////////////////////////////////////////////////////////////////////////////////////////////
    418      
    419       //now write the tab2mage file to the user's home dir on the server so it can be consumed by the plugin
    420       //this takes all the inputs provided by the user on the custom interface (input.jsp)
    421       //give the file a unique name so we don't get any conflicts
    422       Tab2MageWriter t2mWriter = new Tab2MageWriter(job, dir,sc,paramNames);
    423       t2mWriter.writeTab2MageFile();
    424 
    425      
    426       /////////////////////////////////////////////////////////////////////////////////////////////////
    427      
    428 /*
    429435
    430436        //VALIDATION MODULE
     
    461467        return;
    462468      }
    463 
     469     
     470     
    464471      Map<ValidationConstants, Boolean> validations= validator.validateTab2MageFile();
    465472      StringBuffer failureMessage = new StringBuffer();
     
    555562      // -- end of experiment configuration and loading module
    556563
    557         //MESSAGING MODULE
    558        
    559       //  send an email to the user on the success of the experiment (if email server name and email address are provided)
    560       if (hostName!= null && hostName.length()>=5)
    561       {
    562         if (!user.getEmail().equals("") && user.getEmail()!=null )
    563         {
    564           Tab2MageEMessaging message= new Tab2MageEMessaging(writtenExp,"", user.getEmail(),tab2MageFileName, user.getName(), experiment.getName(),hostName );
    565           message.sendEmail();
    566         }
    567       }
    568       // -- end of messaging module
    569       */
    570       //dc.commit();
     564
     565      dc.commit();
    571566      response.setDone("Import plugin ended successfully");
    572567    }
  • branches/uk_ac_ebi_Tab2MageImporter/src/uk/ac/ebi/nugo/plugins/Tab2MageWriter.java

    r517 r518  
    88import net.sf.basedb.core.DbControl;
    99import net.sf.basedb.core.Directory;
     10import net.sf.basedb.core.File;
    1011import net.sf.basedb.core.SessionControl;
    1112import net.sf.basedb.core.plugin.ParameterValues;
     
    7677  public Tab2MageWriter()
    7778  {
    78     initTestParamValues();
    79   }
     79  }
     80 
     81 
    8082
    8183  // ===================================================methods================================================
     
    8688    try
    8789    {
    88       Class cls = Class.forName("uk.ac.ebi.nugo.plugins.Tab2MageWriter");
     90      Tab2MageWriter writer = new Tab2MageWriter();
     91     
     92      Class cls = writer.getClass();
     93      //Class cls = Class.forName("uk.ac.ebi.nugo.plugins.Tab2MageWriter");
     94     
    8995      for (int i = 0; i < paramNames.length; i++)
    9096      {
    91         Field field = cls.getField(paramNames[i]);
     97        Field field = cls.getDeclaredField(paramNames[i]);
    9298        field.set(this, job.getValue(paramNames[i]));
    9399      }
    94     }
     100           
     101      //chop off any potential commas at the end of the experimentalDesign String
     102      //these arise because we string together values form multiple inputs in the web forms
     103      if(experimentalDesign.endsWith(","))
     104      {
     105        experimentalDesign = experimentalDesign.substring(0, experimentalDesign.length()-2);
     106      }
     107    }
    95108    catch (Exception e)
    96109    {
     
    150163    { "P-DIET-1", "P-EXTR-1", "P-LABL-1", "P-HYBR-1", "P-SCAN-1" };
    151164    String[] names = new String[]
    152     { "treatment", "extraction", "labeling", "hybridization", "scanning" };
     165    { "Treatment", "Extraction", "Labeling", "Hybridization", "Scanning" };
    153166    String[] values = new String[]
    154167    { treatmentProtocol, extractionProtocol, labelingProtocol, hybridizationProtocol, scanningProtocol };
     
    157170            hybridizationProtocolParams, scanningProtocolParams };
    158171    String[] types = new String[]
    159     { "grow", "extraction", "labeling", "hybridization", "scanning" };
     172    { "Sampling", "Extraction", "Labeling", "Hybridization", "Scanning" };
    160173
    161174    // print header
     
    180193   
    181194    // print column headers for the section
    182     String [] colHeaders  = new String [] {"File[raw]"," array[accession]"," BioSource"," BioMaterialCharacteristics[Organism]"," BioMaterialCharacteristics[OrganismPart]"," BioMaterialCharacteristics[CellType]"," Sample"," Protocol[grow]"," Extract"," Protocol[extraction]"," LabeledExtract"," Protocol[labeling]"," Dye"," Hybridization"," Protocol[hybridization]"," Scan"," Protocol[scanning]"," FactorValue[Treatment Type]"};
     195    String [] colHeaders  = new String [] {"File[raw]"," Array[accession]"," BioSource"," BioMaterialCharacteristics[Organism]"," BioMaterialCharacteristics[OrganismPart]"," BioMaterialCharacteristics[CellType]"," Sample"," Protocol[Sampling]"," Extract"," Protocol[Extraction]"," LabeledExtract"," Protocol[Labeling]"," Dye"," Hybridization"," Protocol[Hybridization]"," Scan"," Protocol[Scanning]"," FactorValue[Treatment Type]"};
    183196    for (int i = 0; i < colHeaders.length; i++)
    184197    {
     
    187200    t2mContent += "\n";
    188201
    189 
    190 // //////////////////////////////////////////////////////////////////////////////////////////////////////////
    191 
    192 
     202    //the following is a direct translation of Philippe's Perl script code
    193203    int count = 1;
    194204   
     
    212222         
    213223          // file count first
    214           t2mContent += "file-" + count + ".txt" + "\t" +
     224          t2mContent += "file-" + count + ".gpr" + "\t" +
    215225          // accession no. i.e the array design
    216226          accession + "\t" +
     
    254264         
    255265          // file count first
    256           t2mContent += "file-" + count + ".txt" + "\t" +
     266          t2mContent += "file-" + count + ".gpr" + "\t" +
    257267          // accession no. i.e the array design
    258268          accession + "\t" +
     
    296306        }
    297307      }
    298     }
    299    
    300            
    301 // //////////////////////////////////////////////////////////////////////////////////////////////////////////
    302        
     308    }     
    303309  }
    304310
     
    316322      dc.saveItem(t2mFile);
    317323
    318       if (dc == null)
    319         dc = sc.newDbControl();
    320 
    321324      Writer out = new BufferedWriter(new OutputStreamWriter(t2mFile.getUploadStream(false), "ISO-8859-1"));
    322325
    323326      // write content to file
     327      generateFileContents();
    324328      out.write(t2mContent);
    325329
     
    337341    }
    338342  }
     343 
     344  // -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     345
     346  public File makeStatusFile()
     347  {
     348    net.sf.basedb.core.File statusFile = null;
     349    try
     350    {
     351      DbControl dc = sc.newDbControl();
     352      statusFile = net.sf.basedb.core.File.getNew(dc, dir);
     353      statusFile.setName("importerLog.txt");
     354      dc.saveItem(statusFile);
     355      dc.commit();
     356      if (dc != null)
     357        dc.close();
     358    }
     359    catch (Exception e)
     360    {
     361      e.printStackTrace();
     362    }
     363    return statusFile;
     364  }
     365 
     366 
    339367
    340368  // -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     
    352380  // -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    353381
    354   private void initTestParamValues()
     382  public void initTestParamValues()
    355383  {
    356384    /*
     385     * Philippe's hybs params for testing (rest is made up):
     386     *
    357387    --org Homo_sapiens
    358388    --array Agilent1
     
    370400    domain = "scri.ac.uk";
    371401    accession = "Agilent1";
    372     qualityControl = "biological replicate,spike quality control";
    373     experimentalDesign = "cell_component_comparison_design,RNA_stability_design,family_history_design,";
     402    qualityControl = "biological replicate";
     403    experimentalDesign = "strain_or_line_design";
    374404    experimentName = "New experiment";
    375405    description = "description goes here";
     
    400430   
    401431    //hybs
    402     platform = "Agilent";
    403     organism = "Homo_sapiens";
     432    platform = "Genepix";
     433    organism = "Solanum tuberosum";
    404434    numDesigns = "1";
    405435    dyeSwap = "no";
    406436    refSample = "yes";
    407     numTreatmentGroups = "6";
     437    numTreatmentGroups = "2";
    408438    expFactors = "compound(aspirin,ibuprofen);dose(none,medium,high) )";
    409     numReplicates = "4";
    410     tissues = "liver,heart,brain";
     439    numReplicates = "2";
     440    tissues = "stem";
    411441    pooling = "no";
    412442    zipFile = "/home/michab/potato_small.zip";
  • branches/uk_ac_ebi_Tab2MageImporter/src/uk/ac/ebi/nugo/plugins/tab2mageimport/validation/Tab2MageHybridizationValidation.java

    r468 r518  
    183183  public static boolean validateHeader(ArrayList<String> header, Writer writer)
    184184  {
     185    System.out.println("/////////////////////////////////////////////");
     186    System.out.println("hybs headers:");
     187    for (String string : header)
     188    {
     189      System.out.println(string);
     190    }
     191    System.out.println("/////////////////////////////////////////////");
     192   
     193   
    185194    //[TODO] convert all headers to lowercase, to facilitate matching of hyb section header to Tab2mageConstants/Spec
    186195    //header= header2LowerCase(header);
     
    189198    try
    190199    {
    191       if(!header.contains(Tab2MageConstants.hybridization.getName()))
     200      if(!header.contains(Tab2MageConstants.hybridization.getName().trim()))
    192201      {
    193202        log.error("The column \"" + Tab2MageConstants.hybridization.getName() + "\" wasn't found!");
Note: See TracChangeset for help on using the changeset viewer.