예제 #1
0
  public void addBestSearchEngineScoreOptionalColumn(MZTabColumn column, Integer id) {
    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.BEST_SEARCH_ENGINE_SCORE.getName())) {
          newColumn = MZTabColumn.createOptionalColumn(section, column, id, null);
        }
        break;
      case Peptide_Header:
        if (column.getName().equals(PeptideColumn.BEST_SEARCH_ENGINE_SCORE.getName())) {
          newColumn = MZTabColumn.createOptionalColumn(section, column, id, null);
        }
        break;
      case Small_Molecule_Header:
        if (column.getName().equals(SmallMoleculeColumn.BEST_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);
    }
  }
예제 #2
0
  /**
   * Add a optional column which has stable order and name, into {@link #optionalColumnMapping} and
   * {@link #columnMapping}.
   *
   * @see MZTabColumn#createOptionalColumn(Section, MZTabColumn, Integer, IndexedElement)
   * @exception IllegalArgumentException: If user would like to add duplicate optional columns.
   * @param column SHOULD NOT set null.
   * @param msRun SHOULD NOT set null.
   */
  public void addOptionalColumn(MZTabColumn column, 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.NUM_PSMS.getName()) ||
    //                        column.getName().equals(ProteinColumn.NUM_PEPTIDES_DISTINCT.getName())
    // ||
    //                        column.getName().equals(ProteinColumn.NUM_PEPTIDES_UNIQUE.getName()))
    // {
    //                    newColumn = MZTabColumn.createOptionalColumn(section, column, msRun);
    //                }
    //
    //                if (position.equals(ProteinColumn.SEARCH_ENGINE_SCORE.getOrder()) ||
    //                    position.equals(ProteinColumn.NUM_PSMS.getOrder()) ||
    //                    position.equals(ProteinColumn.NUM_PEPTIDES_DISTINCT.getOrder()) ||
    //                    position.equals(ProteinColumn.NUM_PEPTIDES_UNIQUE.getOrder())) {
    //                    newColumn = MZTabColumn.createOptionalColumn(section, column, msRun);
    //                }
    //                break;
    //            case Peptide_Header:
    //                if (position.equals(PeptideColumn.SEARCH_ENGINE_SCORE.getOrder())) {
    //                    newColumn = MZTabColumn.createOptionalColumn(section, column, msRun);
    //                }
    //                break;
    //            case Small_Molecule_Header:
    //                if (position.equals(SmallMoleculeColumn.SEARCH_ENGINE_SCORE.getOrder())) {
    //                    newColumn = MZTabColumn.createOptionalColumn(section, column, msRun);
    //                }
    //                break;
    //        }

    if (section == Section.Protein_Header) {
      if (column.getName().equals(ProteinColumn.NUM_PSMS.getName())
          || column.getName().equals(ProteinColumn.NUM_PEPTIDES_DISTINCT.getName())
          || column.getName().equals(ProteinColumn.NUM_PEPTIDES_UNIQUE.getName())) {
        newColumn = MZTabColumn.createOptionalColumn(section, column, null, msRun);
      }
    }

    if (newColumn != null) {
      optionalColumnMapping.put(newColumn.getLogicPosition(), newColumn);
      columnMapping.put(newColumn.getLogicPosition(), newColumn);
    }
  }