Morpheus.AminoAcidPolymer.InitializeProductArrays C# (CSharp) Метод

InitializeProductArrays() приватный Метод

private InitializeProductArrays ( ) : void
Результат void
        private void InitializeProductArrays()
        {
            double mass_shift;

            cumulativeNTerminalMass = new double[Length];

            mass_shift = 0.0;
            // fixed modifications on protein N-terminus
            if(fixedModifications != null)
            {
                List<Modification> prot_n_term_fixed_mods;
                if(fixedModifications.TryGetValue(0, out prot_n_term_fixed_mods))
                {
                    foreach(Modification fixed_modification in prot_n_term_fixed_mods)
                    {
                        mass_shift += productMassType == MassType.Average ? (fixed_modification.AverageMassShift - fixed_modification.AverageNeutralLossMass) : (fixed_modification.MonoisotopicMassShift - fixed_modification.AverageNeutralLossMass);
                    }
                }
            }
            // variable modification on the protein N-terminus
            if(variableModifications != null)
            {
                Modification protein_n_term_variable_mod;
                if(variableModifications.TryGetValue(0, out protein_n_term_variable_mod))
                {
                    mass_shift += productMassType == MassType.Average ? (protein_n_term_variable_mod.AverageMassShift - protein_n_term_variable_mod.AverageNeutralLossMass) : (protein_n_term_variable_mod.MonoisotopicMassShift - protein_n_term_variable_mod.AverageNeutralLossMass);
                }
            }
            // fixed modifications on peptide N-terminus
            if(fixedModifications != null)
            {
                List<Modification> pep_n_term_fixed_mods;
                if(fixedModifications.TryGetValue(1, out pep_n_term_fixed_mods))
                {
                    foreach(Modification fixed_modification in pep_n_term_fixed_mods)
                    {
                        mass_shift += productMassType == MassType.Average ? (fixed_modification.AverageMassShift - fixed_modification.AverageNeutralLossMass) : (fixed_modification.MonoisotopicMassShift - fixed_modification.AverageNeutralLossMass);
                    }
                }
            }
            // variable modification on peptide N-terminus
            if(variableModifications != null)
            {
                Modification pep_n_term_variable_mod;
                if(variableModifications.TryGetValue(1, out pep_n_term_variable_mod))
                {
                    mass_shift += productMassType == MassType.Average ? (pep_n_term_variable_mod.AverageMassShift - pep_n_term_variable_mod.AverageNeutralLossMass) : (pep_n_term_variable_mod.MonoisotopicMassShift - pep_n_term_variable_mod.AverageNeutralLossMass);
                }
            }
            cumulativeNTerminalMass[0] = mass_shift;

            for(int r = 1; r < Length; r++)
            {
                mass_shift = 0.0;
                // fixed modifications on this residue
                if(fixedModifications != null)
                {
                    List<Modification> residue_fixed_mods;
                    if(fixedModifications.TryGetValue(r + 1, out residue_fixed_mods))
                    {
                        foreach(Modification fixed_modification in residue_fixed_mods)
                        {
                            mass_shift += productMassType == MassType.Average ? (fixed_modification.AverageMassShift - fixed_modification.AverageNeutralLossMass) : (fixed_modification.MonoisotopicMassShift - fixed_modification.AverageNeutralLossMass);
                        }
                    }
                }
                // variable modification on this residue
                if(variableModifications != null)
                {
                    Modification residue_variable_mod;
                    if(variableModifications.TryGetValue(r + 1, out residue_variable_mod))
                    {
                        mass_shift += productMassType == MassType.Average ? (residue_variable_mod.AverageMassShift - residue_variable_mod.AverageNeutralLossMass) : (residue_variable_mod.MonoisotopicMassShift - residue_variable_mod.MonoisotopicNeutralLossMass);
                    }
                }
                cumulativeNTerminalMass[r] = cumulativeNTerminalMass[r - 1] + (productMassType == MassType.Average ? AminoAcidMasses.GetAverageMass(this[r - 1]) : AminoAcidMasses.GetMonoisotopicMass(this[r - 1])) + mass_shift;
            }

            cumulativeCTerminalMass = new double[Length];

            mass_shift = 0.0;
            // fixed modifications on protein C-terminus
            if(fixedModifications != null)
            {
                List<Modification> prot_c_term_fixed_mods;
                if(fixedModifications.TryGetValue(Length + 3, out prot_c_term_fixed_mods))
                {
                    foreach(Modification fixed_modification in prot_c_term_fixed_mods)
                    {
                        mass_shift += productMassType == MassType.Average ? (fixed_modification.AverageMassShift - fixed_modification.AverageNeutralLossMass) : (fixed_modification.MonoisotopicMassShift - fixed_modification.AverageNeutralLossMass);
                    }
                }
            }
            // variable modification on protein C-terminus
            if(variableModifications != null)
            {
                Modification prot_c_term_variable_mod;
                if(variableModifications.TryGetValue(Length + 3, out prot_c_term_variable_mod))
                {
                    mass_shift += productMassType == MassType.Average ? (prot_c_term_variable_mod.AverageMassShift - prot_c_term_variable_mod.AverageNeutralLossMass) : (prot_c_term_variable_mod.MonoisotopicMassShift - prot_c_term_variable_mod.MonoisotopicNeutralLossMass);
                }
            }
            // fixed modifications on peptide C-terminus
            if(fixedModifications != null)
            {
                List<Modification> pep_c_term_fixed_mods;
                if(fixedModifications.TryGetValue(Length + 2, out pep_c_term_fixed_mods))
                {
                    foreach(Modification fixed_modification in pep_c_term_fixed_mods)
                    {
                        mass_shift += productMassType == MassType.Average ? (fixed_modification.AverageMassShift - fixed_modification.AverageNeutralLossMass) : (fixed_modification.MonoisotopicMassShift - fixed_modification.MonoisotopicNeutralLossMass);
                    }
                }
            }
            // variable modification on peptide C-terminus
            if(variableModifications != null)
            {
                Modification pep_c_term_variable_mod;
                if(variableModifications.TryGetValue(Length + 2, out pep_c_term_variable_mod))
                {
                    mass_shift += productMassType == MassType.Average ? (pep_c_term_variable_mod.AverageMassShift - pep_c_term_variable_mod.AverageNeutralLossMass) : (pep_c_term_variable_mod.MonoisotopicMassShift - pep_c_term_variable_mod.MonoisotopicNeutralLossMass);
                }
            }
            cumulativeCTerminalMass[0] = mass_shift;

            for(int r = 1; r < Length; r++)
            {
                mass_shift = 0.0;
                // fixed modifications on this residue
                if(fixedModifications != null)
                {
                    List<Modification> residue_fixed_mods;
                    if(fixedModifications.TryGetValue(Length - r + 2, out residue_fixed_mods))
                    {
                        foreach(Modification fixed_modification in residue_fixed_mods)
                        {
                            mass_shift += productMassType == MassType.Average ? (fixed_modification.AverageMassShift - fixed_modification.AverageNeutralLossMass) : (fixed_modification.MonoisotopicMassShift - fixed_modification.MonoisotopicNeutralLossMass);
                        }
                    }
                }
                // variable modification on this residue
                if(variableModifications != null)
                {
                    Modification residue_variable_mod;
                    if(variableModifications.TryGetValue(Length - r + 2, out residue_variable_mod))
                    {
                        mass_shift += productMassType == MassType.Average ? (residue_variable_mod.AverageMassShift - residue_variable_mod.AverageNeutralLossMass) : (residue_variable_mod.MonoisotopicMassShift - residue_variable_mod.MonoisotopicNeutralLossMass);
                    }
                }

                cumulativeCTerminalMass[r] = cumulativeCTerminalMass[r - 1] + (productMassType == MassType.Average ? AminoAcidMasses.GetAverageMass(this[Length - r]) : AminoAcidMasses.GetMonoisotopicMass(this[Length - r])) + mass_shift;
            }

            initializeProductArrays = false;
        }