<commit_before>﻿using OldInternalLogic;
using System;
using System.Collections.Generic;
using System.Linq;

namespace InternalLogicEngineLayer
{
    public class GPTMDEngine : MyEngine
    {
        private List<NewPsmWithFDR>[] allResultingIdentifications;
        private IEnumerable<Tuple<double, double>> combos;
        private Dictionary<CompactPeptide, HashSet<PeptideWithSetModifications>> dict;
        private List<MorpheusModification> gptmdModifications;
        private bool isotopeErrors;
        private List<MorpheusModification> localizeableModifications;
        private double tol;
        private List<MorpheusModification> variableModifications;


        public GPTMDEngine(List<NewPsmWithFDR>[] allResultingIdentifications, Dictionary<CompactPeptide, HashSet<PeptideWithSetModifications>> dict, List<MorpheusModification> variableModifications, List<MorpheusModification> localizeableModifications, bool isotopeErrors, List<MorpheusModification> gptmdModifications, IEnumerable<Tuple<double, double>> combos, double tol)
        {
            this.dict = dict;
            this.allResultingIdentifications = allResultingIdentifications;
            this.variableModifications = variableModifications;
            this.localizeableModifications = localizeableModifications;
            this.isotopeErrors = isotopeErrors;
            this.gptmdModifications = gptmdModifications;
            this.combos = combos;
            this.tol = tol;
        }

        public override void ValidateParams()
        {
            throw new NotImplementedException();
        }

        protected override MyResults RunSpecific()
        {
            Dictionary<string, HashSet<Tuple<int, string>>> Mods = new Dictionary<string, HashSet<Tuple<int, string>>>();

            int modsAdded = 0;
            foreach (var ye in allResultingIdentifications[0].Where(b => b.QValue <= 0.01 && !b.isDecoy))
            {
                var baseSequence = ye.thisPSM.BaseSequence;
                double massDiff = ye.thisPSM.scanPrecursorMass - ye.thisPSM.PeptideMonoisotopicMass;
                foreach (MorpheusModification mod in GetMod(massDiff, isotopeErrors, gptmdModifications, combos, tol))
                {
                    foreach (var peptide in dict[ye.thisPSM.newPsm.GetCompactPeptide(variableModifications, localizeableModifications)])
                    {
                        int proteinLength = peptide.protein.Length;
                        var proteinAcession = peptide.protein.Accession;
                        for (int i = 0; i < baseSequence.Length; i++)<commit_msg>implement ValidateParams for GPTMDEngine<commit_after>﻿using OldInternalLogic;
using System;
using System.Collections.Generic;
using System.Linq;

namespace InternalLogicEngineLayer
{
    public class GPTMDEngine : MyEngine
    {
        private List<NewPsmWithFDR>[] allResultingIdentifications;
        private IEnumerable<Tuple<double, double>> combos;
        private Dictionary<CompactPeptide, HashSet<PeptideWithSetModifications>> dict;
        private List<MorpheusModification> gptmdModifications;
        private bool isotopeErrors;
        private List<MorpheusModification> localizeableModifications;
        private double tol;
        private List<MorpheusModification> variableModifications;


        public GPTMDEngine(List<NewPsmWithFDR>[] allResultingIdentifications, Dictionary<CompactPeptide, HashSet<PeptideWithSetModifications>> dict, List<MorpheusModification> variableModifications, List<MorpheusModification> localizeableModifications, bool isotopeErrors, List<MorpheusModification> gptmdModifications, IEnumerable<Tuple<double, double>> combos, double tol)
        {
            this.dict = dict;
            this.allResultingIdentifications = allResultingIdentifications;
            this.variableModifications = variableModifications;
            this.localizeableModifications = localizeableModifications;
            this.isotopeErrors = isotopeErrors;
            this.gptmdModifications = gptmdModifications;
            this.combos = combos;
            this.tol = tol;
        }

        public override void ValidateParams()
        {
            if (allResultingIdentifications == null)
                throw new EngineValidationException("allResultingIdentifications cannot be null");
        }

        protected override MyResults RunSpecific()
        {
            Dictionary<string, HashSet<Tuple<int, string>>> Mods = new Dictionary<string, HashSet<Tuple<int, string>>>();

            int modsAdded = 0;
            foreach (var ye in allResultingIdentifications[0].Where(b => b.QValue <= 0.01 && !b.isDecoy))
            {
                var baseSequence = ye.thisPSM.BaseSequence;
                double massDiff = ye.thisPSM.scanPrecursorMass - ye.thisPSM.PeptideMonoisotopicMass;
                foreach (MorpheusModification mod in GetMod(massDiff, isotopeErrors, gptmdModifications, combos, tol))
                {
                    foreach (var peptide in dict[ye.thisPSM.newPsm.GetCompactPeptide(variableModifications, localizeableModifications)])
                    {
                        int proteinLength = peptide.protein.Length;
                        var proteinAcession = peptide.protein.Accession;
                        for (int i = 0; i < baseSequence.Length; i++)
{'fraction_non_alphanumeric': 0.07415730337078652, 'fraction_numerical': 0.0022471910112359553, 'mean_word_length': 2.8843636363636365, 'pattern_counts': {'":': 0, '<': 51, '<?xml version=': 0, '>': 49, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6859195', 'n_tokens_mistral': 1463, 'n_tokens_neox': 1367, 'n_words': 289}