Class Ion
java.lang.Object
com.compomics.util.experiment.personalization.ExperimentObject
com.compomics.util.experiment.biology.ions.Ion
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ElementaryIon,Glycan,ImmoniumIon,PeptideFragmentIon,PrecursorIon,RelatedIon,ReporterIon,TagFragmentIon
This class models an ion.
- Author:
- Marc Vaudel
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumAn enumerator of the supported ion types. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AtomChainThe atomic composition of the ion.protected doubleThe theoretic mass.protected Ion.IonTypeType of ion.Fields inherited from class com.compomics.util.experiment.personalization.ExperimentObject
NO_KEY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the atomic composition.static IongetGenericIon(Ion.IonType ionType, int subType) Convenience method returning a generic ion based on the given ion type without neutral losses.static IongetGenericIon(Ion.IonType ionType, int subType, NeutralLoss[] neutralLosses) Convenience method returning a generic ion based on the given ion type.static ArrayList<Ion.IonType> Returns the implemented ion types.abstract StringgetName()Returns the name of the ion.abstract NeutralLoss[]Returns the possible neutral losses of this ion type.Returns the neutral loss (if any), the empty string if no loss.static StringgetNeutralLossesAsString(NeutralLoss[] neutralLosses) Returns the neutral loss (if any), the empty string if no loss.static int[]getPossibleSubtypes(Ion.IonType ionType) Returns an array of possible subtypes.getPossibleSubtypesAsSet(Ion.IonType ionType) Returns a hashset of possible subtypes.abstract CvTermReturns the CV term adapted to the fragment ion.abstract CvTermReturns the CV term adapted to the fragment ion.abstract intReturns the ion subtype.abstract StringReturns the subtype as string.doubleReturns the theoretic mass, from the atomic composition if available, from the theoreticMass field otherwise.doublegetTheoreticMz(Integer charge) Returns the m/z expected for this ion at the given charge.getType()Returns the ion type.Returns the type of ion as string.static StringgetTypeAsString(Ion.IonType type) Returns the type of ion as string.booleanIndicates whether the ion has a neutral loss.abstract booleanReturns a boolean indicating whether the ion is the same as another ion.voidsetAtomicComposition(AtomChain atomChain) Returns the atomic composition.voidsetTheoreticMass(double theoreticMass) Sets a new theoretic mass.Methods inherited from class com.compomics.util.experiment.personalization.ExperimentObject
addUrParam, asLong, clearParametersMap, getId, getUrParam, getUrParams, removeUrParam, setId, setUrParams
-
Field Details
-
type
Type of ion. -
theoreticMass1
protected double theoreticMass1The theoretic mass. -
atomChain
The atomic composition of the ion.
-
-
Constructor Details
-
Ion
public Ion()Empty default constructor
-
-
Method Details
-
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
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
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
Returns the subtype as string.- Returns:
- the subtype as string
-
getPossibleSubtypes
Returns an array of possible subtypes.- Parameters:
ionType- an array of possible subtypes- Returns:
- an array of possible subtypes
-
getPossibleSubtypesAsSet
Returns a hashset of possible subtypes.- Parameters:
ionType- a hashset of possible subtypes- Returns:
- a hashset of possible subtypes
-
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
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
Returns the neutral loss (if any), the empty string if no loss.- Returns:
- the neutral loss
-
getNeutralLossesAsString
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
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
Returns the atomic composition.- Returns:
- the atomic composition
-
setAtomicComposition
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
Returns the ion type.- Returns:
- the ion type
-
getImplementedIonTypes
Returns the implemented ion types.- Returns:
- the implemented ion types
-
getTypeAsString
Returns the type of ion as string.- Returns:
- the type of ion as string
-
getTypeAsString
Returns the type of ion as string.- Parameters:
type- the type of ion as string- Returns:
- the type of ion as string
-
getGenericIon
Convenience method returning a generic ion based on the given ion type.- Parameters:
ionType- the ion typesubType- the ion subtypeneutralLosses- the neutral losses. Null list if none.- Returns:
- a generic ion
-
getGenericIon
Convenience method returning a generic ion based on the given ion type without neutral losses.- Parameters:
ionType- the ion typesubType- the ion subtype- Returns:
- a generic ion
-