com.compomics.util.experiment.identification
Class SpectrumAnnotator

java.lang.Object
  extended by com.compomics.util.experiment.identification.SpectrumAnnotator

public class SpectrumAnnotator
extends Object

The spectrum annotator annotates peaks in a spectrum.

Author:
Marc Vaudel

Constructor Summary
SpectrumAnnotator()
          Constructor.
 
Method Summary
 boolean chargeValidated(Ion theoreticIon, int charge, int precursorCharge)
          Returns a boolean indicating whether the given charge can be found on the given fragment ion.
 ArrayList<IonMatch> getCurrentAnnotation(HashMap<Ion.IonType,ArrayList<Integer>> iontypes, NeutralLossesMap neutralLosses, ArrayList<Integer> charges)
          Returns the currently matched ions with the given settings.
 Peptide getCurrentlyLoadedPeptide()
          Returns the currently inspected peptide.
 String getCurrentlyLoadedSpectrumKey()
          Returns the spectrum currently inspected.
static NeutralLossesMap getDefaultLosses(Peptide peptide)
          Returns the possible neutral losses expected by default for a given peptide.
 HashMap<Integer,ArrayList<Ion>> getExpectedIons(HashMap<Ion.IonType,ArrayList<Integer>> iontypes, NeutralLossesMap neutralLosses, ArrayList<Integer> charges, int precursorCharge, Peptide peptide)
          Returns the expected ions in a map indexed by the possible charges.
 double getMassShift()
          Returns the m/z shift applied to the fragment ions.
static Vector<DefaultSpectrumAnnotation> getSpectrumAnnotation(ArrayList<IonMatch> ionMatches)
          Translates the list of ion matches into a vector of annotations which can be read by the SpectrumPanel.
 ArrayList<IonMatch> getSpectrumAnnotation(HashMap<Ion.IonType,ArrayList<Integer>> iontypes, NeutralLossesMap neutralLosses, ArrayList<Integer> charges, int precursorCharge, MSnSpectrum spectrum, Peptide peptide, double intensityLimit, double mzTolerance, boolean isPpm)
          Returns the spectrum annotations of a spectrum in a list of IonMatches.
 boolean isAccounted(NeutralLossesMap neutralLosses, NeutralLoss neutralLoss, Ion ion, Peptide peptide)
          Returns a boolean indicating whether the neutral loss should be accounted for.
 boolean lossesValidated(NeutralLossesMap neutralLosses, Ion theoreticIon, Peptide peptide)
          Returns a boolean indicating whether the neutral losses of the given fragment ion are fit the requirement of the given neutral losses map.
 ArrayList<IonMatch> matchPeak(Peptide peptide, HashMap<Ion.IonType,ArrayList<Integer>> iontypes, ArrayList<Integer> charges, int precursorCharge, NeutralLossesMap neutralLosses, Peak peak)
          This method matches the potential fragment ions of a given peptide with a given peak.
 void setMassShift(double massShift)
          Sets an m/z shift on all ions.
 void setPeptide(Peptide peptide, int precursorCharge)
          Sets a new peptide to match.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpectrumAnnotator

public SpectrumAnnotator()
Constructor.

Method Detail

matchPeak

public ArrayList<IonMatch> matchPeak(Peptide peptide,
                                     HashMap<Ion.IonType,ArrayList<Integer>> iontypes,
                                     ArrayList<Integer> charges,
                                     int precursorCharge,
                                     NeutralLossesMap neutralLosses,
                                     Peak peak)
This method matches the potential fragment ions of a given peptide with a given peak.

Parameters:
peptide - The peptide
iontypes - The fragment ions selected
charges - The charges of the fragment to search for
precursorCharge - The precursor charge as deduced by the search engine
neutralLosses - Map of expected neutral losses: neutral loss -> maximal position in the sequence (first aa is 1). let null if neutral losses should not be considered.
peak - The peak to match
Returns:
A list of potential ion matches

getSpectrumAnnotation

public static Vector<DefaultSpectrumAnnotation> getSpectrumAnnotation(ArrayList<IonMatch> ionMatches)
Translates the list of ion matches into a vector of annotations which can be read by the SpectrumPanel.

Parameters:
ionMatches - list of ion matches
Returns:
vector of default spectrum annotations

setPeptide

public void setPeptide(Peptide peptide,
                       int precursorCharge)
Sets a new peptide to match.

Parameters:
peptide - the new peptide
precursorCharge - the new precursor charge

getDefaultLosses

public static NeutralLossesMap getDefaultLosses(Peptide peptide)
                                         throws IOException,
                                                IllegalArgumentException,
                                                InterruptedException,
                                                FileNotFoundException,
                                                ClassNotFoundException
Returns the possible neutral losses expected by default for a given peptide. /!\ this method will work only if the ptm found in the peptide are in the PTMFactory.

Parameters:
peptide - the peptide of interest
Returns:
the expected possible neutral losses
Throws:
IOException
IllegalArgumentException
InterruptedException
FileNotFoundException
ClassNotFoundException

isAccounted

public boolean isAccounted(NeutralLossesMap neutralLosses,
                           NeutralLoss neutralLoss,
                           Ion ion,
                           Peptide peptide)
Returns a boolean indicating whether the neutral loss should be accounted for.

Parameters:
neutralLosses - Map of expected neutral losses
neutralLoss - the neutral loss of interest
ion - the fragment ion of interest
peptide - the peptide of interest
Returns:
boolean indicating whether the neutral loss should be considered

lossesValidated

public boolean lossesValidated(NeutralLossesMap neutralLosses,
                               Ion theoreticIon,
                               Peptide peptide)
Returns a boolean indicating whether the neutral losses of the given fragment ion are fit the requirement of the given neutral losses map.

Parameters:
neutralLosses - Map of expected neutral losses: neutral loss.
theoreticIon - the ion of interest
peptide - the inspected peptide
Returns:
a boolean indicating whether the neutral losses of the given fragment ion are fit the requirement of the given neutral losses map

chargeValidated

public boolean chargeValidated(Ion theoreticIon,
                               int charge,
                               int precursorCharge)
Returns a boolean indicating whether the given charge can be found on the given fragment ion.

Parameters:
theoreticIon - the ion of interest
charge - the candidate charge
precursorCharge - the precursor charge
Returns:
a boolean indicating whether the given charge can be found on the given fragment ion

getSpectrumAnnotation

public ArrayList<IonMatch> getSpectrumAnnotation(HashMap<Ion.IonType,ArrayList<Integer>> iontypes,
                                                 NeutralLossesMap neutralLosses,
                                                 ArrayList<Integer> charges,
                                                 int precursorCharge,
                                                 MSnSpectrum spectrum,
                                                 Peptide peptide,
                                                 double intensityLimit,
                                                 double mzTolerance,
                                                 boolean isPpm)
Returns the spectrum annotations of a spectrum in a list of IonMatches. Note that, except for +1 precursors, fragments ions will be expected to have a charge strictly smaller than the precursor ion charge.

Parameters:
iontypes - The expected ions to look for
neutralLosses - Map of expected neutral losses: neutral loss -> first position in the sequence (first aa is 1). let null if neutral losses should not be considered.
charges - List of expected charges
precursorCharge - the precursor charge
spectrum - The spectrum to match
peptide - The peptide of interest
intensityLimit - The intensity limit to use
mzTolerance - The m/z tolerance to use
isPpm - a boolean indicating whether the mass tolerance is in ppm or in Da
Returns:
an ArrayList of IonMatch containing the ion matches with the given settings

getExpectedIons

public HashMap<Integer,ArrayList<Ion>> getExpectedIons(HashMap<Ion.IonType,ArrayList<Integer>> iontypes,
                                                       NeutralLossesMap neutralLosses,
                                                       ArrayList<Integer> charges,
                                                       int precursorCharge,
                                                       Peptide peptide)
Returns the expected ions in a map indexed by the possible charges. Note that, except for +1 precursors, fragments ions will be expected to have a charge strictly smaller than the precursor ion charge.

Parameters:
iontypes - The expected ions to look for
neutralLosses - Map of expected neutral losses: neutral loss -> first position in the sequence (first aa is 1). let null if neutral losses should not be considered.
charges - List of expected charges
peptide - The peptide of interest
precursorCharge - The precursor charge
Returns:
an ArrayList of IonMatch containing the ion matches with the given settings

getCurrentAnnotation

public ArrayList<IonMatch> getCurrentAnnotation(HashMap<Ion.IonType,ArrayList<Integer>> iontypes,
                                                NeutralLossesMap neutralLosses,
                                                ArrayList<Integer> charges)
Returns the currently matched ions with the given settings.

Parameters:
iontypes - The expected fragment ions to look for
neutralLosses - Map of expected neutral losses: neutral loss -> first position in the sequence (first aa is 1). let null if neutral losses should not be considered.
charges - List of expected charges
Returns:
the currently matched ions with the given settings

getCurrentlyLoadedSpectrumKey

public String getCurrentlyLoadedSpectrumKey()
Returns the spectrum currently inspected.

Returns:
the spectrum currently inspected

getCurrentlyLoadedPeptide

public Peptide getCurrentlyLoadedPeptide()
Returns the currently inspected peptide.

Returns:
the currently inspected peptide

getMassShift

public double getMassShift()
Returns the m/z shift applied to the fragment ions.

Returns:
the m/z shift applied to the fragment ions

setMassShift

public void setMassShift(double massShift)
Sets an m/z shift on all ions. The previous mass shift will be removed.

Parameters:
massShift - the m/z shift to apply


Copyright © 2013. All Rights Reserved.