public abstract class Spectrum<A extends PeakAnnotation> extends Object implements PeakList<A>
PeakList.Precision| Modifier | Constructor and Description |
|---|---|
|
Spectrum(int initialCapacity,
double constantIntensity,
PeakList.Precision precision)
Construct a Spectrum that has a constant intensity.
|
|
Spectrum(int initialCapacity,
PeakList.Precision precision)
Construct a Spectrum that has an initial capacity of
initialCapacity and a precision
of precision |
protected |
Spectrum(Spectrum<A> src,
PeakProcessor<A,A> peakProcessor)
Copy constructor
|
protected |
Spectrum(Spectrum<A> src,
PeakProcessorChain<A> peakProcessorChain)
Copy constructor
|
| Modifier and Type | Method and Description |
|---|---|
int |
add(double mz,
double intensity)
Add a mz, intensity pair to the peak list
|
int |
add(double mz,
double intensity,
A annotation)
Add a mz, intensity pair and associateed annotations to the peak list
|
int |
add(double mz,
double intensity,
Collection<? extends A> annotations)
Add a mz, intensity pair and associated annotations to the peak list
|
void |
addAnnotation(int index,
A annotation)
Add an annotation to the peak at index
|
void |
addAnnotations(int index,
Collection<A> annotations)
Set the annotations for the peak at index
|
void |
addPeaks(PeakList<A> peakList)
Add peaks and annotations in
peakList to this peak list. |
<T extends PeakAnnotation> |
addPeaks(PeakList<T> peakList,
com.google.common.base.Function<List<T>,List<A>> annotationConverter)
Add peaks (mz, intensity pairs) and optional annotations in
peakList to this peak list |
<T extends PeakAnnotation> |
addPeaksNoAnnotations(PeakList<T> peakList)
Add peaks (without annotations) in
peakList to this peak list. |
void |
addSorted(double[] mzs,
double[] intensities)
Add the pairs of mz and intensities to this peak list.
|
void |
addSorted(double[] mzs,
double[] intensities,
int length)
Add the pairs of mz and intensities to this peak list.
|
void |
apply(PeakProcessor<A,A> peakProcessor)
Apply the peakProcessor to the peaks in this PeakList
|
void |
apply(PeakProcessorChain<A> peakProcessorChain)
Apply the peakProcessorChain to the peaks in this PeakList
|
double |
calcVectorLength()
Calculates the vector length of this peak list
|
void |
clear()
Clears the peak list, the size is set to 0 and objects used to store peaks are unreferenced to allow
garbage collection
|
void |
clearAnnotations()
Remove all annotations from this PeakList
|
void |
clearAnnotationsAt(int index)
Remove all annotations for the peak at index
|
PeakCursor<A> |
cursor()
Returns a cursor over the peaks in this peak list in proper sequence.
|
void |
ensureCapacity(int minCapacity)
Increases the capacity of this DoublePeakList instance, if
necessary, to ensure that it can hold at least the number of peaks
specified by the minimum capacity argument.
|
boolean |
equals(Object o) |
int[] |
getAnnotationIndexes()
Returns an array containing the sorted indexes of the peaks that are annotated.
|
List<A> |
getAnnotations(int index)
Returns an unmodifiable list containing the annotations for the peak at index
|
double |
getBasePeakIntensity()
Get the intensity of the most intense peak
|
double |
getBasePeakMz()
Get the m/z of the most intense peak
|
int |
getClosestIndex(double mz)
Returns the index of the peak that is closest to the supplied mz.
|
com.google.common.base.Optional<A> |
getFirstAnnotation(int index)
Return the first annotation in the list of annotations for the peak at index.
|
UUID |
getId() |
double[] |
getIntensities(double[] dest)
Copies an the intensities from this peak list, beginning at 0,
to the destination array.
|
double[] |
getIntensities(double[] dest,
int destPos)
Copies an the intensities from this peak list, beginning at 0,
to the specified position of the destination array.
|
double[] |
getIntensities(int srcPos,
double[] dest,
int destPos,
int length)
Copies an the intensities from this peak list, beginning at the specified position,
to the specified position of the destination array.
|
double |
getIntensity(int index)
Returns the intensity of the peak at index
|
int |
getMostIntenseIndex()
Returns the index of the most intense peak in the peak list or -1 if there are no peaks in this peak list.
|
int |
getMostIntenseIndex(double minMz,
double maxMz)
Returns te index of the peak that is most intense in the specified region.
|
int |
getMsLevel()
Returns the ms level that this peak list was measured at
|
double |
getMz(int index)
Returns the mz of the peak at index
|
double[] |
getMzs(double[] dest)
Copies an the mzs from this peak list, beginning at 0,
to the destination array.
|
double[] |
getMzs(double[] dest,
int destPos)
Copies an the mzs from this peak list, beginning at 0,
to the specified position of the destination array.
|
double[] |
getMzs(int srcPos,
double[] dest,
int destPos,
int length)
Copies an the mzs from this peak list, beginning at the specified position,
to the specified position of the destination array.
|
PeakList.Precision |
getPrecision()
Return the precision that this PeakList uses to store the peak and intensity values
|
Peak |
getPrecursor()
Returns the precursor peak of this peak list
|
double |
getTotalIonCurrent()
Returns the sum of all intensities
|
boolean |
hasAnnotations()
Returns true if the spectrum has annotations
|
boolean |
hasAnnotationsAt(int index)
Returns true if the spectrum has annotations at peak index
|
int |
hashCode() |
int |
indexOf(double mzKey)
Returns the index of the first occurrence of the specified mzKey
in this peak list, or (-(insertion point) - 1) if this
peak list does not contain the exact mzKey.
|
int |
indexOf(int fromIndex,
int toIndex,
double mzKey)
Returns the index of the first occurrence of the specified mzKey
in the specified range within this peak list, or (-(insertion point) - 1)
if this peak list does not contain the exact mzKey.
|
boolean |
isEmpty()
Returns true if this peak list contains no peaks.
|
boolean |
removeAnnotation(A annotation,
int index)
Remove the annotation from the peak at index
|
void |
setId(UUID id) |
void |
setIntensityAt(double intensity,
int index)
Replace the intensity at index with intensity
|
void |
setMsLevel(int msLevel)
Set the ms level that this peak list was measured at
|
void |
setPrecursor(Peak precursor)
Set the precursor peak for this peak list
|
int |
size()
Returns the number of peaks in this peak list.
|
void |
sortAnnotations(Comparator<A> comparator)
Sort the annotations for each annotated peak using the
comparator |
void |
trimToSize()
Trims the capacity of this DoublePeakList instance to be the
list's current size.
|
protected Spectrum(Spectrum<A> src, PeakProcessor<A,A> peakProcessor)
src - the Spectrum to copypeakProcessor - the processor to process the peaksprotected Spectrum(Spectrum<A> src, PeakProcessorChain<A> peakProcessorChain)
src - the Spectrum to copypeakProcessorChain - the processor chain to process the peakspublic Spectrum(int initialCapacity,
PeakList.Precision precision)
initialCapacity and a precision
of precisioninitialCapacity - the initial capacityprecision - the precisionpublic Spectrum(int initialCapacity,
double constantIntensity,
PeakList.Precision precision)
initialCapacityinitialCapacity - the initial capacity of the peak listconstantIntensity - the constant intensity ifprecision - the precision that the peak list is stored atpublic UUID getId()
getId in interface PeakList<A extends PeakAnnotation>public void setId(UUID id)
setId in interface PeakList<A extends PeakAnnotation>public void addPeaks(PeakList<A> peakList)
PeakListpeakList to this peak list.addPeaks in interface PeakList<A extends PeakAnnotation>peakList - containing peaks and annotations which are to be added to this peak listpublic <T extends PeakAnnotation> void addPeaksNoAnnotations(PeakList<T> peakList)
PeakListpeakList to this peak list.addPeaksNoAnnotations in interface PeakList<A extends PeakAnnotation>peakList - containing peaks which are to be added to this peak listpublic <T extends PeakAnnotation> void addPeaks(PeakList<T> peakList, com.google.common.base.Function<List<T>,List<A>> annotationConverter)
PeakListpeakList to this peak listaddPeaks in interface PeakList<A extends PeakAnnotation>peakList - containing peaks which are to be added to this peak listannotationConverter - convert annotation T to A (annotation will not be added if
Optional is absent)public void addSorted(double[] mzs,
double[] intensities)
PeakListaddSorted in interface PeakList<A extends PeakAnnotation>mzs - the mz valuesintensities - the intensitiespublic void addSorted(double[] mzs,
double[] intensities,
int length)
PeakListaddSorted in interface PeakList<A extends PeakAnnotation>mzs - the mz valuesintensities - the intensitieslength - the number of pairs to addpublic int add(double mz,
double intensity)
PeakListadd in interface PeakList<A extends PeakAnnotation>mz - the mz to addintensity - the intensity to addpublic int add(double mz,
double intensity,
A annotation)
PeakListadd in interface PeakList<A extends PeakAnnotation>mz - the mz to addintensity - the intensity to addannotation - the peaks annotationpublic int add(double mz,
double intensity,
Collection<? extends A> annotations)
PeakListadd in interface PeakList<A extends PeakAnnotation>mz - the mz to addintensity - the intensity to addannotations - the peaks annotationspublic int size()
PeakListsize in interface PeakList<A extends PeakAnnotation>public boolean isEmpty()
PeakListisEmpty in interface PeakList<A extends PeakAnnotation>public double getMz(int index)
PeakListgetMz in interface PeakList<A extends PeakAnnotation>index - the indexpublic double getIntensity(int index)
PeakListgetIntensity in interface PeakList<A extends PeakAnnotation>index - the indexpublic void clear()
PeakListclear in interface PeakList<A extends PeakAnnotation>public double getTotalIonCurrent()
PeakListgetTotalIonCurrent in interface PeakList<A extends PeakAnnotation>public int getClosestIndex(double mz)
PeakListgetClosestIndex in interface PeakList<A extends PeakAnnotation>mz - the mzpublic int indexOf(double mzKey)
PeakListindexOf in interface PeakList<A extends PeakAnnotation>mzKey - the search keypublic int indexOf(int fromIndex,
int toIndex,
double mzKey)
PeakListindexOf in interface PeakList<A extends PeakAnnotation>fromIndex - the index of the first peak (inclusive) to be
searchedtoIndex - the index of the last peak (exclusive) to be searchedmzKey - the search keypublic int getMostIntenseIndex(double minMz,
double maxMz)
PeakListgetMostIntenseIndex in interface PeakList<A extends PeakAnnotation>minMz - the minMzmaxMz - the maxMzpublic int getMostIntenseIndex()
PeakListgetMostIntenseIndex in interface PeakList<A extends PeakAnnotation>public double getBasePeakMz()
PeakListgetBasePeakMz in interface PeakList<A extends PeakAnnotation>public double getBasePeakIntensity()
PeakListgetBasePeakIntensity in interface PeakList<A extends PeakAnnotation>public double[] getMzs(double[] dest)
PeakListdest is null, then a
new array with the correct length is created.
Otherwise, if any of the following is true, an
IndexOutOfBoundsException is
thrown and the destination is not modified:
size() is greater than
dest.length, the length of the destination array.
getMzs in interface PeakList<A extends PeakAnnotation>dest - the destination array.public double[] getMzs(double[] dest,
int destPos)
PeakListdestPos through destPos+length-1,
respectively, of the destination array.
If dest is null, then a
new array with the correct length is created.
Otherwise, if any of the following is true, an
IndexOutOfBoundsException is
thrown and the destination is not modified:
destPos argument is negative.
destPos+size() is greater than
dest.length, the length of the destination array.
getMzs in interface PeakList<A extends PeakAnnotation>dest - the destination array.destPos - starting position in the destination data.public double[] getMzs(int srcPos,
double[] dest,
int destPos,
int length)
PeakListdest. The number of mzs copied is
equal to the length argument. The mzs at
positions srcPos through
srcPos+length-1 in this peak list are copied into
positions destPos through
destPos+length-1, respectively, of the destination
array.
If dest is null, then a
new array with the correct length is created.
Otherwise, if any of the following is true, an
IndexOutOfBoundsException is
thrown and the destination is not modified:
srcPos argument is negative.
destPos argument is negative.
length argument is negative.
srcPos+length is greater than
size(), the size of this.
destPos+length is greater than
dest.length, the length of the destination array.
getMzs in interface PeakList<A extends PeakAnnotation>srcPos - starting position in the mz.dest - the destination array.destPos - starting position in the destination data.length - the number of array elements to be copied.public double[] getIntensities(double[] dest)
PeakListdest is null, then a
new array with the correct length is created.
Otherwise, if any of the following is true, an
IndexOutOfBoundsException is
thrown and the destination is not modified:
size() is greater than
dest.length, the length of the destination array.
getIntensities in interface PeakList<A extends PeakAnnotation>dest - the destination array.public double[] getIntensities(double[] dest,
int destPos)
PeakListdestPos through destPos+length-1,
respectively, of the destination array.
If dest is null, then a
new array with the correct length is created.
Otherwise, if any of the following is true, an
IndexOutOfBoundsException is
thrown and the destination is not modified:
destPos argument is negative.
destPos+size() is greater than
dest.length, the length of the destination array.
getIntensities in interface PeakList<A extends PeakAnnotation>dest - the destination array.destPos - starting position in the destination data.public double[] getIntensities(int srcPos,
double[] dest,
int destPos,
int length)
PeakListdest. The number of intensities copied is
equal to the length argument. The intensities at
positions srcPos through
srcPos+length-1 in this peak list are copied into
positions destPos through
destPos+length-1, respectively, of the destination
array.
If dest is null, then a
new array with the correct length is created.
Otherwise, if any of the following is true, an
IndexOutOfBoundsException is
thrown and the destination is not modified:
srcPos argument is negative.
destPos argument is negative.
length argument is negative.
srcPos+length is greater than
size(), the size of this.
destPos+length is greater than
dest.length, the length of the destination array.
getIntensities in interface PeakList<A extends PeakAnnotation>srcPos - starting position in the mz.dest - the destination array.destPos - starting position in the destination data.length - the number of array elements to be copied.public PeakList.Precision getPrecision()
PeakListgetPrecision in interface PeakList<A extends PeakAnnotation>public void setIntensityAt(double intensity,
int index)
PeakListsetIntensityAt in interface PeakList<A extends PeakAnnotation>intensity - the new intensityindex - the index for which the intensity is to be setpublic void trimToSize()
PeakListtrimToSize in interface PeakList<A extends PeakAnnotation>public void ensureCapacity(int minCapacity)
PeakListensureCapacity in interface PeakList<A extends PeakAnnotation>minCapacity - the desired minimum capacitypublic void addAnnotation(int index,
A annotation)
PeakListaddAnnotation in interface PeakList<A extends PeakAnnotation>index - the index of the peakannotation - the annotation to addpublic void addAnnotations(int index,
Collection<A> annotations)
PeakListaddAnnotations in interface PeakList<A extends PeakAnnotation>index - the index of the peakannotations - the list of annotationspublic boolean removeAnnotation(A annotation, int index)
PeakListremoveAnnotation in interface PeakList<A extends PeakAnnotation>annotation - the annotation to removeindex - the index of the peakpublic void clearAnnotationsAt(int index)
PeakListclearAnnotationsAt in interface PeakList<A extends PeakAnnotation>index - the index of the peakpublic void clearAnnotations()
PeakListclearAnnotations in interface PeakList<A extends PeakAnnotation>public boolean hasAnnotations()
PeakListhasAnnotations in interface PeakList<A extends PeakAnnotation>public int[] getAnnotationIndexes()
PeakListgetAnnotationIndexes in interface PeakList<A extends PeakAnnotation>public boolean hasAnnotationsAt(int index)
PeakListhasAnnotationsAt in interface PeakList<A extends PeakAnnotation>index - the index of the peakpublic List<A> getAnnotations(int index)
PeakListgetAnnotations in interface PeakList<A extends PeakAnnotation>index - the index of the peakpublic com.google.common.base.Optional<A> getFirstAnnotation(int index)
PeakListgetFirstAnnotation in interface PeakList<A extends PeakAnnotation>index - the index of the peakpublic void sortAnnotations(Comparator<A> comparator)
PeakListcomparatorsortAnnotations in interface PeakList<A extends PeakAnnotation>comparator - the comparator that is to be used to sort the annotationspublic Peak getPrecursor()
PeakListgetPrecursor in interface PeakList<A extends PeakAnnotation>public void setPrecursor(Peak precursor)
PeakListsetPrecursor in interface PeakList<A extends PeakAnnotation>precursor - the precursor peakpublic int getMsLevel()
public void setMsLevel(int msLevel)
msLevel - the ms levelpublic PeakCursor<A> cursor()
PeakListcursor in interface PeakList<A extends PeakAnnotation>public double calcVectorLength()
PeakListcalcVectorLength in interface PeakList<A extends PeakAnnotation>public void apply(PeakProcessor<A,A> peakProcessor)
PeakListapply in interface PeakList<A extends PeakAnnotation>peakProcessor - the peak processorpublic void apply(PeakProcessorChain<A> peakProcessorChain)
PeakListapply in interface PeakList<A extends PeakAnnotation>peakProcessorChain - the peak processor listCopyright © 2016. All Rights Reserved.