Changeset 4092


Ignore:
Timestamp:
Jan 18, 2008, 2:34:10 PM (16 years ago)
Author:
Johan Enell
Message:

Merged from 2.5.1 Correct

File:
1 edited

Legend:

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

    r4091 r4092  
    3838
    3939
     40import net.sf.basedb.core.ArrayDesign;
    4041import net.sf.basedb.core.BaseException;
    4142import net.sf.basedb.core.BasicItem;
     
    9394  to an experiment.
    9495  <p>
    95   Since the data files doesn't have any coordinate information, the plug-in create
    96   fake coordinates like this: block=1, column=1, row=linenumber in file.
    97   The linenmbers start with 1 at the first data line, ie. header lines are not counted.
     96  Since the data files doesn't have any coordinate information the importer will
     97  use one of the following methods.
     98 
     99  <ul>
     100  <li>
     101    If no array design has been selected or if the array design is using the
     102    {@link FeatureIdentificationMethod#COORDINATES} method for identifying features:
     103    The plug-in create fake coordinates like this: block=1, column=1, row=linenumber in file.
     104    The linenmbers start with 1 at the first data line, ie. header lines are not counted.
     105
     106  <li>
     107    If the array design uses the {@link FeatureIdentificationMethod#POSITION}
     108    method for identiyfing features: The plug-in sets the position=line number in file.
     109    The linenmbers start with 1 at the first data line, ie. header lines are not counted.
     110   
     111  <li>
     112    If the array design uses the {@link FeatureIdentificationMethod#FEATURE_ID}
     113    method for identifying features. The plug-in assumes that the feature ID is the
     114    same as the reporter ID.
     115  </ul>
     116 
     117  <p>
     118  NOTE! Since the methods are not conflicting with each other, there will not
     119  be an actual check which method to use by this plug-in. We will simple set all
     120  values as specified above and let the BASE core handle the identification.
    98121
    99122  @author nicklas
     
    129152    ));
    130153 
     154  private static final PluginParameter<String> featureIdentificationParameter =
     155    new PluginParameter<String>(
     156      "featureIdentification",
     157      "Identify features by",
     158      "Choose which method to use for identifying features. If no value " +
     159      "is selected the identification method used on the array design is used: \n\n" +
     160      "* COORDINATES: Use auto-generated coordinates (block = 1, column = 1, row = line number in file)\n" +
     161      "* POSITION: Use auto-generated position = line number in file\n" +
     162      "* FEATURE_ID: Use TargetID (requires that each Target ID only appears once in the file)\n\n" +
     163      "NOTE! This parameter has no meaning unless an array design is selected",
     164      new StringParameterType(255, null, false, 1, 0, 0,
     165        Arrays.asList(new String[] {"COORDINATE", "POSITION", "FEATURE_ID" } ))
     166    );
     167
     168 
    131169 
    132170  private static final PluginParameter<String> invalidColumnsErrorParameter = new PluginParameter<String>(
     
    257295        // Associations
    258296        storeValue(job, request, ri.getParameter("experiment"));
     297        storeValue(job, request, ri.getParameter("arrayDesign"));
     298        storeValue(job, request, featureIdentificationParameter);
    259299        storeValue(job, request, ri.getParameter("scan"));
    260300        storeValue(job, request, ri.getParameter("protocol"));
     
    286326  private DbControl dc;
    287327  private Experiment experiment;
     328  private ArrayDesign design;
    288329  private Scan scan;
    289330  private Software software;
    290331  private Protocol protocol;
     332  private FeatureIdentificationMethod fiMethod;
    291333  private List<RawBioAssay> rawBioAssays;
    292334  private List<BatchAndMapHolder> holders;
     
    371413    this.headerLines = new LinkedList<Line>();
    372414    this.experiment = (Experiment)job.getValue("experiment");
     415    this.design = (ArrayDesign)job.getValue("arrayDesign");
    373416    this.scan = (Scan)job.getValue("scan");
    374417    this.protocol = (Protocol)job.getValue("protocol");
    375418    this.software = (Software)job.getValue("software");
    376419   
     420    // Feature identification
     421    try
     422    {
     423      String fiTemp = (String)job.getValue("featureIdentification");
     424      fiMethod = FeatureIdentificationMethod.valueOf(fiTemp);
     425    }
     426    catch (Exception ex)
     427    {
     428      fiMethod = null;
     429    }
    377430    // Setup error handling
    378431    this.nullIfException = "null".equals(getErrorOption("numberFormatError"));
     
    431484      // Need to reload raw bioassay with current DbControl
    432485      rba = RawBioAssay.getById(dc, rba.getId());
    433       RawDataBatcher batcher = rba.getRawDataBatcher();
     486      RawDataBatcher batcher = rba.getRawDataBatcher(fiMethod);
    434487      batcher.useNullIfReporterNotFound(nullIfMissingReporter);
    435488      holders.add(new BatchAndMapHolder(batcher, illumina, ffp));
     
    566619            RawBioAssay rba = RawBioAssay.getNew(dc, generic, illumina);
    567620            rba.setName(arrayName);
     621            if (design != null) rba.setArrayDesign(design);
    568622            if (scan != null) rba.setScan(scan);
    569623            if (protocol != null) rba.setProtocol(protocol);
     
    619673        parameters.add(getDecimalSeparatorParameter(null, null, (String)job.getValue(DECIMAL_SEPARATOR)));
    620674 
    621         // parameters for scan, protocol and software
     675        // parameters for scan, protocol, software and array design
    622676        dc = sc.newDbControl();
    623677        List<Scan> scans = getItems(dc, Scan.getQuery());
     
    634688            )
    635689          );
     690        List<ArrayDesign> designs = getItems(dc, ArrayDesign.getQuery(),
     691          Restrictions.gt(
     692              Hql.property("numDbFeatures"),
     693              Expressions.integer(0)
     694            )
     695          );
    636696       
    637697        boolean hasAssociations =
    638698          context.getItem() == Item.EXPERIMENT || scans.size() > 0 ||
    639           protocols.size() > 0 || software.size() > 0;
     699          protocols.size() > 0 || software.size() > 0 || designs.size() > 0;
    640700       
    641701        if (hasAssociations)
     
    651711                new ItemParameterType<Experiment>(Experiment.class, null, true, 1, null)
    652712              ));
     713          }
     714          if (!designs.isEmpty())
     715          {
     716            parameters.add(new PluginParameter<ArrayDesign>(
     717              "arrayDesign",
     718              "Array design",
     719              "The imported raw bioassays will be linked to the selected array design.",
     720              new ItemParameterType<ArrayDesign>(ArrayDesign.class, null, false, 1, designs)
     721            ));
     722            parameters.add(featureIdentificationParameter);
    653723          }
    654724          if (!scans.isEmpty())
Note: See TracChangeset for help on using the changeset viewer.