コード例 #1
0
 private void buttonLoad_Click(object sender, EventArgs e)
 {
     if (openFileDialog1.ShowDialog() != DialogResult.Cancel)
     {
         Console.WriteLine("Loading file " + openFileDialog1.FileName);
         getter                 = new XICGet5(openFileDialog1.FileName);
         buttonLoad.Text        = openFileDialog1.FileName;
         groupBoxXtract.Enabled = true;
     }
 }
コード例 #2
0
ファイル: Core35.cs プロジェクト: pcarvalho75/patternlab
        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);
        }
コード例 #3
0
ファイル: Core35.cs プロジェクト: pcarvalho75/patternlab
        public void Process()
        {
            myQuantPkgs = new List <QuantPackage2>();
            SignalGenerator isotopicSignal = new SignalGenerator();

            foreach (SEProFileInfo sfi in SEProFiles)
            {
                foreach (string file in sfi.MyFilesFullPath)
                {
                    Console.WriteLine("Processing for " + file);
                    ResultPackage rp = ResultPackage.Load(file);

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

                    FileInfo fi = new FileInfo(file);

                    foreach (string msFile in filesInSEPro)
                    {
                        QuantPackage2 qp = new QuantPackage2(msFile, fi.Directory.FullName, sfi.ClassLabel);

                        Console.WriteLine("\t" + msFile);
                        List <string> ms1OrRawOrmzMLFiles = fi.Directory.GetFiles("*.ms1").ToList().Concat(fi.Directory.GetFiles("*.RAW")).Concat(fi.Directory.GetFiles("*.mzML")).ToList().Select(a => a.Name).ToList();


                        int fileToRead = ms1OrRawOrmzMLFiles.FindIndex(a => RemoveExtension(a).Equals(RemoveExtension(msFile)));

                        XICGet5 xic = new XICGet5(fi.DirectoryName + "/" + ms1OrRawOrmzMLFiles[fileToRead]);

                        List <SQTScan> scansTMP = rp.MyProteins.AllSQTScans.FindAll(a => a.FileName.Equals(msFile));

                        if (MyClusterParams.OnlyUniquePeptides)
                        {
                            int removedForNotUnique = scansTMP.RemoveAll(a => a.IsUnique);
                            Console.WriteLine("Scans removed for not dealing with unique peptides: " + removedForNotUnique);
                        }

                        List <SQTLight> scans = scansTMP.Select(a => new SQTLight(a)).ToList();

                        int counter = 0;
                        for (int i = 0; i < scans.Count; i++)
                        {
                            Dictionary <string, List <Quant> > theseQuants = Core35.Quant(xic, scans[i], scans[i].TheoreticalMH, isotopicSignal, scans[i].ScanNumber, MyClusterParams);

                            foreach (var kvp in theseQuants)
                            {
                                kvp.Value.RemoveAll(a => a.MyIons.GetLength(1) < MyClusterParams.MinMS1Counts);

                                if (kvp.Value.Count > 0)
                                {
                                    if (qp.MyQuants.ContainsKey(kvp.Key))
                                    {
                                        qp.MyQuants[kvp.Key].AddRange(kvp.Value);
                                    }
                                    else
                                    {
                                        qp.MyQuants.Add(kvp.Key, kvp.Value);
                                    }
                                }
                            }

                            counter++;
                            Console.Write("\rScans Processed: " + counter + "/" + scans.Count);
                        }

                        //Store them
                        myQuantPkgs.Add(qp);
                        Console.WriteLine("\nTotal quants stored so far = " + myQuantPkgs.Sum(a => a.MyQuants.Count));
                        Console.WriteLine("Total files analyzed so far = " + myQuantPkgs.Count);

                        Console.WriteLine("Done procesing :" + msFile);
                        System.GC.Collect();
                        System.GC.WaitForPendingFinalizers();
                        System.GC.Collect();
                    }
                }
            }


            GenerateAssociationItems();
        }