コード例 #1
0
ファイル: Modification.java プロジェクト: nilshoffmann/jmztab
  /**
   * Find modification type by name with case-insensitive.
   *
   * @param name SHOULD not be empty.
   * @return If not find, return null value.
   */
  public static Type findType(String name) {
    if (MZTabUtils.isEmpty(name)) {
      throw new IllegalArgumentException("Modification type name should not be empty!");
    }

    Type type;
    try {
      type = Type.valueOf(name.trim().toUpperCase());
    } catch (IllegalArgumentException e) {
      type = null;
    }

    return type;
  }
コード例 #2
0
ファイル: Modification.java プロジェクト: nilshoffmann/jmztab
  /**
   * Create a modification in columns of the protein, peptide, small molecule and PSM sections. The
   * structure like: {Type:accession}
   *
   * <p>NOTICE: {position} is mandatory. However, if it is not known (e.g. MS1 Peptide Mass
   * Fingerprinting), "null" must be used. Thus, in construct method we not provide position
   * parameter. User can define this by using {@link #addPosition(Integer, CVParam)} method.
   *
   * @param section SHOULD be {@link Section#Protein}, {@link Section#Peptide}, {@link Section#PSM}
   *     or {@link Section#Small_Molecule}
   * @param type SHOULD NOT be null.
   * @param accession SHOULD not be empty.
   */
  public Modification(Section section, Type type, String accession) {
    if (!section.isData()) {
      throw new IllegalArgumentException(
          "Section should use Protein, Peptide, PSM or SmallMolecule.");
    }
    this.section = section;

    if (type == null) {
      throw new NullPointerException("Modification type should not be null!");
    }
    this.type = type;

    if (MZTabUtils.isEmpty(accession)) {
      throw new IllegalArgumentException("Modification accession can not empty!");
    }
    this.accession = accession;
  }