Changeset 4461


Ignore:
Timestamp:
Mar 21, 2013, 12:42:01 PM (11 years ago)
Author:
olle
Message:

Refs #802. Non-gel hits import updated to support replicate ID input from parsing filename of mass spectrum file. The design is based on that for fraction ID input, but with fewer alternatives.

Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/client/servlet/src/locale/en/dictionary

    r4458 r4461  
    294294ImportedPeakLists=Imported Peak Lists
    295295ImportedSearches=Imported Searches
    296 ImportHitsNonGelWizardRegexPattern=Regex pattern:
     296ImportHitsNonGelWizardRegexPatternFractionId=Regex pattern:
     297ImportHitsNonGelWizardRegexPatternReplicateId=Regex pattern:
    297298ImportHitsNonGelWizardStep1AdditionalParametersDescription=Step 1. Additional Parameters Description
    298299ImportHitsNonGelWizardStep1FormLegend=Step 1. Register peaklist files for local sample ID
     
    302303ImportHitsNonGelWizardStep1FormLegendStep1a=Step 1a. Register peaklist files for local sample ID
    303304ImportHitsNonGelWizardStep2FormLegend=Step 2. Import protein identification results
    304 ImportHitsNonGelWizardUseRegexPattern=Use regex pattern to parse fraction ID from filename
     305ImportHitsNonGelWizardUseRegexPatternFractionId=Use regex pattern to parse fraction ID from filename
     306ImportHitsNonGelWizardUseRegexPatternReplicateId=Use regex pattern to parse replicate ID from filename
    305307ImportHitsWizardStep1FormLegend=Step 1. Add spots and mapping to plates
    306308ImportHitsWizardStep2FormLegend=Step 2. Register peaklist files
     
    836838SelectProject=Select project
    837839SelectProtocolFile=Select Protocol File
     840SelectReplicateIdEntryMode=Replicate ID input:
    838841SelectSpectrumFile=Select Spectrum File
    839842SelectVisibleColumns=Select Visible Columns
  • trunk/client/servlet/src/org/proteios/action/hit/ImportHitsNonGelWizardStep1a.java

    r4126 r4461  
    6464    String selectedLocalSampleId = getString(LocalSampleSelect.VPARAM);
    6565    String fractionIdEntryMode = getString(FractionIdEntryModeMenu.VPARAM);
    66     String regexPattern = getValidString(RegexField.VPARAM);
     66    String fractionIdRegexPattern = getValidString(RegexField.VPARAM);
     67    String replicateIdEntryMode = getString(ReplicateIdEntryModeMenu.VPARAM);
     68    String replicateIdRegexPattern = getValidString(ReplicateIdRegexField.VPARAM);
    6769    log.debug("localSampleIdEntryMode = \"" + localSampleIdEntryMode + "\"");
    6870    log.debug("enteredLocalSampleId = \"" + enteredLocalSampleId + "\"");
    6971    log.debug("selectedLocalSampleId = \"" + selectedLocalSampleId + "\"");
    7072    log.debug("fractionIdEntryMode = \"" + fractionIdEntryMode + "\"");
    71     log.debug("regexPattern = \"" + regexPattern + "\"");
     73    log.debug("fractionIdRegexPattern = \"" + fractionIdRegexPattern + "\"");
     74    log.debug("replicateIdEntryMode = \"" + replicateIdEntryMode + "\"");
     75    log.debug("replicateIdRegexPattern = \"" + replicateIdRegexPattern + "\"");
    7276  if (localSampleIdEntryMode.equals(LocalSampleIdEntryModeMenu.ENTER_EXPLICIT_LOCAL_SAMPLE_ID))
    7377  {
     
    9397    saveToSession(FractionIdEntryModeMenu.VPARAM);
    9498    saveToSession(RegexField.VPARAM);
     99    saveToSession(ReplicateIdEntryModeMenu.VPARAM);
     100    saveToSession(ReplicateIdRegexField.VPARAM);
    95101    saveToSession(ForwardField.VPARAM);
    96102    saveToSession(PluginIdField.VPARAM);
  • trunk/client/servlet/src/org/proteios/action/hit/ImportHitsNonGelWizardStep1b.java

    r4155 r4461  
    7474    List<Integer> fileIds = getValidIntegerList(ItemIdField.VPARAM);
    7575    String fractionIdEntryMode = getSessionAttribute(FractionIdEntryModeMenu.VPARAM);
    76     String regexPattern = getSessionAttribute(RegexField.VPARAM);
     76    String fractionIdRegexPattern = getSessionAttribute(RegexField.VPARAM);
     77    String replicateIdEntryMode = getSessionAttribute(ReplicateIdEntryModeMenu.VPARAM);
     78    String replicateIdRegexPattern = getSessionAttribute(ReplicateIdRegexField.VPARAM);
    7779    // Set default value of local sample id entry mode to explicit entry
    7880     log.debug("localSampleIdEntryMode from request = \"" + localSampleIdEntryMode + "\"");
     
    9395  }
    9496  log.debug("fractionIdEntryMode = \"" + fractionIdEntryMode + "\"");
    95     log.debug("regexPattern = \"" + regexPattern + "\"");
     97    log.debug("fractionIdRegexPattern = \"" + fractionIdRegexPattern + "\"");
     98    // Set default value of replicate id entry mode
     99    log.debug("replicateIdEntryMode from request = \"" + replicateIdEntryMode + "\"");
     100  if (replicateIdEntryMode == null)
     101  {
     102    replicateIdEntryMode = new String(ReplicateIdEntryModeMenu.GET_REPLICATE_ID_FROM_PEAKLIST_FILE_ANNOTATION);
     103  }
     104  log.debug("replicateIdEntryMode = \"" + replicateIdEntryMode + "\"");
     105    log.debug("replicateIdRegexPattern = \"" + replicateIdRegexPattern + "\"");
     106    //
    96107    log.debug("fileIds = " + fileIds);
    97108    if (fileIds == null || fileIds.size() == 0)
     
    126137        {
    127138            Job job = createJob(factory, plugin, file,
    128             localSampleIdEntryMode, fractionIdEntryMode,
    129             localSampleId, project, regexPattern);
     139            localSampleIdEntryMode, fractionIdEntryMode, replicateIdEntryMode,
     140            localSampleId, project, fractionIdRegexPattern, replicateIdRegexPattern);
    130141            //
    131142            dc.saveItem(job);
     
    173184   * @param localSampleIdEntryMode String Local sample id entry mode.
    174185   * @param fractionIdEntryMode String Fraction id entry mode.
     186   * @param replicateIdEntryMode String Replicate id entry mode.
    175187   * @param localSampleId String Local sample id.
    176188   * @param project Project The project.
    177    * @param regexPattern String Optional regular expression pattern to parse fraction id from name of peaklist file.
     189   * @param fractionIdRegexPattern String Optional regular expression pattern to parse fraction id from name of peaklist file.
     190   * @param replicateIdRegexPattern String Optional regular expression pattern to parse replicate id from name of peaklist file.
    178191   * @return job Job The created non gel-based import job.
    179192   */
    180193  private Job createJob(ItemFactory factory, PluginDefinition plugin,
    181194      File file,
    182       String localSampleIdEntryMode, String fractionIdEntryMode,
    183       String localSampleId, Project project, String regexPattern)
     195      String localSampleIdEntryMode, String fractionIdEntryMode, String replicateIdEntryMode,
     196      String localSampleId, Project project, String fractionIdRegexPattern, String replicateIdRegexPattern)
    184197  {
    185198      Job job = factory.createJob(plugin, null);
     
    205218      job.setParameterValue("fractionIdEntryMode", fractionIdEntryModeParam, fractionIdEntryMode);
    206219      //
    207       StringParameterType regexPatternParam = new StringParameterType();
    208       job.setParameterValue("regexPattern", regexPatternParam, regexPattern);
     220      StringParameterType fractionIdRegexPatternParam = new StringParameterType();
     221      job.setParameterValue("fractionIdRegexPattern", fractionIdRegexPatternParam, fractionIdRegexPattern);
     222      //
     223      StringParameterType replicateIdEntryModeParam = new StringParameterType();
     224      job.setParameterValue("replicateIdEntryMode", replicateIdEntryModeParam, replicateIdEntryMode);
     225      //
     226      StringParameterType replicateIdRegexPatternParam = new StringParameterType();
     227      job.setParameterValue("replicateIdRegexPattern", replicateIdRegexPatternParam, replicateIdRegexPattern);
    209228      //
    210229    return job;
  • trunk/client/servlet/src/org/proteios/gui/form/ImportHitsNonGelWizardStep1Form.java

    r4126 r4461  
    4848  public final Select<VString> fractionIdEntryModeMenu;
    4949  public final TextField<String> regexPatternF;
     50  public final Select<VString> replicateIdEntryModeMenu;
     51  public final TextField<String> regexPatternR;
    5052
    5153
     
    114116    // Optional regex pattern entry field
    115117    regexPatternF = new RegexField();
    116     regexPatternF.setLabel("ImportHitsNonGelWizardRegexPattern");
     118    regexPatternF.setLabel("ImportHitsNonGelWizardRegexPatternFractionId");
    117119    regexPatternF.setValue(".+\\_(.+)\\..+");
    118120    properties.add(regexPatternF);
     121    // Replicate id entry mode menu
     122    String replicateIdEntryModeDefault = new String(ReplicateIdEntryModeMenu.GET_REPLICATE_ID_FROM_PEAKLIST_FILE_ANNOTATION);
     123    replicateIdEntryModeMenu = new ReplicateIdEntryModeMenu(replicateIdEntryModeDefault);
     124    replicateIdEntryModeMenu.setLabel("SelectReplicateIdEntryMode");
     125    properties.add(replicateIdEntryModeMenu);
     126    // Optional regex pattern entry field
     127    regexPatternR = new ReplicateIdRegexField();
     128    regexPatternR.setLabel("ImportHitsNonGelWizardRegexPatternReplicateId");
     129    regexPatternR.setValue(".+\\_(.+)\\..+");
     130    properties.add(regexPatternR);
    119131    /*
    120132     * Hidden text fields with data
  • trunk/plugin/src/org/proteios/plugins/PeakListToHitNonGelPlugin.java

    r4416 r4461  
    8282  public static final String GET_FRACTION_ID_FROM_PEAKLIST_FILE_NAME = "getFractionIdFromPeaklistFileName";
    8383  public static final String NO_FRACTION_ID = "noFractionId";
     84  public static final String GET_REPLICATE_ID_FROM_PEAKLIST_FILE_ANNOTATION = "getReplicateIdFromPeaklistFileAnnotation";
     85  public static final String GET_REPLICATE_ID_FROM_PEAKLIST_FILE_NAME = "getReplicateIdFromPeaklistFileName";
    8486
    8587  @Override
     
    112114        .getValue("fractionIdEntryMode");
    113115    log.debug("fractionIdEntryMode = \"" + fractionIdEntryMode + "\"");
    114     String regexPattern = (String) job.getValue("regexPattern");
    115     log.debug("regexPattern = \"" + regexPattern + "\"");
     116    String fractionIdRegexPattern = (String) job.getValue("fractionIdRegexPattern");
     117    log.debug("fractionIdRegexPattern = \"" + fractionIdRegexPattern + "\"");
     118    String replicateIdEntryMode = (String) job
     119        .getValue("replicateIdEntryMode");
     120    log.debug("replicateIdEntryMode = \"" + replicateIdEntryMode + "\"");
     121    String replicateIdRegexPattern = (String) job.getValue("replicateIdRegexPattern");
     122    log.debug("replicateIdRegexPattern = \"" + replicateIdRegexPattern + "\"");
    116123    //
    117124    FilenameParseUtil fpu = new FilenameParseUtil();
     
    171178    // }
    172179    if (ft != null && (fts.contains(ft))) {
    173       // Retrieve replicate ID
    174       String replicate = fetchReplicateIdFromFileAnnotation(dc, f);
    175180      // Attempt to obtain fraction ID from file annotation "fraction".
    176181      String fractionIdFromAnnotation = fetchFractionIdFromFileAnnotation(
     
    178183      // Use regex pattern to parse fraction ID from filename
    179184      String fractionIdFromFilename = null;
    180       if (regexPattern != null && !regexPattern.equals("")) {
     185      if (fractionIdRegexPattern != null && !fractionIdRegexPattern.equals("")) {
    181186        // Use regex pattern to parse fraction ID from filename
    182187        fractionIdFromFilename = fpu.fetchRegexResult(f.getName(),
    183             regexPattern);
     188            fractionIdRegexPattern);
    184189      }
    185190      log.debug("fraction id from file annotation = \""
     
    235240        return;
    236241      }
     242      // Attempt to obtain replicate ID from file annotation "replicate".
     243      String replicateIdFromAnnotation = fetchReplicateIdFromFileAnnotation(
     244          dc, f);
     245      // Use regex pattern to parse replicate ID from filename
     246      String replicateIdFromFilename = null;
     247      if (replicateIdRegexPattern != null && !replicateIdRegexPattern.equals("")) {
     248        // Use regex pattern to parse replicate ID from filename
     249        replicateIdFromFilename = fpu.fetchRegexResult(f.getName(),
     250            replicateIdRegexPattern);
     251      }
     252      log.debug("replicate id from file annotation = \""
     253          + replicateIdFromAnnotation + "\"");
     254      log.debug("replicate id from file name = \""
     255          + replicateIdFromFilename + "\"");
     256      // Get replicate id, if any
     257      String replicate = new String("");
     258      if (replicateIdEntryMode
     259          .equals(GET_REPLICATE_ID_FROM_PEAKLIST_FILE_ANNOTATION)) {
     260        if (replicateIdFromAnnotation != null) {
     261          replicate = replicateIdFromAnnotation;
     262        }
     263      } else if (replicateIdEntryMode
     264          .equals(GET_REPLICATE_ID_FROM_PEAKLIST_FILE_NAME)) {
     265        if (replicateIdFromFilename != null) {
     266          replicate = replicateIdFromFilename;
     267        }
     268      }
     269      log.info("peak list, replicate id: \"" + replicate
     270          + "\" localsample Id: \"" + localSampleId + "\"");
     271      // Check that length of replicate ID is not too long
     272      if (replicate != null
     273          && replicate.length() > Hit.MAX_REPLICATE_ID_LENGTH) {
     274        log.debug("Replicate ID = \"" + replicate + "\" is too long ("
     275            + replicate.length() + " characters, "
     276            + Hit.MAX_REPLICATE_ID_LENGTH + " allowed).");
     277        err.add(new BaseException("Replicate ID = \"" + replicate
     278            + "\" is too long (" + replicate.length()
     279            + " characters, " + Hit.MAX_REPLICATE_ID_LENGTH
     280            + " allowed)."));
     281        response.setError("Nothing imported", err);
     282        return;
     283      }
    237284      // Check if peaklist file already registered for local sample id
    238285      boolean peaklistFileAlreadyRegistered = false;
     
    306353   * @param File file The file to get the annotation for.
    307354   *
    308    * @return String The found fraction id, or null if none found.
     355   * @return String The found replicate id, or null if none found.
    309356   */
    310357  private String fetchReplicateIdFromFileAnnotation(DbControl dc, File file) {
Note: See TracChangeset for help on using the changeset viewer.