private static double GetUncalibratedFullIsotopePatternMassEstimate(IsotopeCluster ic, int isotopePatternStart,
                                                                            out double intensity, double[] centerMz,
                                                                            float[] intensities)
        {
            double result = 0;

            intensity = 0;
            int charge = ic.Charge;

            for (int i = 0; i < ic.Count; i++)
            {
                if (i + isotopePatternStart >= 0)
                {
                    int    ind = ic.Members[i];
                    double mz  = centerMz[ind];
                    double m   = (mz - MolUtil.MassProton) * charge;
                    result += intensities[ind] *
                              (m - MolUtil.GetAverageDifferenceToMonoisotope(m, i + isotopePatternStart));
                    intensity += intensities[ind];
                }
            }
            if (intensity == 0)
            {
                for (int i = 0; i < ic.Count; i++)
                {
                    int    ind = ic.Members[i];
                    double mz  = centerMz[ind];
                    double m   = (mz - MolUtil.MassProton) * charge;
                    result += intensities[ind] *
                              (m - (i + isotopePatternStart) * MolUtil.GetAverageDifferenceToMonoisotope(m, 1));
                    intensity += intensities[ind];
                }
            }
            return(result / intensity);
        }
        public static double[] CalcSilacClusterProfile(SilacCluster cl, out int minIndex, SilacType type,
                                                       IsotopeCluster[] isotopeClusters, IPeakList peakList,
                                                       float[] intensities)
        {
            int[] m = cl.GetIsotopeClusterIndices(type);
            int   n = m.Length;

            if (n == 1)
            {
                return(T03SilacAssembly.CalcIsotopeClusterProfile(isotopeClusters[m[0]], out minIndex, peakList));
            }
            double[][] profiles = new double[n][];
            int[]      mins     = new int[n];
            int[]      ends     = new int[n];
            double[]   intens   = new double[n];
            for (int i = 0; i < n; i++)
            {
                if (m[i] == -1)
                {
                    continue;
                }
                IsotopeCluster ic = isotopeClusters[m[i]];
                profiles[i] = T03SilacAssembly.CalcIsotopeClusterProfile(ic, out mins[i], peakList);
                intens[i]   = T03SilacAssembly.GetIsotopeClusterIntensity(ic, intensities);
                ends[i]     = mins[i] + profiles[i].Length;
            }
            minIndex = ArrayUtil.Min(mins);
            int maxEnd = ArrayUtil.Max(ends);
            int len    = maxEnd - minIndex;

            double[] result = new double[len];
            double   norm   = 0;

            for (int i = 0; i < n; i++)
            {
                if (m[i] == -1)
                {
                    continue;
                }
                norm += intens[i];
                for (int j = 0; j < profiles[i].Length; j++)
                {
                    result[j + mins[i] - minIndex] += profiles[i][j] * intens[i];
                }
            }
            for (int i = 0; i < len; i++)
            {
                result[i] /= norm;
            }
            return(result);
        }
        private static double GetFullIsotopePatternMassEstimateNoBootstrapStat(IsotopeCluster ic, int isotopePatternStart,
                                                                               out double intensity,
                                                                               double[,] mzCalibrationPar,
                                                                               double[,] intensityCalibrationPar, bool discard,
                                                                               out int npoints, IPeakList peakList,
                                                                               float[] intensities)
        {
            double result = 0;

            intensity = 0;
            npoints   = 0;
            int charge = ic.Charge;

            for (int i = 0; i < ic.Count; i++)
            {
                if (i + isotopePatternStart >= 0)
                {
                    int    ind = ic.Members[i];
                    int    np;
                    double mz = discard
                                                        ? peakList.GetMzDiscard(ind, mzCalibrationPar, intensityCalibrationPar, out np)
                                                        :
                                peakList.GetMz(ind, mzCalibrationPar, intensityCalibrationPar, out np);
                    double m = (mz - MolUtil.MassProton) * charge;
                    result += intensities[ind] *
                              (m - MolUtil.GetAverageDifferenceToMonoisotope(m, i + isotopePatternStart));
                    intensity += intensities[ind];
                    npoints   += np;
                }
            }
            if (intensity == 0)
            {
                for (int i = 0; i < ic.Count; i++)
                {
                    int    ind = ic.Members[i];
                    int    np;
                    double mz = discard
                                                        ? peakList.GetMzDiscard(ind, mzCalibrationPar, intensityCalibrationPar, out np)
                                                        : peakList.GetMz(ind, mzCalibrationPar, intensityCalibrationPar, out np);
                    double m = (mz - MolUtil.MassProton) * charge;
                    result += intensities[ind] *
                              (m - (i + isotopePatternStart) * MolUtil.GetAverageDifferenceToMonoisotope(m, 1));
                    intensity += intensities[ind];
                    npoints   += np;
                }
            }
            return(result / intensity);
        }
Ejemplo n.º 4
0
 public IsotopeMsmsEvidence(int isotopeId, int fileIndex, IsotopeCluster isotopeCluster,
                            double intensity, double calibRT, ReQuantitationResult reQuantitationResult,
                            SilacType type, bool reQuantify)
     : base(
         fileIndex, (isotopeCluster != null) ? (float)isotopeCluster.ElutionTime : float.NaN, (float)calibRT,
         (isotopeCluster != null) ? isotopeCluster.Charge : 0)
 {
     this.isotopeId = isotopeId;
     this.intensity = (float)intensity;
     if (reQuantify && reQuantitationResult.ContainsIsotopeIndex(isotopeId, type))
     {
         if (type == SilacType.Doublets)
         {
             ratio10              = (float)reQuantitationResult.GetDoubletRatio(isotopeId);
             normalizedRatio10    = (float)reQuantitationResult.GetDoubletNormalizedRatio(isotopeId);
             ratioSignificanceA10 = (float)Math.Log(reQuantitationResult.GetDoubletRatioSignificanceA(isotopeId));
             ratioSignificanceB10 = (float)Math.Log(reQuantitationResult.GetDoubletRatioSignificanceB(isotopeId));
             double[] ii = reQuantitationResult.GetDoubletIntensities(isotopeId);
             intensity0 = (float)ii[0];
             intensity1 = (float)ii[1];
         }
         if (type == SilacType.Triplets)
         {
             double[] r = reQuantitationResult.GetTripletRatio(isotopeId);
             ratio10 = (float)r[0];
             ratio20 = (float)r[1];
             ratio21 = (float)r[2];
             double[] rn = reQuantitationResult.GetTripletNormalizedRatio(isotopeId);
             normalizedRatio10 = (float)rn[0];
             normalizedRatio20 = (float)rn[1];
             normalizedRatio21 = (float)rn[2];
             double[] rsa = reQuantitationResult.GetTripletRatioSignificanceA(isotopeId);
             ratioSignificanceA10 = (float)Math.Log(rsa[0]);
             ratioSignificanceA20 = (float)Math.Log(rsa[1]);
             ratioSignificanceA21 = (float)Math.Log(rsa[2]);
             double[] rsb = reQuantitationResult.GetTripletRatioSignificanceB(isotopeId);
             ratioSignificanceB10 = (float)Math.Log(rsb[0]);
             ratioSignificanceB20 = (float)Math.Log(rsb[1]);
             ratioSignificanceB21 = (float)Math.Log(rsb[2]);
             double[] ii = reQuantitationResult.GetTripletIntensities(isotopeId);
             intensity0 = (float)ii[0];
             intensity1 = (float)ii[1];
             intensity2 = (float)ii[2];
         }
     }
 }
Ejemplo n.º 5
0
 public static void GetPrecursorInfo(out int charge, out double mz, out double mass, IPeakList peakList, int scanNumber,
                                     SilacType type, double isotopeCorrelationThreshold, double simpleMz)
 {
     charge = 0;
     mass   = 0;
     int[] silacInfo = peakList.GetSilacInfoForMsmsScanNumber(scanNumber);
     if (silacInfo != null)
     {
         int silacId    = silacInfo[0];
         int silacIndex = silacInfo[1];
         charge = peakList.GetSilacCharge(silacId);
         mass   = peakList.GetSilacMass(silacId, silacIndex, type);
         mz     = mass / charge + MolUtil.MassProton;
     }
     else
     {
         int            isotopeIndex = peakList.GetIsotopeIndexForMsmsScanNumber(scanNumber);
         IsotopeCluster ic           = null;
         if (isotopeIndex != -1)
         {
             ic = peakList.GetIsotopeCluster(isotopeIndex);
         }
         if (isotopeIndex != -1 && ic.IsotopeCorrelation >= isotopeCorrelationThreshold)
         {
             charge = ic.Charge;
             mass   = peakList.GetMassEstimate(new int[] { isotopeIndex },
                                               new int[] { ic.IsotopePatternStart }, new double[] { 0 }, false);
             mz = mass / charge + MolUtil.MassProton;
         }
         else
         {
             int peakIndex = peakList.GetPeakIndexForMsmsScanNumber(scanNumber);
             mz = peakIndex >= 0 ? peakList.GetMz(peakIndex) : simpleMz;
         }
     }
 }
Ejemplo n.º 6
0
        private static void ProcessMsm(string[] lines, string title, string origMass,
                                       HashSet <int> scanNumbers, StreamWriter[] silacWriters,
                                       TextWriter isoWriter, TextWriter peakWriter, TextWriter polyWriter,
                                       IPeakList peakList, double isotopeCorrelationThreshold, SilacType type,
                                       ref int silacCount, ref int isoCount, ref int peakCount, ref int polyCount)
        {
            int scanNumber = ExtractScanNumber(title);

            if (scanNumbers.Contains(scanNumber))
            {
                return;
            }
            int[] silacInfo = peakList.GetSilacInfoForMsmsScanNumber(scanNumber);
            if (silacInfo != null)
            {
                scanNumbers.Add(scanNumber);
                int    silacId    = silacInfo[0];
                int    silacIndex = silacInfo[1];
                int    ch         = peakList.GetSilacCharge(silacId);
                double mass       = peakList.GetSilacMass(silacId, silacIndex, type);
                double mz         = mass / ch + MolUtil.MassProton;
                silacWriters[silacIndex].WriteLine("BEGIN IONS");
                silacWriters[silacIndex].WriteLine("PEPMASS=" + mz);
                silacWriters[silacIndex].WriteLine("CHARGE=" + ch + "+");
                silacWriters[silacIndex].WriteLine(title + " _sil_");
                for (int i = 0; i < lines.Length; i++)
                {
                    silacWriters[silacIndex].WriteLine(lines[i]);
                }
                silacWriters[silacIndex].WriteLine("END IONS");
                silacWriters[silacIndex].WriteLine();
                silacCount++;
                return;
            }
            int            isotopeIndex = peakList.GetIsotopeIndexForMsmsScanNumber(scanNumber);
            IsotopeCluster ic           = null;

            if (isotopeIndex != -1)
            {
                ic = peakList.GetIsotopeCluster(isotopeIndex);
            }
            if (isotopeIndex != -1 && ic.IsotopeCorrelation >= isotopeCorrelationThreshold && ic.PolymerIndex == -1)
            {
                scanNumbers.Add(scanNumber);
                int    ch   = ic.Charge;
                double mass = peakList.GetMassEstimate(new int[] { isotopeIndex },
                                                       new int[] { ic.IsotopePatternStart }, new double[] { 0 }, false);
                double mz = mass / ch + MolUtil.MassProton;
                isoWriter.WriteLine("BEGIN IONS");
                isoWriter.WriteLine("PEPMASS=" + mz);
                isoWriter.WriteLine("CHARGE=" + ch + "+");
                isoWriter.WriteLine(title + " _iso_");
                for (int i = 0; i < lines.Length; i++)
                {
                    isoWriter.WriteLine(lines[i]);
                }
                isoWriter.WriteLine("END IONS");
                isoWriter.WriteLine();
                isoCount++;
                return;
            }
            if (isotopeIndex != -1 && ic.PolymerIndex != -1)
            {
                scanNumbers.Add(scanNumber);
                int    ch   = ic.Charge;
                double mass = peakList.GetMassEstimate(new int[] { isotopeIndex },
                                                       new int[] { ic.IsotopePatternStart }, new double[] { 0 }, false);
                double mz = mass / ch + MolUtil.MassProton;
                polyWriter.WriteLine("BEGIN IONS");
                polyWriter.WriteLine("PEPMASS=" + mz);
                polyWriter.WriteLine("CHARGE=" + ch + "+");
                polyWriter.WriteLine(title + " _iso_");
                for (int i = 0; i < lines.Length; i++)
                {
                    polyWriter.WriteLine(lines[i]);
                }
                polyWriter.WriteLine("END IONS");
                polyWriter.WriteLine();
                polyCount++;
                return;
            }
            scanNumbers.Add(scanNumber);
            peakWriter.WriteLine("BEGIN IONS");
            peakWriter.WriteLine(origMass);
            peakWriter.WriteLine("CHARGE=2+ and 3+");
            peakWriter.WriteLine(title + " _nix_");
            for (int i = 0; i < lines.Length; i++)
            {
                peakWriter.WriteLine(lines[i]);
            }
            peakWriter.WriteLine("END IONS");
            peakWriter.WriteLine();
            peakCount++;
        }
Ejemplo n.º 7
0
        public static double ReQuantifyDoublets(string sequence, int silacState, double[] deltaMass1,
                                                IsotopeCluster c, int icInd, IPeakList peakList, IRawFile rawFile,
                                                out double[] outIntens, out int[] counts, SpectrumCache spectrumCache,
                                                SilacLabel[] labels1, int maxSilacAa, bool subtractBackground,
                                                int backgroundSubtractionQuantile)
        {
            AminoAcid[]       allAas             = CalcAllAas(labels1);
            char[]            allAaLetts         = AminoAcid.GetSingleLetters(allAas);
            LabelCombinations labelCombinations1 = new LabelCombinations(labels1, maxSilacAa, allAaLetts);

            AminoAcid[] a = new AminoAcid[labels1.Length];
            counts = new int[a.Length];
            double delta = 0;

            for (int j = 0; j < a.Length; j++)
            {
                a[j]      = AminoAcid.GetAminoAcidFromLabel(labels1[j]);
                counts[j] = GetAaCount(a[j].Letter, sequence);
                delta    += deltaMass1[j] * counts[j];
            }
            if (AllZero(counts))
            {
                counts    = null;
                outIntens = null;
                return(double.NaN);
            }
            if (silacState == 1)
            {
                delta *= -1;
            }
            int[] members = c.Members;
            int   charge  = c.Charge;

            double[]  masses      = new double[members.Length];
            float[][] intens      = new float[members.Length][];
            int[][]   scanIndices = new int[members.Length][];
            for (int i = 0; i < members.Length; i++)
            {
                masses[i] = charge * (peakList.GetMz(members[i]) - MolUtil.MassProton) + delta;
                Peak peak = peakList.GetPeakDiscard(members[i]);
                scanIndices[i] = peak.GetScanIndices();
                intens[i]      = IntegrateTranslatedPeak(peak, delta / charge, spectrumCache, rawFile,
                                                         subtractBackground, backgroundSubtractionQuantile);
                List <int> valids = new List <int>();
                for (int j = 0; j < intens[i].Length; j++)
                {
                    if (intens[i][j] > 0)
                    {
                        valids.Add(j);
                    }
                }
                int[] val = valids.ToArray();
                intens[i]      = ArrayUtil.SubArray(intens[i], val);
                scanIndices[i] = ArrayUtil.SubArray(scanIndices[i], val);
            }
            List <int> valids1 = new List <int>();

            for (int i = 0; i < members.Length; i++)
            {
                if (intens[i].Length > 0)
                {
                    valids1.Add(i);
                }
            }
            int[] val1 = valids1.ToArray();
            masses      = ArrayUtil.SubArray(masses, val1);
            intens      = ArrayUtil.SubArray(intens, val1);
            scanIndices = ArrayUtil.SubArray(scanIndices, val1);
            Molecule diff2 = labelCombinations1.CalcDiff1(counts);
            Molecule diff1 = labelCombinations1.CalcDiff2(counts);

            double[][] d1;
            double[][] d2;
            outIntens = new double[2];
            if (silacState == 0)
            {
                d1           = diff1.GetIsotopeDistribution(0.2);
                d2           = diff2.GetIsotopeDistribution(0.2);
                outIntens[0] = peakList.GetIsotopeClusterIntensity(icInd);
                outIntens[1] = GetClusterIntensity(intens);
            }
            else
            {
                d2           = diff1.GetIsotopeDistribution(0.2);
                d1           = diff2.GetIsotopeDistribution(0.2);
                outIntens[1] = peakList.GetIsotopeClusterIntensity(icInd);
                outIntens[0] = GetClusterIntensity(intens);
            }
            Dictionary <int, double>[] w = peakList.Vectorize(c, d1, masses, intens, scanIndices, d2);
            double r = T03SilacAssembly.FitRatio(w[0], w[1]);

            if (silacState == 1)
            {
                r = 1.0 / r;
            }
            return(r);
        }
Ejemplo n.º 8
0
        public static double[] ReQuantifyTriplets(string sequence, int silacState, double[] deltaMass1,
                                                  double[] deltaMass2, IsotopeCluster c, int icInd, IPeakList peakList,
                                                  IRawFile rawFile, out double[] outIntens, out int[] counts,
                                                  SpectrumCache spectrumCache, SilacLabel[] labels1, SilacLabel[] labels2,
                                                  int maxSilacAa, bool subtractBackground, int backgroundSubtractionQuantile)
        {
            AminoAcid[] allAas     = CalcAllAas(labels1, labels2);
            char[]      allAaLetts = AminoAcid.GetSingleLetters(allAas);
            counts = new int[allAaLetts.Length];
            for (int j = 0; j < allAaLetts.Length; j++)
            {
                counts[j] = GetAaCount(allAaLetts[j], sequence);
            }
            if (AllZero(counts))
            {
                counts    = null;
                outIntens = null;
                return(null);
            }
            double deltaLow = 0;

            for (int j = 0; j < labels1.Length; j++)
            {
                int cc = GetAaCount(AminoAcid.GetAminoAcidFromLabel(labels1[j]).Letter, sequence);
                deltaLow += deltaMass1[j] * cc;
            }
            double deltaHigh = 0;

            for (int j = 0; j < labels2.Length; j++)
            {
                int cc = GetAaCount(AminoAcid.GetAminoAcidFromLabel(labels2[j]).Letter, sequence);
                deltaHigh += deltaMass2[j] * cc;
            }
            double delta1;
            double delta2;

            CalcDeltasForTriplets(silacState, deltaLow, deltaHigh, out delta1, out delta2);
            int[] members = c.Members;
            int   charge  = c.Charge;

            double[]  masses1      = new double[members.Length];
            float[][] intens1      = new float[members.Length][];
            int[][]   scanIndices1 = new int[members.Length][];
            double[]  masses2      = new double[members.Length];
            float[][] intens2      = new float[members.Length][];
            int[][]   scanIndices2 = new int[members.Length][];
            for (int i = 0; i < members.Length; i++)
            {
                double m = charge * (peakList.GetMz(members[i]) - MolUtil.MassProton);
                masses1[i] = m + delta1;
                masses2[i] = m + delta2;
                Peak peak = peakList.GetPeakDiscard(members[i]);
                scanIndices1[i] = peak.GetScanIndices();
                scanIndices2[i] = peak.GetScanIndices();
                intens1[i]      = IntegrateTranslatedPeak(peak, delta1 / charge, spectrumCache, rawFile,
                                                          subtractBackground, backgroundSubtractionQuantile);
                intens2[i] = IntegrateTranslatedPeak(peak, delta2 / charge, spectrumCache, rawFile,
                                                     subtractBackground, backgroundSubtractionQuantile);
                List <int> valids = new List <int>();
                for (int j = 0; j < intens1[i].Length; j++)
                {
                    if (intens1[i][j] > 0)
                    {
                        valids.Add(j);
                    }
                }
                int[] val = valids.ToArray();
                intens1[i]      = ArrayUtil.SubArray(intens1[i], val);
                scanIndices1[i] = ArrayUtil.SubArray(scanIndices1[i], val);
                valids          = new List <int>();
                for (int j = 0; j < intens2[i].Length; j++)
                {
                    if (intens2[i][j] > 0)
                    {
                        valids.Add(j);
                    }
                }
                val             = valids.ToArray();
                intens2[i]      = ArrayUtil.SubArray(intens2[i], val);
                scanIndices2[i] = ArrayUtil.SubArray(scanIndices2[i], val);
            }
            List <int> valids1 = new List <int>();

            for (int i = 0; i < members.Length; i++)
            {
                if (intens1[i].Length > 0)
                {
                    valids1.Add(i);
                }
            }
            int[] val1 = valids1.ToArray();
            masses1      = ArrayUtil.SubArray(masses1, val1);
            intens1      = ArrayUtil.SubArray(intens1, val1);
            scanIndices1 = ArrayUtil.SubArray(scanIndices1, val1);
            List <int> valids2 = new List <int>();

            for (int i = 0; i < members.Length; i++)
            {
                if (intens2[i].Length > 0)
                {
                    valids2.Add(i);
                }
            }
            int[] val2 = valids2.ToArray();
            masses2      = ArrayUtil.SubArray(masses2, val2);
            intens2      = ArrayUtil.SubArray(intens2, val2);
            scanIndices2 = ArrayUtil.SubArray(scanIndices2, val2);
            LabelCombinations labelCombinations01 = new LabelCombinations(labels1, maxSilacAa, allAaLetts);
            LabelCombinations labelCombinations02 = new LabelCombinations(labels2, maxSilacAa, allAaLetts);
            Molecule          x1    = labelCombinations01.CalcDiff1(counts);
            Molecule          x2    = labelCombinations01.CalcDiff2(counts);
            Molecule          y1    = labelCombinations02.CalcDiff1(counts);
            Molecule          y2    = labelCombinations02.CalcDiff2(counts);
            Molecule          max1  = Molecule.Max(x1, y1);
            Molecule          x11   = Molecule.GetDifferences(max1, x1)[0];
            Molecule          y11   = Molecule.GetDifferences(max1, y1)[0];
            Molecule          diff1 = max1;
            Molecule          diff2 = Molecule.Sum(x2, x11);
            Molecule          diff3 = Molecule.Sum(y2, y11);
            Molecule          max   = Molecule.Max(Molecule.Max(diff1, diff2), diff3);

            diff1 = Molecule.GetDifferences(max, diff1)[0];
            diff2 = Molecule.GetDifferences(max, diff2)[0];
            diff3 = Molecule.GetDifferences(max, diff3)[0];
            double[][] d1 = diff1.GetIsotopeDistribution(0.2);
            double[][] d2 = diff2.GetIsotopeDistribution(0.2);
            double[][] d3 = diff3.GetIsotopeDistribution(0.2);
            double     ratio10;
            double     ratio20;
            double     ratio21;

            outIntens = new double[3];
            switch (silacState)
            {
            case 0: {
                Dictionary <int, double>[] w10 = peakList.Vectorize(c, d1, masses1, intens1, scanIndices1, d2);
                ratio10 = T03SilacAssembly.FitRatio(w10[0], w10[1]);
                Dictionary <int, double>[] w20 = peakList.Vectorize(c, d1, masses2, intens2, scanIndices2, d3);
                ratio20 = T03SilacAssembly.FitRatio(w20[0], w20[1]);
                Dictionary <int, double>[] w21 =
                    peakList.Vectorize(masses1, intens1, scanIndices1, d2, masses2, intens2, scanIndices2, d3, c.Charge);
                ratio21      = T03SilacAssembly.FitRatio(w21[0], w21[1]);
                outIntens[0] = peakList.GetIsotopeClusterIntensity(icInd);
                outIntens[1] = GetClusterIntensity(intens1);
                outIntens[2] = GetClusterIntensity(intens2);
                break;
            }

            case 1: {
                Dictionary <int, double>[] w01 = peakList.Vectorize(c, d2, masses1, intens1, scanIndices1, d1);
                ratio10 = 1.0 / T03SilacAssembly.FitRatio(w01[0], w01[1]);
                Dictionary <int, double>[] w20 =
                    peakList.Vectorize(masses1, intens1, scanIndices1, d1, masses2, intens2, scanIndices2, d3, c.Charge);
                ratio20 = T03SilacAssembly.FitRatio(w20[0], w20[1]);
                Dictionary <int, double>[] w21 = peakList.Vectorize(c, d2, masses2, intens2, scanIndices2, d3);
                ratio21      = T03SilacAssembly.FitRatio(w21[0], w21[1]);
                outIntens[1] = peakList.GetIsotopeClusterIntensity(icInd);
                outIntens[0] = GetClusterIntensity(intens1);
                outIntens[2] = GetClusterIntensity(intens2);
                break;
            }

            case 2: {
                Dictionary <int, double>[] w10 =
                    peakList.Vectorize(masses1, intens1, scanIndices1, d1, masses2, intens2, scanIndices2, d2, c.Charge);
                ratio10 = T03SilacAssembly.FitRatio(w10[0], w10[1]);
                Dictionary <int, double>[] w02 = peakList.Vectorize(c, d3, masses1, intens1, scanIndices1, d1);
                ratio20 = 1.0 / T03SilacAssembly.FitRatio(w02[0], w02[1]);
                Dictionary <int, double>[] w12 = peakList.Vectorize(c, d3, masses2, intens2, scanIndices2, d2);
                ratio21      = 1.0 / T03SilacAssembly.FitRatio(w12[0], w12[1]);
                outIntens[2] = peakList.GetIsotopeClusterIntensity(icInd);
                outIntens[0] = GetClusterIntensity(intens1);
                outIntens[1] = GetClusterIntensity(intens2);
                break;
            }

            default:
                throw new Exception("Impossible.");
            }
            return(new double[] { ratio10, ratio20, ratio21 });
        }