Changeset 4919


Ignore:
Timestamp:
May 4, 2009, 11:15:39 AM (13 years ago)
Author:
Nicklas Nordborg
Message:

References #1120: The dynamic part of BASE should keep track whether intensity data is in log space or not

Base1PluginExecuter can now handle BASE 1 plug-ins that works with logged data.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/plugins/core/net/sf/basedb/plugins/Base1PluginExecuter.java

    r4917 r4919  
    4646import net.sf.basedb.core.Include;
    4747import net.sf.basedb.core.IntegerParameterType;
     48import net.sf.basedb.core.IntensityTransform;
    4849import net.sf.basedb.core.Item;
    4950import net.sf.basedb.core.ItemNotFoundException;
     
    313314          //getManualConfigureParameters();
    314315 
     316          // Check number of channels
    315317          int channels = bas.getRawDataType().getChannels();
    316318          int maxChannels = Values.getInt(String.valueOf(configuration.getValue("maxChannels")), 0);
     
    320322            return configuration.getPluginConfiguration().getName() + " can't work on " + channels + "-channel data; min=" + minChannels + "; max=" + maxChannels;
    321323          }
     324         
     325          // Check source data intensity transform
     326          IntensityTransform transform = bas.getIntensityTransform();
     327          String requiredTransform = (String)configuration.getValue("sourceTransform");
     328          if (requiredTransform != null)
     329          {
     330            if (!requiredTransform.equals(transform.name()))
     331            {
     332              String transformed =  transform.isTransformed() ?
     333                  transform.toString() + "-transformed" : "untransformed";
     334              return configuration.getPluginConfiguration().getName() +
     335                " can't work on " + transformed + " data";
     336            }
     337          }
    322338          List<String> extraValues = new ArrayList<String>();
    323339          for (ExtraValue ev : bas.getExtraValues().list(dc))
     
    376392      if (command.equals(Request.COMMAND_CONFIGURE_PLUGIN))
    377393      {
     394        RequestInformation ri = getConfigurePluginParameters();
     395        List<Throwable> errors = validateRequestParameters(ri.getParameters(), request);
     396        if (errors != null)
     397        {
     398          response.setError(errors.size() + " invalid parameter(s) were found in the request", errors);
     399          return;
     400        }
    378401        storeValue(configuration, request, execPathParameter);
     402        storeValue(configuration, request, ri.getParameter("sourceTransform"));
     403        storeValue(configuration, request, ri.getParameter("resultTransform"));
    379404       
    380405        dc = sc.newDbControl();
     
    569594      boolean leaveStdin = Boolean.TRUE.equals(configuration.getValue("leaveStdin"));
    570595      boolean leaveStdout = Boolean.TRUE.equals(configuration.getValue("leaveStdout"));
     596      IntensityTransform resultTransform = null;
     597      if (configuration.getValue("resultTransform") != null)
     598      {
     599        resultTransform = IntensityTransform.valueOf((String)configuration.getValue("resultTransform"));
     600      }
    571601
    572602      try
     
    691721          associateFiles(dc, trans, workingDirectory);
    692722          if (chainedProgress != null) chainedProgress.setRange(65, 95);
    693           importData(dc, stdout, trans, chainedProgress);
     723          importData(dc, stdout, trans, resultTransform, chainedProgress);
    694724          dc.commit();
    695725        }
     
    12011231      parameters.add(fileParameter);
    12021232      parameters.add(execPathParameter);
     1233     
     1234      Enumeration<String, String> transforms = new Enumeration<String, String>();
     1235      for (IntensityTransform t : IntensityTransform.values())
     1236      {
     1237        transforms.add(t.name(), t.toString());
     1238      }
     1239      parameters.add(
     1240        new PluginParameter<String>(
     1241          "sourceTransform",
     1242          "Source intensities",
     1243          "The type of spot intensity values that the source bioassay set must have " +
     1244          "for this plug-in to work correctly. If not specified the plug-in can work " +
     1245          "with any kind of data.",
     1246          new StringParameterType(255, null, false, 1, 0, 0, transforms)
     1247        )
     1248      );
     1249      parameters.add(
     1250        new PluginParameter<String>(
     1251          "resultTransform",
     1252          "Resulting intensities",
     1253          "The type of spot intensity values this plug-in generates. If not " +
     1254          "specified it is expected to generate the same type of values as are found " +
     1255          "in the source bioassay set",
     1256          new StringParameterType(255, null, false, 1, 0, 0, transforms)
     1257        )
     1258      );
     1259     
    12031260      configurePlugin = new RequestInformation(
    12041261        Request.COMMAND_CONFIGURE_PLUGIN,
     
    13461403    @throws IOException if there is any error reading from stdout.txt
    13471404  */
    1348   private void importData(DbControl dc, File stdout, Transformation t, ProgressReporter progress)
     1405  private void importData(DbControl dc, File stdout, Transformation t,
     1406      IntensityTransform resultTransform, ProgressReporter progress)
    13491407    throws SQLException, IOException
    13501408  {
     
    13711429   
    13721430    BioAssaySet source = t.getSource();
     1431    if (resultTransform == null) resultTransform = source.getIntensityTransform();
    13731432    int numSections = 0;
    13741433    long totalBytes = stdout.getSize();
     
    16831742      child = t.newProduct(null, "new", false);
    16841743    }
     1744    child.setIntensityTransform(resultTransform);
    16851745    dc.saveItem(child);
    16861746
Note: See TracChangeset for help on using the changeset viewer.