示例#1
0
        /// <summary>
        /// joins the spectra formed by the isotopes of n elements
        /// </summary>
        /// <param name="ItPeaks">(double[elements,kmax]) spectra of the elements</param>
        /// <returns>(double[]) sum spectrum of the n elements</returns>
        private static mzI[] joinIsot(double[,] ItPeaks, double thPrecMass)
        {
            int bound  = ItPeaks.GetUpperBound(1);
            int bound2 = ItPeaks.GetUpperBound(0);

            // massShift was: mass shift from each peak to the next peak
            // currently, as most experiments analysed by QuiXoT are 18O,
            // it is set to deltaR/2, where deltaR is the difference between
            // 16O and 16O

            double massShift = 2.00424578 / 2;

            mzI[] sum   = new mzI[bound + 1];
            mzI[] jIsot = new mzI[bound + 1];

            //Initialize the matrix sum with the first value of the matrix ItPeaks
            for (int i = 0; i <= bound; i++)
            {
                sum[i].I  = ItPeaks[0, i];
                sum[i].mz = thPrecMass + i * massShift;
            }

            //Join the spectra in the matrix sum

            if (ItPeaks.GetUpperBound(0) > 1)
            {
                for (int numSpectra = 1; numSpectra <= bound2; numSpectra++)
                {
                    for (int i = 0; i <= bound; i++)
                    {
                        for (int j = 0; j <= bound; j++)
                        {
                            if ((i + j) <= bound)
                            {
                                jIsot[i + j].I += sum[i].I * ItPeaks[numSpectra, j];
                                jIsot[i + j].mz = thPrecMass + (i * massShift + j);
                            }
                        }
                    }
                    jIsot.CopyTo(sum, 0);
                    if (numSpectra < bound2)
                    {
                        jIsot = null;
                        jIsot = new mzI[bound + 1];
                    }
                }
            }


            return(jIsot);
        }
示例#2
0
        /// <summary>
        /// joins the spectra formed by the isotopes of n elements
        /// </summary>
        /// <param name="ItPeaks">(double[elements,kmax]) spectra of the elements</param>
        /// <returns>(double[]) sum spectrum of the n elements</returns>
        private static mzI[] joinIsot(double[,] ItPeaks, double thPrecMass)
        {
            int    bound     = ItPeaks.GetUpperBound(1);
            int    bound2    = ItPeaks.GetUpperBound(0);
            double massShift = 1.003;

            mzI[] sum   = new mzI[bound + 1];
            mzI[] jIsot = new mzI[bound + 1];

            //Initialize the matrix sum with the first value of the matrix ItPeaks
            for (int i = 0; i <= bound; i++)
            {
                sum[i].I  = ItPeaks[0, i];
                sum[i].mz = thPrecMass + i * massShift;
            }

            //Join the spectra in the matrix sum

            if (ItPeaks.GetUpperBound(0) > 1)
            {
                for (int numSpectra = 1; numSpectra <= bound2; numSpectra++)
                {
                    for (int i = 0; i <= bound; i++)
                    {
                        for (int j = 0; j <= bound; j++)
                        {
                            if ((i + j) <= bound)
                            {
                                jIsot[i + j].I += sum[i].I * ItPeaks[numSpectra, j];
                                jIsot[i + j].mz = thPrecMass + (i * massShift + j);
                            }
                        }
                    }
                    jIsot.CopyTo(sum, 0);
                    if (numSpectra < bound2)
                    {
                        jIsot = null;
                        jIsot = new mzI[bound + 1];
                    }
                }
            }


            return(jIsot);
        }