11 public double[]
mz {
get; }
27 public Spectrum(
double[] Mz,
double[] Intensity,
int ScanNumber)
41 public int[]
getEncoding(
int massRange = 5000,
int massMultiplier = 100)
43 var encoding =
new List<int>();
45 for (
int i = 0; i <
mz.Length; i++)
47 if (
mz[i] < massRange)
49 encoding.Add((
int) Math.Round(
mz[i] * massMultiplier));
53 return encoding.Distinct().OrderBy(x => x).ToArray();
60 public static class MGFReader
67 public static List<Spectrum> readMGF(
string filename)
71 var spectra =
new List<Spectrum>();
73 foreach(var spectrum
in MSAMANDA_spectra)
75 var mz =
new List<double>();
76 var intensity =
new List<double>();
78 foreach (var peak
in spectrum.FragmentsPeaks)
80 mz.Add(peak.Position);
81 intensity.Add(peak.Intensity);
84 spectra.Add(
new Spectrum(mz.ToArray(), intensity.ToArray(), spectrum.ScanNumber));
Simplified spectrum class implemention of a mass spectrum.
double[] intensity
Array containing intensities of centroid peaks.
int scanNumber
The scan number of the spectrum.
int[] getEncoding(int massRange=5000, int massMultiplier=100)
Get the encoding vector of the spectrum.
Spectrum(double[] Mz, double[] Intensity, int ScanNumber)
Constructor to create a new spectrum.
double[] mz
Array containing m/z values of centroid peaks.