Exemple #1
0
        private void buttonXtract_Click(object sender, EventArgs e)
        {
            if (textBoxScanNo.Text.Length == 0)
            {
                MessageBox.Show("Please enter a valid scan number");
                return;
            }
            double theoreticalMH = double.Parse(textBoxTheoreticalMass.Text);
            int    scanNo        = int.Parse(textBoxScanNo.Text);

            SQTLight s = new SQTLight(null);

            s.PeptideSequenceCleaned = "N/A";
            XQuantClusteringParameters myParams = parameters1.GetFromScreen();

            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            Dictionary <string, List <Quant> > theQuants = Core35.Quant(getter, s, theoreticalMH, isotopicSignal, scanNo, myParams);

            stopwatch.Stop();
            Console.WriteLine("Time elapsed: {0}", stopwatch.Elapsed);

            foreach (var kvp in theQuants)
            {
                foreach (Quant q in kvp.Value)
                {
                    //XICViewer viewer = new XICViewer();

                    //viewer.Plot(q.PrecursorMZ, q.GetIonsLight(), new List<int>() { q.ScanNoMS2 });
                    //viewer.ShowDialog();
                }
            }
        }
Exemple #2
0
        public XQuantClusteringParameters GetFromScreen()
        {
            XQuantClusteringParameters cp = new XQuantClusteringParameters();

            cp.ClusteringPPM = (int)numericUpDownXICPPM.Value;

            List <int> acceptableZ = new List <int>();

            string[] cols = Regex.Split(textBoxAcceptableZ.Text, ",");
            foreach (string col in cols)
            {
                acceptableZ.Add(int.Parse(col));
            }
            cp.AcceptableChargeStates = acceptableZ;

            return(cp);
        }
        private void buttonSEProQ2_Click(object sender, EventArgs e)
        {
            saveFileDialog1.Filter = "XIC Files (xic)|*.xic";


            if (saveFileDialog1.ShowDialog() != System.Windows.Forms.DialogResult.Cancel)
            {
                buttonProcessXIC.Text = "Working";
                this.Update();
                XQuant.XQuantClusteringParameters cp = parametersXQuant.MyXQuantClusteringParameters;
                cp.MinMS1Counts       = 1;
                cp.RetainOptimal      = true;
                cp.OnlyUniquePeptides = false;
                cp.MaxParsimony       = false;

                Core35 XICAnalyzer = new Core35(multipleDirectorySelector1.MyDirectoryDescriptionDictionary, cp);

                XICAnalyzer.Serialize(saveFileDialog1.FileName);

                MessageBox.Show("XIC file saved successfuly", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);

                buttonProcessXIC.Text = "Process XIC";
            }
        }
Exemple #4
0
        public static Dictionary <string, List <Quant> > Quant(XICGet5 xic, SQTLight theScn, double theoreticalMH, SignalGenerator isotopicSignal, int scnNo, XQuantClusteringParameters myParams)
        {
            Dictionary <string, List <Quant> > theResults = new Dictionary <string, List <Quants.Quant> >();

            //We will obtain the isotopic signal and obtain the XIC according to the most intense isotope
            List <double> isoSignal            = isotopicSignal.GetSignal(5, theoreticalMH, 0);
            int           maximumSignalIsotope = isoSignal.IndexOf(isoSignal.Max());


            foreach (int z in myParams.AcceptableChargeStates)
            {
                double pMass = ((double)z - 1.0) * 1.007276466;
                double iMass = (maximumSignalIsotope * 1.00335);
                double mz    = (theoreticalMH + pMass + iMass) / (double)z;

                double[,] ic = xic.GetXIC3(Math.Round(mz, 4), myParams.ClusteringPPM, scnNo);

                if (ic != null)
                {
                    Quant q = new Quants.Quant(ic, theScn.ScanNumber, z, Math.Round(mz, 4));

                    if (theResults.ContainsKey(theScn.PeptideSequenceCleaned))
                    {
                        theResults[theScn.PeptideSequenceCleaned].Add(q);
                    }
                    else
                    {
                        theResults.Add(theScn.PeptideSequenceCleaned, new List <Quants.Quant>()
                        {
                            q
                        });
                    }
                }
            }

            return(theResults);
        }
Exemple #5
0
        public Core35(List <DirectoryClassDescription> dcds, XQuantClusteringParameters myClusteringParameters)
        {
            MyClusterParams = myClusteringParameters;
            IdentifiedSequencesInFullDirDict = new Dictionary <string, List <string> >();
            MyFastaItems = new List <FastaItem>();
            SEProFiles   = new List <SEProFileInfo>();

            //First we will need to load all SEPros and generate a list of peptides with their respectve quantitations

            foreach (DirectoryClassDescription cdc in dcds)
            {
                FileInfo[] files = new DirectoryInfo(cdc.MyDirectoryFullName).GetFiles("*.sepr", SearchOption.AllDirectories);

                SEProFiles.Add(new SEProFileInfo(cdc.MyDirectoryFullName, cdc.ClassLabel, cdc.Description, files.Select(a => a.FullName).ToList()));

                foreach (FileInfo fi in files)
                {
                    //Make sure we only have 1 sepro file per directory
                    if (fi.Directory.GetFiles("*.sepr").Count() != 1)
                    {
                        throw new Exception("There can be only one SEPro file per directory; error in directory:\n" + fi.DirectoryName);
                    }

                    Console.WriteLine("Loading " + fi.FullName);
                    ResultPackage rp = ResultPackage.Load(fi.FullName);

                    //Verify if all equivalent ms1 or raw files are in directory

                    List <string> filesInSEPro = RemoveExtensions((from sqt in rp.MyProteins.AllSQTScans
                                                                   select sqt.FileName).Distinct().ToList());


                    List <string> ms1OrRawOrmzMLFiles = fi.Directory.GetFiles("*.ms1").Select(a => a.Name).Concat(fi.Directory.GetFiles("*.RAW").Select(a => a.Name)).Concat(fi.Directory.GetFiles("*.mzML").Select(a => a.Name)).ToList();
                    ms1OrRawOrmzMLFiles = RemoveExtensions(ms1OrRawOrmzMLFiles);

                    //Lets store the fasta items
                    List <MyProtein> proteinsToAnalyze = new List <MyProtein>();

                    if (myClusteringParameters.MaxParsimony)
                    {
                        proteinsToAnalyze = rp.MaxParsimonyList();
                    }
                    else
                    {
                        proteinsToAnalyze = rp.MyProteins.MyProteinList;
                    }


                    IdentifiedSequencesInFullDirDict.Add(fi.Directory.FullName, proteinsToAnalyze.Select(a => a.Locus).ToList());

                    foreach (MyProtein p in proteinsToAnalyze)
                    {
                        if (!MyFastaItems.Exists(a => a.SequenceIdentifier.Equals(p.Locus)))
                        {
                            MyFastaItems.Add(new FastaItem(p.Locus, p.Sequence, p.Description));
                        }
                    }

                    //End storing fasta stuff


                    foreach (string f in filesInSEPro)
                    {
                        if (!ms1OrRawOrmzMLFiles.Contains(f))
                        {
                            throw new Exception("All .ms1, .mzML, or Thermo .RAW files must be placed in each corresponding SEPro directory.  Error in directory:\n" + fi.DirectoryName + "\nfor file:" + f);
                        }
                    }
                }
            }

            Process();

            PreparePeptideProteinDictionary();
            if (myClusteringParameters.RetainOptimal)
            {
                RetainOptimalSignal();
            }

            Console.WriteLine("Done");
        }
Exemple #6
0
 public void UpdatePanel(XQuantClusteringParameters cp)
 {
     numericUpDownXICPPM.Value = (int)cp.ClusteringPPM;
     textBoxAcceptableZ.Text   = string.Join(", ", cp.AcceptableChargeStates);
 }