Пример #1
0
        protected override IProcessor GetProcessor()
        {
            string dbFile;

            if (fastaFile.Exists)
            {
                dbFile = fastaFile.FullName;
            }
            else
            {
                dbFile = databaseFile.FullName;
            }

            var options = new PNovoSAPValidatorOptions()
            {
                PnovoFiles                       = pNovoFiles.SelectedFileNames,
                DatabaseFastaFile                = dbFile,
                TitleParser                      = titleParsers.SelectedItem,
                AccessNumberParser               = acParsers.SelectedItem,
                Enzyme                           = ProteaseManager.GetProteaseByName(proteases.SelectedItem),
                MinScore                         = minScore.Value,
                ThreadCount                      = threadCount.Value,
                IgnoreNtermMutation              = ignoreNTerm.Checked,
                IgnoreDeamidatedMutation         = ignoreDeamidatedMutation.Checked,
                IgnoreMultipleNucleotideMutation = ignoreMultipleNucleotideMutation.Checked,
                MinLength                        = minLength.Value,
                TargetDirectory                  = targetDirectory.FullName,
                TargetFastaFile                  = databaseFile.FullName
            };

            return(new PNovoSAPValidator(options));
        }
Пример #2
0
        /// <summary>
        ///<Enzymes independent="false">
        ///  <Enzyme id="ENZ_1" cTermGain="OH" nTermGain="H" missedCleavages="1" minDistance="1" semiSpecific="false">
        ///    <SiteRegexp>(?&lt;=[KR])</SiteRegexp>
        ///    <EnzymeName><cvParam cvRef="MS" accession="MS:1001313" name="Trypsin/P" value=""/></EnzymeName>
        ///  </Enzyme>
        ///</Enzymes>
        /// </summary>
        /// <param name="enzyme"></param>
        /// <returns></returns>
        public Protease ParseProtease(XElement enzyme)
        {
            var id   = enzyme.Attribute("id").Value;
            var name = enzyme.FindElement("EnzymeName").FindElement("cvParam").Attribute("name").Value;

            if (ProteaseManager.Registered(name))
            {
                return(ProteaseManager.GetProteaseByName(name));
            }

            var siteEle = enzyme.FindElement("SiteRegexp");

            if (siteEle != null)
            {
                string cut     = string.Empty;
                string notCut  = string.Empty;
                var    sitereg = siteEle.Value;
                var    cutM    = cutReg.Match(sitereg);
                if (cutM.Success)
                {
                    cut = cutM.Groups[1].Value;
                }
                var notCutM = notCutReg.Match(sitereg);
                if (notCutM.Success)
                {
                    notCut = notCutM.Groups[1].Value;
                }
                return(new Protease(name, true, cut, notCut)
                {
                    Id = id
                });
            }

            return(null);
        }
        public TheoreticalDigestionStatisticCalculatorUI()
        {
            InitializeComponent();

            SetFileArgument("FastaFile", new OpenFileArgument("Protein Sequence", "fasta"));

            lbProteases.Items.AddRange(ProteaseManager.GetNames().ToArray());

            AddComponent(lbSelectedProteases);

            this.minLength = new RcpaIntegerField(txtMinLength, "minlength", "Minimum peptide length", 6, true);
            AddComponent(minLength);

            this.maxMissCleavage = new RcpaIntegerField(txtMaxMissCleavage, "maxmisscleavage", "Maximum miss cleavage", 2, true);
            AddComponent(maxMissCleavage);

            this.minMass = new RcpaDoubleField(txtMinMass, "minmass", "Minimum peptide mass", 400, true);
            AddComponent(minMass);

            this.maxMass = new RcpaDoubleField(txtMaxMass, "maxmass", "Maximum peptide mass", 5000, true);
            AddComponent(maxMass);

            ignoreAminoacids = new RcpaTextField(txtIgnoreAminoacids, "ignoreaminoacids", "Ignore amino acids", "XB", true);
            AddComponent(ignoreAminoacids);

            this.Text = Constants.GetSQHTitle(title, version);
        }
        public ProteinChromatographViewer()
        {
            InitializeComponent();

            ProteaseManager.Load();

            proteases = new RcpaComboBox <string>(cbProtease, "ProteaseIndex", ProteaseManager.GetNames().ToArray(), 3);
            AddComponent(proteases);

            SetFileArgument("FastaFile", new OpenFileArgument("Fasta", "fasta"));

            rawFile = new RcpaFileField(btnRawDirectory, txtRawDirectory, "RawFile", new OpenFileArgument("Thermo Raw", "raw"), true);
            AddComponent(rawFile);

            ppmTolerance = new RcpaDoubleField(txtPPMTolerance, "PPMTolerance", "Precursor PPM Tolerance", 10, true);
            AddComponent(ppmTolerance);

            rebuildAll = new RcpaCheckBox(cbRebuildAll, "RebuildAll", false);
            AddComponent(rebuildAll);

            noredundantFile = new RcpaFileField(btnNoredundant, txtNoredundant, "NoredundantFile", new OpenFileArgument("noredundant", "noredundant"), false);
            AddComponent(noredundantFile);
            //rawDirectory = new RcpaDirectoryField(btnRawDirectory, txtRawDirectory, "RawDirectory", "Thermo Fisher Raw", true);
            //AddComponent(rawDirectory);
        }
Пример #5
0
        public PNovoSAPValidatorUI()
        {
            InitializeComponent();

            this.Text = Constants.GetSQHTitle(title, version);

            pNovoFiles.FileArgument = new OpenFileArgument("pNovo Result", "txt");
            AddComponent(this.pNovoFiles);

            this.minScore = new RcpaDoubleField(txtMinScore, "MinScore", "Minmum score", 0.65, true);
            AddComponent(this.minScore);

            this.threadCount = new RcpaIntegerField(txtThreadCount, "ThreadCount", "Thread count", Environment.ProcessorCount - 1, true);
            AddComponent(this.threadCount);

            toolTip1.SetToolTip(txtThreadCount, MyConvert.Format("Suggest max value = {0}", Environment.ProcessorCount + 1));

            this.titleParsers = new RcpaComboBox <ITitleParser>(cbTitleFormat, "TitleFormat", TitleParserUtils.GetTitleParsers().ToArray(), -1);
            AddComponent(this.titleParsers);

            fastaFile.FileArgument = new OpenFileArgument("Fasta To Find Mutation", "fasta");

            databaseFile.FileArgument = new OpenFileArgument("Fasta To Merge Mutated Peptide", "fasta");

            this.acParsers = new RcpaComboBox <IAccessNumberParser>(cbAccessNumberPattern, "AccessNumberParser", AccessNumberParserFactory.GetParsers().ToArray(), -1);
            AddComponent(this.acParsers);

            this.proteases = new RcpaComboBox <string>(cbProtease, "Protease", ProteaseManager.GetNames().ToArray(), -1);
            AddComponent(this.proteases);

            this.minLength = new RcpaIntegerField(txtMinLength, "MinLength", "Minimum Peptide Length", 6, true);
            AddComponent(this.minLength);
        }
        public ProteinChromatographProcessorUI()
        {
            InitializeComponent();

            ProteaseManager.Load();

            SetFileArgument("PeptideFile", new OpenFileArgument("peptides", "peptides"));

            rawFile = new RcpaFileField(btnRawDirectory, txtRawDirectory, "RawFile", new OpenFileArgument("Thermo Raw", "raw"), true);
            AddComponent(rawFile);

            ppmTolerance = new RcpaDoubleField(txtPPMTolerance, "PPMTolerance", "Precursor PPM Tolerance", 10, true);
            AddComponent(ppmTolerance);

            window = new RcpaDoubleField(txtWindow, "Window", "Elution Window", 1, true);
            AddComponent(window);

            lvcPeptides = new ListViewColumnField(lvPeptides, "LvPeptides");
            AddComponent(lvcPeptides);

            rawonly = new RcpaCheckBox(cbShowInRawFileOnly, "ShowRawFileOnly", true);
            AddComponent(rawonly);

            bFirstLoad = true;
        }
Пример #7
0
        private void ParseProtease(XmlNode parameters)
        {
            XmlNode node = xmlHelper.GetFirstChildByNameAndAttribute(parameters, "note", "label", "protein, cleavage site");

            Match m = Regex.Match(node.InnerText, @"\[(.+)\]\|\{(.+)\}");

            protease = ProteaseManager.FindOrCreateProtease("XTANDEM_PROTEASE", true, m.Groups[1].Value, m.Groups[2].Value);
        }
Пример #8
0
 public PepXmlWriterParameters()
 {
     RawDataType                = "raw";
     Protease                   = ProteaseManager.GetProteaseByName("Trypsin");
     SearchEngine               = "unknown";
     MassTypeParentAnnotation   = "monoisotopic";
     MassTypeFragmentAnnotation = "monoisotopic";
 }
        protected override IFileProcessor GetFileProcessor()
        {
            proteins = SequenceUtils.Read(new FastaFormat(), base.GetOriginFile());
            Protease protease = ProteaseManager.GetProteaseByName(proteases.SelectedItem);
            Digest   digest   = new Digest()
            {
                DigestProtease     = protease,
                MaxMissedCleavages = 2
            };

            List <SimplePeakChro> totalPeaks = new List <SimplePeakChro>();

            foreach (var seq in proteins)
            {
                digest.ProteinSequence = seq;
                digest.AddDigestFeatures();

                List <DigestPeptideInfo> peptides = seq.GetDigestPeptideInfo();
                peptides.RemoveAll(m => m.PeptideSeq.Length < 6);
                foreach (var dpi in peptides)
                {
                    double mass = aas.MonoPeptideMass(dpi.PeptideSeq);
                    List <SimplePeakChro> curPeaks = new List <SimplePeakChro>();
                    for (int charge = 2; charge <= 3; charge++)
                    {
                        double precursor = (mass + Atom.H.MonoMass * charge) / charge;
                        if (precursor < 300 || precursor > 2000)
                        {
                            continue;
                        }

                        curPeaks.Add(new SimplePeakChro()
                        {
                            Mz       = precursor,
                            Sequence = dpi.PeptideSeq,
                            Charge   = charge
                        });
                    }

                    if (curPeaks.Count > 0)
                    {
                        dpi.Annotations[CHRO_KEY] = curPeaks;
                        totalPeaks.AddRange(curPeaks);
                    }
                }

                peptides.RemoveAll(m => !m.Annotations.ContainsKey(CHRO_KEY));
            }

            return(new ProteinChromatographProcessor(totalPeaks, new string[] { rawFile.FullName }.ToList(), new RawFileImpl(), ppmTolerance.Value, 2.0, rebuildAll.Checked));
        }
Пример #10
0
        /// <summary>
        /// Parse enzyme used in database searching
        /// </summary>
        /// <param name="enzyme"></param>
        /// <returns></returns>
        public Protease ParseProtease(XElement enzyme)
        {
            var enzymeIndex = enzyme.FindElement("MSEnzymes").Value;

            if (OmssaConsts.EnzymeMap.ContainsKey(enzymeIndex))
            {
                var name = OmssaConsts.EnzymeMap[enzymeIndex];
                if (ProteaseManager.Registered(name))
                {
                    return(ProteaseManager.GetProteaseByName(name));
                }
            }

            return(null);
        }
        protected override IFileProcessor GetFileProcessor()
        {
            var proteases = new List <Protease>();

            foreach (var obj in lbSelectedProteases.Items)
            {
                proteases.Add(ProteaseManager.GetProteaseByName((string)obj));
            }

            return(new TheoreticalDigestionStatisticCalculator(
                       proteases,
                       minLength.Value,
                       minMass.Value,
                       maxMass.Value,
                       maxMissCleavage.Value,
                       ignoreAminoacids.Text));
        }
Пример #12
0
        public Protease ParseProtease(XElement enzyme)
        {
            var name = enzyme.Attribute("name").Value;

            if (ProteaseManager.Registered(name))
            {
                return(ProteaseManager.GetProteaseByName(name));
            }

            var specificity = enzyme.FindFirstDescendant("specificity");

            if (specificity != null)
            {
                var cut    = specificity.Attribute("cut").Value;
                var notcut = specificity.Attribute("no_cut").Value;
                var sense  = specificity.Attribute("sense").Value;
                return(new Protease(name, sense == "C", cut, notcut));
            }

            return(new Protease(name, true, string.Empty, string.Empty));
        }
Пример #13
0
        public override IEnumerable <string> Process(string filename)
        {
            FastaFormat ff     = new FastaFormat();
            Digest      digest = new Digest();

            digest.DigestProtease     = ProteaseManager.FindOrCreateProtease("Trypsin", true, "RK", "P");
            digest.MaxMissedCleavages = 1;

            NGlycanFilter filter = new NGlycanFilter();

            digest.Filter = filter;

            string resultFile = filename + ".nglycan";
            Dictionary <string, NGlycanValue> peptideProteinMap = new Dictionary <string, NGlycanValue>();

            using (StreamReader sr = new StreamReader(filename))
            {
                Sequence seq;
                while ((seq = ff.ReadSequence(sr)) != null)
                {
                    digest.ProteinSequence = seq;
                    digest.AddDigestFeatures();

                    if (seq.Annotation.ContainsKey(Digest.PEPTIDE_FEATURE_TYPE))
                    {
                        bool[] isGlycans = filter.IsNglycan;

                        List <DigestPeptideInfo> nglycanPeptides = (List <DigestPeptideInfo>)seq.Annotation[Digest.PEPTIDE_FEATURE_TYPE];
                        foreach (DigestPeptideInfo dpi in nglycanPeptides)
                        {
                            if (!peptideProteinMap.ContainsKey(dpi.PeptideSeq))
                            {
                                StringBuilder sb = new StringBuilder();
                                for (int i = 0; i < dpi.PeptideSeq.Length; i++)
                                {
                                    if (isGlycans[dpi.PeptideLoc.Min - 1 + i])
                                    {
                                        sb.Append(1);
                                    }
                                    else
                                    {
                                        sb.Append(0);
                                    }
                                }

                                NGlycanValue value = new NGlycanValue();
                                value.NGlycanSites = sb.ToString();

                                peptideProteinMap[dpi.PeptideSeq] = value;
                            }

                            peptideProteinMap[dpi.PeptideSeq].Proteins.Add(parser.GetValue(dpi.ProteinName));
                        }
                    }
                }
            }

            List <string> peptides = new List <string>(peptideProteinMap.Keys);

            peptides.Sort();

            using (StreamWriter sw = new StreamWriter(resultFile))
            {
                foreach (string pep in peptides)
                {
                    NGlycanValue value = peptideProteinMap[pep];
                    sw.Write(pep + "\t" + value.NGlycanSites + "\t");
                    bool bFirst = true;
                    foreach (string protein in value.Proteins)
                    {
                        if (bFirst)
                        {
                            bFirst = false;
                            sw.Write(protein);
                        }
                        else
                        {
                            sw.Write(" ! " + protein);
                        }
                    }
                    sw.WriteLine();
                }
            }

            return(new[] { resultFile });
        }