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
public abstract class Ion extends ExperimentObject
This class models an ion.
- Author:
- Marc Vaudel
- See Also:
- Serialized Form
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Ion.IonType
An enumerator of the supported ion types. -
Field Summary
Fields Modifier and Type Field Description protected AtomChain
atomChain
The atomic composition of the ion.protected Double
theoreticMass
Deprecated.use the double value instead.protected double
theoreticMass1
The theoretic mass.protected Ion.IonType
type
Type of ion. -
Constructor Summary
Constructors Constructor Description Ion()
Empty default constructor -
Method Summary
Modifier and Type Method Description AtomChain
getAtomicComposition()
Returns the atomic composition.static Ion
getGenericIon(Ion.IonType ionType, int subType)
Convenience method returning a generic ion based on the given ion type without neutral losses.static Ion
getGenericIon(Ion.IonType ionType, int subType, NeutralLoss[] neutralLosses)
Convenience method returning a generic ion based on the given ion type.static ArrayList<Ion.IonType>
getImplementedIonTypes()
Returns the implemented ion types.abstract String
getName()
Returns the name of the ion.abstract NeutralLoss[]
getNeutralLosses()
Returns the possible neutral losses of this ion type.String
getNeutralLossesAsString()
Returns the neutral loss (if any), the empty string if no loss.static String
getNeutralLossesAsString(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.static HashSet<Integer>
getPossibleSubtypesAsSet(Ion.IonType ionType)
Returns a hashset of possible subtypes.abstract CvTerm
getPrideCvTerm()
Returns the CV term adapted to the fragment ion.abstract CvTerm
getPsiMsCvTerm()
Returns the CV term adapted to the fragment ion.abstract int
getSubType()
Returns the ion subtype.abstract String
getSubTypeAsString()
Returns the subtype as string.double
getTheoreticMass()
Returns the theoretic mass, from the atomic composition if available, from the theoreticMass field otherwise.double
getTheoreticMz(Integer charge)
Returns the m/z expected for this ion at the given charge.Ion.IonType
getType()
Returns the ion type.String
getTypeAsString()
Returns the type of ion as string.static String
getTypeAsString(Ion.IonType type)
Returns the type of ion as string.boolean
hasNeutralLosses()
Indicates whether the ion has a neutral loss.abstract boolean
isSameAs(Ion anotherIon)
Returns a boolean indicating whether the ion is the same as another ion.void
setAtomicComposition(AtomChain atomChain)
Returns the atomic composition.void
setTheoreticMass(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. -
theoreticMass
Deprecated.use the double value instead.The theoretic mass. -
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
-