All Implemented Interfaces:
Serializable
Direct Known Subclasses:
ElementaryIon, Glycan, ImmoniumIon, PeptideFragmentIon, PrecursorIon, RelatedIon, ReporterIon, TagFragmentIon

public abstract class Ion
extends ExperimentObject
This class models an ion.
Author:
Marc Vaudel
See Also:
Serialized Form
  • Field Details

  • Constructor Details

    • Ion

      public Ion()
      Empty default constructor
  • Method Details

    • getName

      public abstract String getName()
      Returns the name of the ion. The name should be short enough to be displayed on a spectrum.
      Returns:
      the name of the ion
    • getPrideCvTerm

      public abstract CvTerm getPrideCvTerm()
      Returns the CV term adapted to the fragment ion. Null if none corresponding.
      Returns:
      the CV term adapted to the fragment ion. Null if none corresponding
    • getPsiMsCvTerm

      public abstract CvTerm getPsiMsCvTerm()
      Returns the CV term adapted to the fragment ion. Null if none corresponding.
      Returns:
      the CV term adapted to the fragment ion. Null if none corresponding
    • getSubType

      public abstract int getSubType()
      Returns the ion subtype.
      Returns:
      the ion subtype as integer
    • getSubTypeAsString

      public abstract String getSubTypeAsString()
      Returns the subtype as string.
      Returns:
      the subtype as string
    • getPossibleSubtypes

      public static int[] getPossibleSubtypes​(Ion.IonType ionType)
      Returns an array of possible subtypes.
      Parameters:
      ionType - an array of possible subtypes
      Returns:
      an array of possible subtypes
    • getPossibleSubtypesAsSet

      public static HashSet<Integer> getPossibleSubtypesAsSet​(Ion.IonType ionType)
      Returns a hashset of possible subtypes.
      Parameters:
      ionType - a hashset of possible subtypes
      Returns:
      a hashset of possible subtypes
    • getNeutralLosses

      public abstract NeutralLoss[] getNeutralLosses()
      Returns the possible neutral losses of this ion type. An empty list if none.
      Returns:
      the possible neutral losses of this ion type
    • hasNeutralLosses

      public boolean hasNeutralLosses()
      Indicates whether the ion has a neutral loss.
      Returns:
      a boolean indicating whether the ion has a neutral loss
    • isSameAs

      public abstract boolean isSameAs​(Ion anotherIon)
      Returns a boolean indicating whether the ion is the same as another ion.
      Parameters:
      anotherIon - the other ion
      Returns:
      a boolean indicating whether the ion is the same as another ion
    • getNeutralLossesAsString

      public String getNeutralLossesAsString()
      Returns the neutral loss (if any), the empty string if no loss.
      Returns:
      the neutral loss
    • getNeutralLossesAsString

      public static String getNeutralLossesAsString​(NeutralLoss[] neutralLosses)
      Returns the neutral loss (if any), the empty string if no loss.
      Parameters:
      neutralLosses - the neutral loss (if any)
      Returns:
      the neutral loss
    • getTheoreticMass

      public double getTheoreticMass()
      Returns the theoretic mass, from the atomic composition if available, from the theoreticMass field otherwise.
      Returns:
      the theoretic mass
    • getTheoreticMz

      public double getTheoreticMz​(Integer charge)
      Returns the m/z expected for this ion at the given charge.
      Parameters:
      charge - the charge of interest
      Returns:
      the m/z expected for this ion
    • getAtomicComposition

      public AtomChain getAtomicComposition()
      Returns the atomic composition.
      Returns:
      the atomic composition
    • setAtomicComposition

      public void setAtomicComposition​(AtomChain atomChain)
      Returns the atomic composition.
      Parameters:
      atomChain - the atomic composition
    • setTheoreticMass

      public void setTheoreticMass​(double theoreticMass)
      Sets a new theoretic mass.
      Parameters:
      theoreticMass - a new theoretic mass
    • getType

      public Ion.IonType getType()
      Returns the ion type.
      Returns:
      the ion type
    • getImplementedIonTypes

      public static ArrayList<Ion.IonType> getImplementedIonTypes()
      Returns the implemented ion types.
      Returns:
      the implemented ion types
    • getTypeAsString

      public String getTypeAsString()
      Returns the type of ion as string.
      Returns:
      the type of ion as string
    • getTypeAsString

      public static String getTypeAsString​(Ion.IonType type)
      Returns the type of ion as string.
      Parameters:
      type - the type of ion as string
      Returns:
      the type of ion as string
    • getGenericIon

      public static Ion getGenericIon​(Ion.IonType ionType, int subType, NeutralLoss[] neutralLosses)
      Convenience method returning a generic ion based on the given ion type.
      Parameters:
      ionType - the ion type
      subType - the ion subtype
      neutralLosses - the neutral losses. Null list if none.
      Returns:
      a generic ion
    • getGenericIon

      public static Ion getGenericIon​(Ion.IonType ionType, int subType)
      Convenience method returning a generic ion based on the given ion type without neutral losses.
      Parameters:
      ionType - the ion type
      subType - the ion subtype
      Returns:
      a generic ion