Esempio n. 1
0
  public void addSearchEngineScoreOptionalColumn(MZTabColumn column, Integer id, MsRun msRun) {
    String position = column.getLogicPosition();
    if (optionalColumnMapping.containsKey(position)) {
      throw new IllegalArgumentException(
          "There exists column "
              + optionalColumnMapping.get(position)
              + " in position "
              + position);
    }

    MZTabColumn newColumn = null;

    switch (section) {
      case Protein_Header:
        if (column.getName().equals(ProteinColumn.SEARCH_ENGINE_SCORE.getName())) {
          newColumn = MZTabColumn.createOptionalColumn(section, column, id, msRun);
        }
        break;
      case Peptide_Header:
        if (column.getName().equals(PeptideColumn.SEARCH_ENGINE_SCORE.getName())) {
          newColumn = MZTabColumn.createOptionalColumn(section, column, id, msRun);
        }
        break;
      case Small_Molecule_Header:
        if (column.getName().equals(SmallMoleculeColumn.SEARCH_ENGINE_SCORE.getName())) {
          newColumn = MZTabColumn.createOptionalColumn(section, column, id, msRun);
        }
        break;
      case PSM_Header:
        if (column.getName().equals(PSMColumn.SEARCH_ENGINE_SCORE.getName())) {
          newColumn = MZTabColumn.createOptionalColumn(section, column, id, null);
        }
        break;
    }

    if (newColumn != null) {
      optionalColumnMapping.put(newColumn.getLogicPosition(), newColumn);
      columnMapping.put(newColumn.getLogicPosition(), newColumn);
    }
  }
Esempio n. 2
0
  /**
   * Judge the column is optional or not, based one its header name.
   *
   * @param header SHOULD NOT be null!
   */
  public boolean isOptionalColumn(String header) {
    header = header.trim().toLowerCase();

    switch (section) {
      case Protein_Header:
        if (header.startsWith(ProteinColumn.SEARCH_ENGINE_SCORE.getName())
            || header.startsWith(ProteinColumn.NUM_PSMS.getName())
            || header.startsWith(ProteinColumn.NUM_PEPTIDES_DISTINCT.getName())
            || header.startsWith(ProteinColumn.NUM_PEPTIDES_UNIQUE.getName())
            || header.startsWith("protein_abundance_assay")
            || header.startsWith("protein_abundance_study_variable")
            || header.startsWith("protein_abundance_stdev_study_variable")
            || header.startsWith("protein_abundance_std_error_study_variable")) {
          return true;
        }
        break;
      case Peptide_Header:
        if (header.startsWith(PeptideColumn.SEARCH_ENGINE_SCORE.getName())
            || header.startsWith("peptide_abundance_assay")
            || header.startsWith("peptide_abundance_study_variable")
            || header.startsWith("peptide_abundance_stdev_study_variable")
            || header.startsWith("peptide_abundance_std_error_study_variable")) {
          return true;
        }
        break;
      case Small_Molecule_Header:
        if (header.startsWith(SmallMoleculeColumn.SEARCH_ENGINE_SCORE.getName())
            || header.startsWith("smallmolecule_abundance_assay")
            || header.startsWith("smallmolecule_abundance_study_variable")
            || header.startsWith("smallmolecule_abundance_stdev_study_variable")
            || header.startsWith("smallmolecule_abundance_std_error_study_variable")) {
          return true;
        }
        break;
    }

    return header.startsWith("opt_");
  }