java.lang.Object
de.uni_halle.informatik.biodata.mp.db.bigg.BiGGId

public class BiGGId extends Object
Represents a BiGG identifier used to uniquely identify various biological entities such as reactions, metabolites, and genes within the BiGG database. This class provides methods to parse, validate, and manipulate BiGG IDs according to the standards specified in the BiGG database.

The BiGG ID typically consists of several parts: - A prefix indicating the type of entity (e.g., 'R' for reaction, 'M' for metabolite, 'G' for gene). - An abbreviation which is the main identifier part. - A compartment code that specifies the cellular location of the metabolite. - A tissue code that indicates the tissue specificity of the identifier, applicable in multicellular organisms.

This class also includes methods to create BiGG IDs from strings, validate them against known patterns, and extract specific parts like the compartment code. It supports handling special cases and correcting common formatting issues in BiGG IDs.

For a formal description of the structure of BiGG ids see the proposed BiGG ID specification.

  • Constructor Details

    • BiGGId

      public BiGGId()
    • BiGGId

      public BiGGId(String id)
    • BiGGId

      public BiGGId(String prefix, String abbreviation, String compartmentCode, String tissueCode)
  • Method Details

    • createMetaboliteId

      public static BiGGId createMetaboliteId(String id)
    • createGeneId

      public static BiGGId createGeneId(String id)
    • createReactionId

      public static BiGGId createReactionId(String id)
    • createReactionId

      public static BiGGId createReactionId(String id, boolean isPseudo)
      Creates a BiGG ID for a reaction based on the provided string identifier. The method can correct the ID to conform to BiGG standards and adjust the prefix based on whether it is a pseudo-reaction.
      Parameters:
      id - The raw reaction ID string.
      isPseudo - If true, the ID is treated as a pseudo-reaction, affecting the prefix handling.
      Returns:
      An Optional containing the BiGGId if the ID is non-empty, or an empty Optional if the ID is empty.
    • isValid

      public static boolean isValid(String queryId)
    • extractCompartmentCode

      public static Optional<String> extractCompartmentCode(String id)
      Extracts the compartment code from a given identifier if it matches the expected pattern. The expected pattern allows an optional prefix "C_" followed by one or two lowercase letters, optionally followed by a digit. If the identifier does not match this pattern, an empty Optional is returned. If the identifier starts with "C_", this prefix is removed before returning the compartment code.
      Parameters:
      id - The identifier from which to extract the compartment code.
      Returns:
      An Optional containing the compartment code if the identifier matches the pattern, otherwise an empty Optional.
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • getAbbreviation

      public String getAbbreviation()
    • setAbbreviation

      public void setAbbreviation(String abbreviation)
      • Only contain upper and lower case letters, numbers, and underscores
      • /[0-9a-zA-Z][a-zA-Z0-9_]+/, only ASCII and don't start with numbers
      • When converting old BIGG IDs to BIGG2 IDs, replace a dash with two underscores. For example, ala-L becomes ala__L.
      • Reactions should be all upper case. Metabolites should be primarily lower case, but upper case letters are allowed (ala__L is preferred to ALA__L).
      Parameters:
      abbreviation - the abbreviation to set
    • getCompartmentCode

      public String getCompartmentCode()
    • setCompartmentCode

      public void setCompartmentCode(String compartmentCode)
      One or two characters in length, and contain only lower case letters and numbers, and must begin with a lower case letter. /[a-z][a-z0-9]?/
      Parameters:
      compartmentCode - the compartmentCode to set
    • getPrefix

      public String getPrefix()
    • setPrefix

      public void setPrefix(String prefix)
      • R: reaction
      • M: metabolite /[RM]/
      • NOTE: Do we want to have the id entity use R and M, and just remove them when constructing the model, or have them just as [abbreviation]_[compartment code] and add the prefix when they are put into SBML models? Also SBML id's use capital letters (/[RM]/).
      Parameters:
      prefix - the prefix to set
    • getTissueCode

      public String getTissueCode()
    • setTissueCode

      public void setTissueCode(String tissueCode)
      One or two characters in length, and contain only upper case letters and numbers, and must begin with an upper case letter. /[A-Z][A-Z0-9]?/
      Parameters:
      tissueCode - the tissueCode to set
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • isSetAbbreviation

      public boolean isSetAbbreviation()
    • isSetCompartmentCode

      public boolean isSetCompartmentCode()
    • isSetPrefix

      public boolean isSetPrefix()
    • isSetTissueCode

      public boolean isSetTissueCode()
    • toBiGGId

      public String toBiGGId()
      Generates a BiGG ID for this object based on its properties. The BiGG ID is constructed by concatenating the available properties (prefix, abbreviation, compartment code, and tissue code) in that order, each separated by an underscore. Each property is included only if it is set (i.e., not null).
      Returns:
      A string representing the BiGG ID, constructed by concatenating the set properties with underscores. If none of the properties are set, returns an empty string.
    • toBiGGId

      public String toBiGGId(String prefix, String abbreviation, String compartmentCode, String tissueCode)
      Constructs a BiGG ID using the provided components. Each component is separated by an underscore. If a component is null or empty, it is omitted from the final ID.
      Parameters:
      prefix - The first part of the BiGG ID, typically representing the type of entity (e.g., 'R', 'M', 'G').
      abbreviation - The main identifier, usually an alphanumeric string that uniquely describes the entity.
      compartmentCode - A code indicating the compartmentalization, relevant for compartmentalized entities.
      tissueCode - A code representing the tissue specificity, applicable to certain biological models.
      Returns:
      A string representing the constructed BiGG ID, formed by concatenating the provided components with underscores.
    • toString

      public String toString()
      Overrides:
      toString in class Object