コード例 #1
0
ファイル: Convertor.cs プロジェクト: trishorts/Compass
        public void Convert(string omssaCSV, MSDataFile dataFile)
        {
            string filePath = Path.ChangeExtension(omssaCSV, ".pepxml");

            using (PepXmlWriter writer = new PepXmlWriter(filePath))
            {
                writer.WriteSampleProtease(Protease);

                writer.StartSearchSummary("OMSSA", true, true);

                writer.WriteProteinDatabase(FastaDatabaseFile);

                writer.WriteSearchProtease(Protease, MissedClevages);

                foreach (int modNumber in FixedMods)
                {
                    OmssaModification mod;
                    if (OmssaModification.TryGetModification(modNumber, out mod))
                    {
                        writer.WriteModification(mod, mod.Sites, true);
                    }
                }

                foreach (int modNumber in VariableMods)
                {
                    OmssaModification mod;
                    if (OmssaModification.TryGetModification(modNumber, out mod))
                    {
                        writer.WriteModification(mod, mod.Sites, false);
                    }
                }


                writer.SetCurrentStage(PepXmlWriter.Stage.Spectra, true);

                using (OmssaCsvPsmReader reader = new OmssaCsvPsmReader(omssaCSV, UserModFile))
                {
                    reader.AddMSDataFile(dataFile);
                    reader.LoadProteins(FastaDatabaseFile);
                    foreach (PeptideSpectralMatch psm in reader.ReadNextPsm())
                    {
                        writer.StartSpectrum(psm.SpectrumNumber, psm.Spectrum.RetentionTime, psm.Spectrum.PrecursorMz, psm.Spectrum.PrecursorCharge);
                        writer.WritePSM(psm);
                        writer.EndSpectrum();
                    }
                }
            }
        }
コード例 #2
0
ファイル: lotorForm.cs プロジェクト: trishorts/Compass
        public void Run()
        {
            logTB.Clear();
            logTB.BackColor = Color.White;

            string rawFileDirectory = textBox3.Text;
            string inputcsvfile     = textBox1.Text;

            if (!File.Exists(inputcsvfile))
            {
                UpdateLog("Cannot open input csvfile: " + inputcsvfile + ", aborting!");
                return;
            }
            string outputDirectory = textBox2.Text;

            if (string.IsNullOrWhiteSpace(outputDirectory))
            {
                UpdateLog("Must provide a valid output folder!");
                return;
            }
            if (!Directory.Exists(outputDirectory))
            {
                UpdateLog("Output directory " + outputDirectory + " doesn't exist, creating it...");
                Directory.CreateDirectory(outputDirectory);
            }

            List <Modification> fixedModifications      = listBox2.Items.OfType <Modification>().ToList();
            List <Modification> quantifiedModifications = new List <Modification>();

            List <string> modNames = checkedListBox1.CheckedItems.OfType <string>().ToList();

            if (modNames.Count > 0)
            {
                foreach (string modName in modNames)
                {
                    if (modName == Phosphorylation.Name)
                    {
                        quantifiedModifications.Add(Phosphorylation);
                    }
                    else
                    {
                        OmssaModification mod;
                        if (!OmssaModification.TryGetModification(modName, out mod))
                        {
                            UpdateLog("Unable to load mod " + modName + ". Did you load the correct modification file?");
                            return;
                        }
                        quantifiedModifications.Add(mod);
                    }
                }
            }
            else
            {
                UpdateLog("No modifications were selected to be quantified, please select mods from the list or one of the default options");
                return;
            }

            //double ascoreThreshold = (double)numericUpDown2.Value;
            double prodThreshold      = (double)numericUpDown3.Value / 100.0;
            bool   separateGroups     = checkBox3.Enabled && checkBox3.Checked;
            bool   ignoreCTerminal    = checkBox2.Checked;
            bool   reduceSites        = checkBox1.Checked;
            int    scoreCutoff        = (int)numericUpDown2.Value;
            bool   phosphoNeutralLoss = phosphoNeutralLossCB.Checked && quantifiedModifications.Contains(Phosphorylation);

            Tolerance prodTolerance = GetProductTolerance();

            _lotor = new Lotor(rawFileDirectory, inputcsvfile, outputDirectory, fixedModifications,
                               quantifiedModifications, prodTolerance, scoreCutoff, separateGroups, prodThreshold, ignoreCTerminal, reduceSites,
                               FragmentTypes.b | FragmentTypes.y, phosphoNeutralLoss);
            _lotor.UpdateLog        += lotor_UpdateLog;
            _lotor.UpdateProgress   += lotor_UpdateProgress;
            _lotor.Completed        += _lotor_Completed;
            localizeB.Enabled        = false;
            _mainThread              = new Thread(_lotor.Localize);
            _mainThread.IsBackground = true;
            _mainThread.Start();
        }