예제 #1
0
        /// <summary>
        /// Generates a theoretical spectra based on a modification list and positions for those modifications
        /// </summary>
        /// <param name="positions">int array has modifications at indice in which they occur in the sequence</param>
        /// <param name="myMods">dynamic modification list</param>
        /// <returns>Dictionary of theoretical ions organized by charge</returns>
        public Dictionary <int, ChargeStateIons> GetTempSpectra(int[] positions, List <DynamicModification> myMods)
        {
            Dictionary <int, ChargeStateIons> tempFragIons = new Dictionary <int, ChargeStateIons>();

            for (int i = 1; i < chargeState; ++i)
            {
                tempFragIons[i] = ChargeStateIons.GenerateFragmentIon(i, MassType.Monoisotopic,
                                                                      myMods, positions,
                                                                      bIonsMonoisotopicMass, yIonsMonoisotopicMass, fht.Length);
            }
            return(tempFragIons);
        }
예제 #2
0
        /// <summary>
        /// Creates a new fragment ion based on the given parameters.
        /// </summary>
        /// <param name="chargeState">Desired charge state for the fragment ion.
        /// Must be greater than 0.</param>
        /// <param name="massType">Mass type.</param>
        /// <param name="minPhosphoSite">The smallest from the list of available
        /// phophoSites for this peptide.</param>
        /// <param name="maxPhosphoSite">The biggest from the list of available
        /// phophoSites for this peptide.</param>
        /// <param name="bIons">The bIons to use corresponding to the mass type.</param>
        /// <param name="yIons">The yIons to use corresponding to the mass type.</param>
        /// <param name="peptideLength">The length of the trimmed peptide without
        /// phosphorylation sites.</param>
        /// <returns>A newly constructed FragmentIon upon success, null if any
        /// errors occured during construction.</returns>
        public static ChargeStateIons GenerateFragmentIon(int chargeState,
                                                          MassType massType, List <Mod.DynamicModification> dynamMods, int[] positions,
                                                          List <double> bIons, List <double> yIons, int peptideLength)
        {
            ChargeStateIons fragIon = null;

            MolecularWeights.MassType = massType;
            double sumofModsB = 0.0;
            double sumofModsY = 0.0;


            // If the charge state is one, create the
            if (chargeState == 1)
            {
                fragIon = new ChargeStateIons();

                // Set the charge state of the frag ion
                fragIon.chargeState = chargeState;

                // There is a phosphorylation site
                if (dynamMods.Count > 0)
                {
                    // bIons
                    for (int i = 0; i < bIons.Count; ++i)
                    {
                        foreach (Mod.DynamicModification mod in dynamMods)
                        {
                            if (mod.UniqueID == positions[i])
                            {
                                sumofModsB += mod.MassMonoisotopic;
                            }
                            if (mod.UniqueID == positions[peptideLength - 1 - i])
                            {
                                sumofModsY += mod.MassMonoisotopic;
                            }
                        }
                        fragIon.bIonsOut.Add(bIons[i] + sumofModsB);
                        fragIon.yIonsOut.Add(yIons[i] + sumofModsY);
                    }
                }
            }
            else if (chargeState > 1)
            {
                sumofModsB = (chargeState - 1) * MolecularWeights.Hydrogen;;
                sumofModsY = sumofModsB;
                fragIon    = new ChargeStateIons();

                // Set the charge state of the frag ion
                fragIon.chargeState = chargeState;

                // The value to add to each ion
                double temp = (chargeState - 1) * MolecularWeights.Hydrogen;

                // There is a phosphorylation site
                if (dynamMods.Count > 0)
                {
                    for (int i = 0; i < bIons.Count; ++i)
                    {
                        foreach (Mod.DynamicModification mod in dynamMods)
                        {
                            if (mod.UniqueID == positions[i])
                            {
                                sumofModsB += mod.MassMonoisotopic;
                            }
                            if (mod.UniqueID == positions[peptideLength - 1 - i])
                            {
                                sumofModsY += mod.MassMonoisotopic;
                            }
                        }
                        fragIon.bIonsOut.Add((bIons[i] + sumofModsB) / chargeState);
                        fragIon.yIonsOut.Add((yIons[i] + sumofModsY) / chargeState);
                    }
                }
            }
            return(fragIon);
        }