DIMS::PeakCollection.pm object needs to be refactored so that once it has been binned, we still retain info about the individual peaks. This can then be used to output info about the peaks that make up a bin. The following pseudo code would help:
$binned_peak_collection = $peak_collection->bin_peaks;
foreach my $bin ( @{$binned_peak_collection->bins} ) {
foreach my $peak ( @{$bin->peaks} ) {
print $peak->mass, "\t|, $peak->intensity, "\n";
}
}
This would require the following changes:
1) Add a DIMS::PeakCollection::Bin object which extends DIMS::PeakCollection with the following methods:
center()
returns the bin center
size()
returns the size of the bin
2) Allow DIMS::PeakCollection to hold DIMS::PeakCollection objects as well as DIMS::Peak objects.
This would allow a very flexible way to store and use Groups of peaks, but in the framework of binned peaks, would be best stored as:
DIMS::PeakCollection
|___ DIMS::PeakCollection::Bin
| |___ Peak 1
| |___ Peak 2
| |___ Peak 3
|
|___ DIMS::PeakCollection::Bin
| |___ Peak 1
|
etc