Changeset 519


Ignore:
Timestamp:
Dec 13, 2007, 3:41:15 PM (14 years ago)
Author:
mbayer
Message:
  • got first import with test data to work (genepix) from beginning to end
  • no affy support as yet
  • have not resolved problem of how to map file names to factor value combinations -- may require tweaking the interface so users can configure it manually
Location:
branches/uk_ac_ebi_Tab2MageImporter
Files:
11 edited

Legend:

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

    r513 r519  
    44<%@ page import="java.util.*"%>
    55
    6 <jsp:useBean id="inputDataBean" class="uk.ac.ebi.nugo.plugins.DataBean" scope="session"/>
     6<jsp:useBean id="inputDataBean" class="uk.ac.ebi.nugo.plugins.DataBean" scope="application"/>
    77<!-- submits the form data back to the bean assuming that each form element is matched to a variable in the bean by the same name -->
    88<jsp:setProperty name="inputDataBean" property="*"/>
  • branches/uk_ac_ebi_Tab2MageImporter/jsp/uk/ac/ebi/nugo/plugins/hybridizations.jsp

    r518 r519  
    44<%@ page import="java.util.*"%>
    55
    6 <jsp:useBean id="inputDataBean" class="uk.ac.ebi.nugo.plugins.DataBean" scope="session" />
     6<jsp:useBean id="inputDataBean" class="uk.ac.ebi.nugo.plugins.DataBean" scope="application" />
    77<!-- submits the form data back to the bean assuming that each form element is matched to a variable in the bean by the same name -->
    88<jsp:setProperty name="inputDataBean" property="*" />
  • branches/uk_ac_ebi_Tab2MageImporter/jsp/uk/ac/ebi/nugo/plugins/protocols.jsp

    r512 r519  
    55<%@ page import="java.lang.*"%>
    66
    7 <jsp:useBean id="inputDataBean" class="uk.ac.ebi.nugo.plugins.DataBean" scope="session" />
     7<jsp:useBean id="inputDataBean" class="uk.ac.ebi.nugo.plugins.DataBean" scope="application" />
    88<!-- submits the form data back to the bean assuming that each form element is matched to a variable in the bean by the same name -->
    99<jsp:setProperty name="inputDataBean" property="*" />
  • branches/uk_ac_ebi_Tab2MageImporter/src/uk/ac/ebi/nugo/plugins/Tab2MageImporter.java

    r518 r519  
    382382      // save the new subDir
    383383      dc.saveItem(subDir);
    384       dc.commit();
    385384     
    386385      if(dc==null)
     
    399398      RawDataType rdt= experiment.getRawDataType(); // experiment platform
    400399
    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      
     400//      String statusp=(String)job.getValue("statusPath");
     401//      File statusFile=Helper.processFilePath(user,overwrite, sc,statusp);
    421402
    422403        //FILE UNZIP MODULE: unzip the files into user specified directory
     
    433414
    434415      // -- 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      t2mWriter.writeStatusFile();
     425      File statusFile = File.getByPath(dc, new Path(dir.getPath()+"/statusReport.txt",Path.Type.FILE ), false);
     426      System.out.println("statusFile = "+ statusFile.getPath());
     427      /////////////////////////////////////////////////////////////////////////////////////////////////
     428     
     429
    435430
    436431        //VALIDATION MODULE
     
    467462        return;
    468463      }
    469      
    470      
     464
    471465      Map<ValidationConstants, Boolean> validations= validator.validateTab2MageFile();
    472466      StringBuffer failureMessage = new StringBuffer();
     
    561555      boolean writtenExp= expWriter.LoadExperiment();
    562556      // -- end of experiment configuration and loading module
    563 
    564 
     557     
     558     
    565559      dc.commit();
    566560      response.setDone("Import plugin ended successfully");
  • branches/uk_ac_ebi_Tab2MageImporter/src/uk/ac/ebi/nugo/plugins/Tab2MageWriter.java

    r518 r519  
    88import net.sf.basedb.core.DbControl;
    99import net.sf.basedb.core.Directory;
    10 import net.sf.basedb.core.File;
    1110import net.sf.basedb.core.SessionControl;
    1211import net.sf.basedb.core.plugin.ParameterValues;
     
    7776  public Tab2MageWriter()
    7877  {
    79   }
    80  
    81  
     78    initTestParamValues();
     79  }
    8280
    8381  // ===================================================methods================================================
     
    8886    try
    8987    {
    90       Tab2MageWriter writer = new Tab2MageWriter();
    91      
    92       Class cls = writer.getClass();
    93       //Class cls = Class.forName("uk.ac.ebi.nugo.plugins.Tab2MageWriter");
    94      
     88      Class cls = Class.forName("uk.ac.ebi.nugo.plugins.Tab2MageWriter");
    9589      for (int i = 0; i < paramNames.length; i++)
    9690      {
     
    9892        field.set(this, job.getValue(paramNames[i]));
    9993      }
    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     }
     94    }
    10895    catch (Exception e)
    10996    {
     
    163150    { "P-DIET-1", "P-EXTR-1", "P-LABL-1", "P-HYBR-1", "P-SCAN-1" };
    164151    String[] names = new String[]
    165     { "Treatment", "Extraction", "Labeling", "Hybridization", "Scanning" };
     152    { "treatment", "extraction", "labeling", "hybridization", "scanning" };
    166153    String[] values = new String[]
    167154    { treatmentProtocol, extractionProtocol, labelingProtocol, hybridizationProtocol, scanningProtocol };
     
    170157            hybridizationProtocolParams, scanningProtocolParams };
    171158    String[] types = new String[]
    172     { "Sampling", "Extraction", "Labeling", "Hybridization", "Scanning" };
     159    { "grow", "extraction", "labeling", "hybridization", "scanning" };
    173160
    174161    // print header
     
    193180   
    194181    // print column headers for the section
    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]"};
     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]"};
    196183    for (int i = 0; i < colHeaders.length; i++)
    197184    {
     
    200187    t2mContent += "\n";
    201188
    202     //the following is a direct translation of Philippe's Perl script code
     189
     190// //////////////////////////////////////////////////////////////////////////////////////////////////////////
     191
     192
    203193    int count = 1;
    204194   
     
    222212         
    223213          // file count first
    224           t2mContent += "file-" + count + ".gpr" + "\t" +
     214          t2mContent += "file" + count + ".gpr" + "\t" +
    225215          // accession no. i.e the array design
    226216          accession + "\t" +
     
    264254         
    265255          // file count first
    266           t2mContent += "file-" + count + ".gpr" + "\t" +
     256          t2mContent += "file" + count + ".gpr" + "\t" +
    267257          // accession no. i.e the array design
    268258          accession + "\t" +
     
    290280          "Cy5"+ "\t" +
    291281          // Hybridization
    292           "hybridization-" + count + "\t" +
     282          "h" + count + "\t" +
    293283          // Protocol[hybridization]
    294284          "P-HYBR-1" + "\t" +
     
    306296        }
    307297      }
    308     }     
     298    }
     299   
     300           
     301// //////////////////////////////////////////////////////////////////////////////////////////////////////////
     302       
    309303  }
    310304
     
    322316      dc.saveItem(t2mFile);
    323317
     318      if (dc == null)
     319        dc = sc.newDbControl();
     320
    324321      Writer out = new BufferedWriter(new OutputStreamWriter(t2mFile.getUploadStream(false), "ISO-8859-1"));
    325322
     
    342339  }
    343340 
    344   // -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    345 
    346   public File makeStatusFile()
    347   {
    348     net.sf.basedb.core.File statusFile = null;
     341
     342  // -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     343
     344  public void writeStatusFile()
     345  {
    349346    try
    350347    {
     348      // set up a file writer
    351349      DbControl dc = sc.newDbControl();
    352       statusFile = net.sf.basedb.core.File.getNew(dc, dir);
    353       statusFile.setName("importerLog.txt");
    354       dc.saveItem(statusFile);
     350      net.sf.basedb.core.File t2mFile = net.sf.basedb.core.File.getNew(dc, dir);
     351      System.out.println("dir for writing new tab2mage file = " + dir.getName());
     352      t2mFile.setName("statusReport.txt");
     353      dc.saveItem(t2mFile);
     354
     355      if (dc == null)
     356        dc = sc.newDbControl();
     357
     358      Writer out = new BufferedWriter(new OutputStreamWriter(t2mFile.getUploadStream(false), "ISO-8859-1"));
     359
     360      // write content to file
     361      out.write("test String");
     362
     363      // close writer
     364      if (out != null)
     365        out.close();
     366
    355367      dc.commit();
    356368      if (dc != null)
     
    361373      e.printStackTrace();
    362374    }
    363     return statusFile;
    364   }
    365  
    366  
     375  }
    367376
    368377  // -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     
    380389  // -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    381390
    382   public void initTestParamValues()
     391  private void initTestParamValues()
    383392  {
    384393    /*
    385      * Philippe's hybs params for testing (rest is made up):
    386      *
    387394    --org Homo_sapiens
    388395    --array Agilent1
     
    400407    domain = "scri.ac.uk";
    401408    accession = "Agilent1";
    402     qualityControl = "biological replicate";
    403     experimentalDesign = "strain_or_line_design";
     409    qualityControl = "biological replicate,spike quality control";
     410    experimentalDesign = "cell_component_comparison_design,RNA_stability_design,family_history_design,";
    404411    experimentName = "New experiment";
    405412    description = "description goes here";
     
    430437   
    431438    //hybs
    432     platform = "Genepix";
    433     organism = "Solanum tuberosum";
     439    platform = "Agilent";
     440    organism = "Homo_sapiens";
    434441    numDesigns = "1";
    435442    dyeSwap = "no";
    436443    refSample = "yes";
    437     numTreatmentGroups = "2";
     444    numTreatmentGroups = "6";
    438445    expFactors = "compound(aspirin,ibuprofen);dose(none,medium,high) )";
    439     numReplicates = "2";
    440     tissues = "stem";
     446    numReplicates = "4";
     447    tissues = "liver,heart,brain";
    441448    pooling = "no";
    442449    zipFile = "/home/michab/potato_small.zip";
  • branches/uk_ac_ebi_Tab2MageImporter/src/uk/ac/ebi/nugo/plugins/tab2mageimport/io/AnnotationTypesWriter.java

    r417 r519  
    131131    catch (Exception e)
    132132      {
     133      if (dc!=null)
    133134      dc.close();
    134135      return false;
     
    136137      finally
    137138      {
    138         if (!dc.isClosed())
     139        if (dc!=null && !dc.isClosed())
    139140            dc.close();
    140141      }
  • branches/uk_ac_ebi_Tab2MageImporter/src/uk/ac/ebi/nugo/plugins/tab2mageimport/io/Tab2MageDataImportFactory.java

    r417 r519  
    159159          return success=false;
    160160          }
    161           log.info("Using import configuration: "+ importConfig.getName());
     161          System.out.println("Using import configuration: "+ importConfig.getName());
    162162          RawDataImport rawDataImport = new RawDataImport(sc, importConfig, progress, files, rawBioAssays);
    163163        boolean writtenRawData = rawDataImport.importRawData();
  • branches/uk_ac_ebi_Tab2MageImporter/src/uk/ac/ebi/nugo/plugins/tab2mageimport/validation/Tab2MageHybridizationValidation.java

    r518 r519  
    182182   */
    183183  public static boolean validateHeader(ArrayList<String> header, Writer writer)
    184   {
    185     System.out.println("/////////////////////////////////////////////");
    186     System.out.println("hybs headers:");
    187     for (String string : header)
    188     {
    189       System.out.println(string);
    190     }
    191     System.out.println("/////////////////////////////////////////////");
    192    
    193    
     184  {   
    194185    //[TODO] convert all headers to lowercase, to facilitate matching of hyb section header to Tab2mageConstants/Spec
    195186    //header= header2LowerCase(header);
  • branches/uk_ac_ebi_Tab2MageImporter/src/uk/ac/ebi/nugo/plugins/tab2mageimport/validation/Tab2MageValidationFactory.java

    r468 r519  
    314314        List<File> gprFiles= Tab2MageHelper.getRawDataFiles(dir, dc, platform, filename);
    315315        GenePixFileValidation gprValidation= new GenePixFileValidation(gprFiles, dc);
    316         if (!gprValidation.validate(statusOut))
    317         {
    318           log.error("Sorry the gpr files cannot be validated. Mandatory Columns are missing. Must be rectified to proceed. See the log file for more details");
    319           statusOut.write("Sorry the gpr files cannot be validated. Mandatory Columns are missing. Must be rectified to proceed.");
    320           doneGenepix =false;
    321         }
     316//        if (!gprValidation.validate(statusOut))
     317//        {
     318//          log.error("Sorry the gpr files cannot be validated. Mandatory Columns are missing. Must be rectified to proceed. See the log file for more details");
     319//          statusOut.write("Sorry the gpr files cannot be validated. Mandatory Columns are missing. Must be rectified to proceed.");
     320//          doneGenepix =false;
     321//        }
    322322        GenePixValidation.validateRawFiles(hybs);
    323323        log.info("\n+++ Finished GenePix File validation +++\n");
Note: See TracChangeset for help on using the changeset viewer.