Beispiel #1
0
        private void Test()
        {
            if (RaceIsOn)
            {
                throw new Exception("Гонка уже началась! Сначала остановите гонку");
            }

            Bolides.AddRange(new List <Bolide>()
            {
                new Bolide("Ferrari", TrackWidth, TrackHeight),
                new Bolide("RedBull", TrackWidth, TrackHeight),
                new Bolide("ForceIndia", TrackWidth, TrackHeight),
                new Bolide("Mercedes", TrackWidth, TrackHeight),
            });
            foreach (Bolide bolide in Bolides)
            {
                Mechanic mechanic = new Mechanic(bolide.Name, bolide);
                mechanic.SetPosition(TrackWidth, TrackHeight);
                Mechanics.Add(mechanic);

                ReparingLoader repaing = new ReparingLoader(bolide.Name, bolide);
                repaing.SetPosition(TrackWidth, TrackHeight);
                Loaders.Add(repaing);

                SafetyCar safety = new SafetyCar(bolide.Name, bolide);
                safety.SetPosition(TrackWidth, TrackHeight);
                Loaders.Add(safety);
            }
        }
        protected virtual bool GenerateProcessorChain()
        {
            bool b = true;
            List <ProcessorLoader <T> > removals = new List <ProcessorLoader <T> >();

            foreach (ProcessorLoader <T> item in Loaders)
            {
                if (!item.IsInitialized)
                {
                    b = false;
                    removals.Add(item);
                }
            }
            foreach (var item in removals)
            {
                Loaders.Remove(item);
            }

            List <IProcessor <T> > list = new List <IProcessor <T> >();

            for (int i = 0; i < Loaders.Count; i++)
            {
                IProcessor <T> p = Loaders[i].Load();
                if (i > 0)
                {
                    list[i - 1].SetSuccessor(p);
                }
                list.Add(p);
            }
            Processors = new HeadProcessor <T>();
            Processors.SetSuccessor(list[0]);

            return(b);
        }
Beispiel #3
0
        public void AddRacer(string Name)
        {
            if (!RaceIsOn)
            {
                Bolide newbolide = new Bolide(Name, TrackWidth, TrackHeight);
                Bolides.Add(newbolide);

                Mechanic newmechanic = new Mechanic(Name, newbolide);
                newmechanic.SetPosition(TrackWidth, TrackHeight);
                Mechanics.Add(newmechanic);


                ReparingLoader newloader = new ReparingLoader(Name, newbolide);
                newloader.SetPosition(TrackWidth, TrackHeight);
                Loaders.Add(newloader);

                SafetyCar safety = new SafetyCar(Name, newbolide);
                safety.SetPosition(TrackWidth, TrackHeight);
                Loaders.Add(safety);

                SetStartGrid();
            }
            else
            {
                throw new Exception("Гонка уже началась! Сначала остановите гонку");
            }
        }
Beispiel #4
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            string dir = System.IO.Directory.GetCurrentDirectory();

            Loaders.LoadElements(dir + @"\elements.dat");
            listView.ItemsSource = DeconvolutedFeatures;

            /*
             * REngine R;
             * REngine.SetEnvironmentVariables();
             * R = REngine.GetInstance();
             * R.Initialize();
             * R.Evaluate("source(\"https://bioconductor.org/biocLite.R\")");
             * try
             * {
             *  R.Evaluate("biocLite(\"Prostar\")");
             * }
             * catch(Exception ex)
             * {
             *
             * }
             * R.Evaluate("");
             * R.Dispose();
             */
        }
 public static LambdaEnumerableLoader <Company, ModelContainer> GetCompanyByName(string name)
 {
     return(Loaders.Create(() => new ModelContainer(),
                           m => (from c in m.Companies
                                 where c.Name.StartsWith(name)
                                 select c).Take(9)));
 }
        private static void LoadModifications()
        {
            _AllModsKnown          = new List <Modification>();
            _AllModTypesKnown      = new HashSet <string>();
            ErrorsReadingMods      = new List <string>();
            AllModsKnownDictionary = new Dictionary <string, Modification>();

            UnimodDeserialized = Loaders.LoadUnimod(Path.Combine(DataDir, @"Data", @"unimod.xml")).ToList();
            PsiModDeserialized = Loaders.LoadPsiMod(Path.Combine(DataDir, @"Data", @"PSI-MOD.obo.xml"));
            var formalChargesDictionary = Loaders.GetFormalChargesDictionary(PsiModDeserialized);

            UniprotDeseralized = Loaders.LoadUniprot(Path.Combine(DataDir, @"Data", @"ptmlist.txt"), formalChargesDictionary).ToList();

            foreach (var modFile in Directory.GetFiles(Path.Combine(DataDir, @"Mods")))
            {
                AddMods(PtmListLoader.ReadModsFromFile(modFile, out var errorMods), false);
            }

            AddMods(UniprotDeseralized.OfType <Modification>(), false);
            AddMods(UnimodDeserialized.OfType <Modification>(), false);

            foreach (Modification mod in AllModsKnown)
            {
                if (!AllModsKnownDictionary.ContainsKey(mod.IdWithMotif))
                {
                    AllModsKnownDictionary.Add(mod.IdWithMotif, mod);
                }
                // no error thrown if multiple mods with this ID are present - just pick one
            }
            ProteaseMods = UsefulProteomicsDatabases.PtmListLoader.ReadModsFromFile(Path.Combine(DataDir, @"Mods", @"ProteaseMods.txt"), out var errors).ToList();
            ProteaseDictionary.Dictionary = ProteaseDictionary.LoadProteaseDictionary(Path.Combine(DataDir, @"ProteolyticDigestion", @"proteases.tsv"), ProteaseMods);
        }
Beispiel #7
0
        public void Setup()
        {
            Loaders.LoadElements();

            Assert.That(Thread.CurrentThread.CurrentCulture == CultureInfo.InvariantCulture);
            Assert.That(Thread.CurrentThread.CurrentUICulture == CultureInfo.InvariantCulture);
        }
        public static void SetUpGlobalVariables()
        {
            Loaders.LoadElements();
            AcceptedDatabaseFormats = new List <string> {
                ".fasta", ".fa", ".xml", ".msp"
            };
            AcceptedSpectraFormats = new List <string> {
                ".raw", ".mzml", ".mgf"
            };
            AnalyteType                = "Peptide";
            _InvalidAminoAcids         = new char[] { 'X', 'B', 'J', 'Z', ':', '|', ';', '[', ']', '{', '}', '(', ')', '+', '-' };
            ExperimentalDesignFileName = "ExperimentalDesign.tsv";
            SeparationTypes            = new List <string> {
                { "HPLC" }, { "CZE" }
            };

            SetMetaMorpheusVersion();
            SetUpDataDirectory();
            LoadCrosslinkers();
            LoadModifications();
            LoadGlycans();
            LoadCustomAminoAcids();
            SetUpGlobalSettings();
            LoadDissociationTypes();
        }
        public static Dictionary <string, List <Modification> > read_mods()
        {
            Loaders.LoadElements();
            List <Modification> all_modifications = Sweet.lollipop.get_files(Sweet.lollipop.input_files, Purpose.PtmList).SelectMany(file => PtmListLoader.ReadModsFromFile(file.complete_path, out List <(Modification, string)> filteredModificationsWithWarnings)).ToList();

            return(Sweet.lollipop.theoretical_database.make_modification_dictionary(all_modifications));
        }
Beispiel #10
0
        public void Modification_read_write_into_proteinDb()
        {
            Loaders.LoadElements(Path.Combine(TestContext.CurrentContext.TestDirectory, "elements2.dat"));
            var sampleModList = PtmListLoader.ReadModsFromFile(Path.Combine(TestContext.CurrentContext.TestDirectory, "z.txt")).ToList();

            Assert.AreEqual(1, sampleModList.OfType <ModificationWithMass>().Count());
            Protein protein = new Protein("MCSSSSSSSSSS", "accession", new List <Tuple <string, string> >(), new Dictionary <int, List <Modification> > {
                { 2, sampleModList.OfType <Modification>().ToList() }
            }, null, "name", "full_name", false, false, new List <DatabaseReference>(), new List <SequenceVariation>(), new List <DisulfideBond>());

            Assert.AreEqual(1, protein.OneBasedPossibleLocalizedModifications[2].OfType <ModificationWithMass>().Count());
            ProteinDbWriter.WriteXmlDatabase(new Dictionary <string, HashSet <Tuple <int, Modification> > >(), new List <Protein> {
                protein
            }, Path.Combine(TestContext.CurrentContext.TestDirectory, "test_modifications_with_proteins.xml"));
            List <Protein> new_proteins = ProteinDbLoader.LoadProteinXML(Path.Combine(TestContext.CurrentContext.TestDirectory, "test_modifications_with_proteins.xml"), true, DecoyType.None, new List <Modification>(), false, new List <string>(), out Dictionary <string, Modification> um);

            Assert.AreEqual(1, new_proteins.Count);
            Assert.AreEqual(1, new_proteins[0].OneBasedPossibleLocalizedModifications.Count);
            Assert.AreEqual(1, new_proteins[0].OneBasedPossibleLocalizedModifications.SelectMany(kv => kv.Value).Count());
            Assert.AreEqual("Type", new_proteins[0].OneBasedPossibleLocalizedModifications.SelectMany(kv => kv.Value).OfType <ModificationWithMass>().First().modificationType);
            Assert.AreEqual("Palmitoylation of C", new_proteins[0].OneBasedPossibleLocalizedModifications[2][0].id);
            Assert.AreEqual(1, new_proteins[0].OneBasedPossibleLocalizedModifications[2].OfType <ModificationWithMass>().Count());

            // Check that Modifications were saved after last load
            Assert.AreEqual(1, ProteinDbLoader.GetPtmListFromProteinXml(Path.Combine(TestContext.CurrentContext.TestDirectory, @"test_modifications_with_proteins.xml")).Count);
            Assert.True(ProteinDbLoader.GetPtmListFromProteinXml(Path.Combine(TestContext.CurrentContext.TestDirectory, @"test_modifications_with_proteins.xml"))[0] == new_proteins[0].OneBasedPossibleLocalizedModifications.SelectMany(kv => kv.Value).First());

            //But that we can still read modifications from other protein XMLs that exist
            Assert.AreEqual(0, ProteinDbLoader.GetPtmListFromProteinXml(Path.Combine(TestContext.CurrentContext.TestDirectory, "xml.xml")).Count);
        }
        /// <summary>
        /// Gets UniProt ptmlist
        /// </summary>
        /// <param name="spritzDirectory"></param>
        /// <returns></returns>
        public static List <Modification> GetUniProtMods(string spritzDirectory)
        {
            Loaders.LoadElements();
            var psiModDeserialized = Loaders.LoadPsiMod(Path.Combine(spritzDirectory, "PSI-MOD.obo.xml"));

            return(Loaders.LoadUniprot(Path.Combine(spritzDirectory, "ptmlist.txt"), Loaders.GetFormalChargesDictionary(psiModDeserialized)).ToList());
        }
Beispiel #12
0
        public void TestUpdateUniprot()
        {
            var uniprotLocation = Path.Combine(TestContext.CurrentContext.TestDirectory, "ptmlist.txt");

            Loaders.UpdateUniprot(uniprotLocation);
            Loaders.UpdateUniprot(uniprotLocation);
        }
Beispiel #13
0
        /// <summary>
        /// Initiates a dynamic connection with a Thermo .raw file. Data can be "streamed" instead of loaded all at once. Use
        /// GetOneBasedScanFromDynamicConnection to get data from a particular scan. Use CloseDynamicConnection to close the
        /// dynamic connection after all desired data has been retrieved from the dynamic connection.
        /// </summary>
        private void InitiateDynamicConnection(string filePath)
        {
            Loaders.LoadElements();

            if (dynamicConnection != null)
            {
                dynamicConnection.Dispose();
            }

            dynamicConnection = RawFileReaderAdapter.FileFactory(filePath);

            if (!File.Exists(filePath))
            {
                throw new FileNotFoundException();
            }

            if (!dynamicConnection.IsOpen)
            {
                throw new MzLibException("Unable to access RAW file!");
            }

            if (dynamicConnection.IsError)
            {
                throw new MzLibException("Error opening RAW file!");
            }

            if (dynamicConnection.InAcquisition)
            {
                throw new MzLibException("RAW file still being acquired!");
            }

            dynamicConnection.SelectInstrument(Device.MS, 1);
            GetMsOrdersByScanInDynamicConnection();
        }
Beispiel #14
0
        public void TestUpdateUnimod()
        {
            var unimodLocation = Path.Combine(TestContext.CurrentContext.TestDirectory, "unimod_tables.xml");

            Loaders.UpdateUnimod(unimodLocation);
            Loaders.UpdateUnimod(unimodLocation);
        }
Beispiel #15
0
        public void TestUpdatePsiMod()
        {
            var psimodLocation = Path.Combine(TestContext.CurrentContext.TestDirectory, "lal.xml");

            Loaders.UpdatePsiMod(psimodLocation);
            Loaders.UpdatePsiMod(psimodLocation);
        }
        public List <Modification> get_mods(string current_directory)
        {
            var psiModDeserialized = Loaders.LoadPsiMod(Path.Combine(current_directory, "Mods", "PSI-MOD.obo.xml"));
            Dictionary <string, int> formalChargesDictionary = Loaders.GetFormalChargesDictionary(psiModDeserialized);

            Loaders.LoadElements();
            List <Modification> all_known_modifications = new List <Modification>();

            foreach (string filename in Directory.GetFiles(Path.Combine(current_directory, "Mods")))
            {
                List <Modification> new_mods = !filename.EndsWith("variable.txt") || Sweet.lollipop.methionine_oxidation ?
                                               PtmListLoader.ReadModsFromFile(filename, formalChargesDictionary, out List <(Modification, string)> filteredModificationsWithWarnings).ToList() :
                                               new List <Modification>(); // Empty variable modifications if not selected
                if (filename.EndsWith("variable.txt"))
                {
                    variableModifications = new_mods;
                }
                if (filename.EndsWith("UniprotGlycanDatabase.txt"))
                {
                    glycan_mods = new_mods;
                    continue;
                }

                all_known_modifications.AddRange(new_mods);
            }
            all_known_modifications = new HashSet <Modification>(all_known_modifications).ToList();
            uniprotModifications    = make_modification_dictionary(all_known_modifications);
            all_mods_with_mass      = uniprotModifications.SelectMany(kv => kv.Value).Concat(variableModifications).ToList();
            return(all_known_modifications);
        }
Beispiel #17
0
        public static void SetUpModifications()
        {
            var psiModDeserialized = Loaders.LoadPsiMod(Path.Combine(TestContext.CurrentContext.TestDirectory, "PSI-MOD.obo2.xml"));
            Dictionary <string, int> formalChargesDictionary = Loaders.GetFormalChargesDictionary(psiModDeserialized);

            UniProtPtms = Loaders.LoadUniprot(Path.Combine(TestContext.CurrentContext.TestDirectory, "ptmlist2.txt"), formalChargesDictionary).ToList();
        }
        public static Dictionary <string, List <Modification> > read_mods()
        {
            Loaders.LoadElements(Path.Combine(TestContext.CurrentContext.TestDirectory, "elements.dat"));
            List <ModificationWithLocation> all_modifications = SaveState.lollipop.get_files(SaveState.lollipop.input_files, Purpose.PtmList).SelectMany(file => PtmListLoader.ReadModsFromFile(file.complete_path)).ToList();

            return(SaveState.lollipop.theoretical_database.make_modification_dictionary(all_modifications));
        }
        public HotReloadAggregateMarkupFileLoader(IMarkupFileChangeNotifier notifier)
        {
            var index         = Loaders.FindIndex(l => l is DefaultMarkupFileLoader);
            var defaultLoader = (DefaultMarkupFileLoader)Loaders[index];

            Loaders[index] = new HotReloadMarkupFileLoader(defaultLoader, notifier);
        }
Beispiel #20
0
        public void DoNotWriteSameModTwiceButWriteInHeaderSinceDifferent()
        {
            Loaders.LoadElements(Path.Combine(TestContext.CurrentContext.TestDirectory, "elements2.dat"));
            var     sampleModList = PtmListLoader.ReadModsFromFile(Path.Combine(TestContext.CurrentContext.TestDirectory, "z.txt")).ToList();
            Protein protein       = new Protein("MCSSSSSSSSSS", "accession", new List <Tuple <string, string> >(), new Dictionary <int, List <Modification> > {
                { 2, sampleModList.OfType <Modification>().ToList() }
            }, null, "name", "full_name", false, false, new List <DatabaseReference>(), new List <SequenceVariation>(), new List <DisulfideBond>());

            Assert.AreEqual(1, protein.OneBasedPossibleLocalizedModifications[2].OfType <ModificationWithMass>().Count());

            Dictionary <string, HashSet <Tuple <int, Modification> > > dictWithThisMod = new Dictionary <string, HashSet <Tuple <int, Modification> > >();

            HashSet <Tuple <int, Modification> > value = new HashSet <Tuple <int, Modification> >();

            ModificationMotif.TryGetMotif("C", out ModificationMotif motif);
            ModificationWithMass newMod = new ModificationWithMass("Palmitoylation of C", "mt", motif, TerminusLocalization.Any, double.NaN, null, null);

            Assert.AreNotEqual(newMod, sampleModList.First());

            value.Add(new Tuple <int, Modification>(2, newMod));

            dictWithThisMod.Add("accession", value);

            var newModResEntries = ProteinDbWriter.WriteXmlDatabase(dictWithThisMod, new List <Protein> {
                protein
            }, Path.Combine(TestContext.CurrentContext.TestDirectory, "test_modifications_with_proteins2.xml"));

            Assert.AreEqual(0, newModResEntries.Count);
            List <Protein> new_proteins = ProteinDbLoader.LoadProteinXML(Path.Combine(TestContext.CurrentContext.TestDirectory, "test_modifications_with_proteins2.xml"), true, DecoyType.None, new List <Modification>(), false, new List <string>(), out Dictionary <string, Modification> um);

            Assert.AreEqual(1, new_proteins.Count);
            Assert.AreEqual(1, new_proteins[0].OneBasedPossibleLocalizedModifications.Count);
            Assert.AreEqual(2, new_proteins[0].OneBasedPossibleLocalizedModifications.SelectMany(kv => kv.Value).Count());
        }
Beispiel #21
0
 public void FilesLoading()
 {
     Loaders.LoadElements(Path.Combine(TestContext.CurrentContext.TestDirectory, "elements.dat"));
     Loaders.LoadUnimod(Path.Combine(TestContext.CurrentContext.TestDirectory, "unimod_tables.xml"));
     Loaders.LoadPsiMod(Path.Combine(TestContext.CurrentContext.TestDirectory, "PSI-MOD.obo.xml"));
     Loaders.LoadUniprot(Path.Combine(TestContext.CurrentContext.TestDirectory, "ptmlist.txt"));
 }
Beispiel #22
0
        public void load_save_unlocalized()
        {
            Loaders.LoadElements();
            TheoreticalProteoformDatabase tpd  = new TheoreticalProteoformDatabase();
            List <Modification>           mods = PtmListLoader.ReadModsFromFile(Path.Combine(TestContext.CurrentContext.TestDirectory, "Mods", "ptmlist.txt"), out List <(Modification, string)> filteredModificationsWithWarnings).ToList();

            foreach (Modification m in mods)
            {
                if (!Sweet.lollipop.modification_ranks.TryGetValue(Math.Round((double)m.MonoisotopicMass, 5), out int x))
                {
                    Sweet.lollipop.modification_ranks.Add(Math.Round((double)m.MonoisotopicMass, 5), -1);
                }
            }
            tpd.unlocalized_lookup = tpd.make_unlocalized_lookup(mods);
            tpd.load_unlocalized_names(Path.Combine(TestContext.CurrentContext.TestDirectory, "Mods", "stored_mods.modnames"));
            tpd.save_unlocalized_names(Path.Combine(TestContext.CurrentContext.TestDirectory, "Mods", "fake_stored_mods.modnames"));
            Modification firstAcetyl = mods.FirstOrDefault(x => x.OriginalId.StartsWith("N-acetyl"));

            Assert.AreNotEqual(firstAcetyl.OriginalId, tpd.unlocalized_lookup[firstAcetyl].id);

            //Test amending
            mods.AddRange(PtmListLoader.ReadModsFromFile(Path.Combine(TestContext.CurrentContext.TestDirectory, "Mods", "intact_mods.txt"), out filteredModificationsWithWarnings).OfType <Modification>());
            Sweet.lollipop.modification_ranks = mods.DistinctBy(m => m.MonoisotopicMass).ToDictionary(m => Math.Round((double)m.MonoisotopicMass, 5), m => - 1);
            tpd.unlocalized_lookup            = tpd.make_unlocalized_lookup(mods.OfType <Modification>());
            tpd.amend_unlocalized_names(Path.Combine(TestContext.CurrentContext.TestDirectory, "Mods", "fake_stored_mods.modnames"));
        }
            public override bool MatchType(Loaders loaders, string name, string type, string id)
            {
                string foo;
                int    bar;

                return(NameSizeFromType(type, out foo, out bar));
            }
Beispiel #24
0
        /// <summary>
        /// Requires at least one ProteinDatabase input file and one input file listing modifications.
        /// </summary>
        /// <returns></returns>
        public bool ready_to_make_database(string current_directory)
        {
            Loaders.LoadElements();
            List <InputFile> proteinDbs = Sweet.lollipop.get_files(Sweet.lollipop.input_files, Purpose.ProteinDatabase).ToList();

            return(proteinDbs.Count > 0 &&
                   (proteinDbs.Any(file => file.extension == ".xml" && ProteinDbLoader.GetPtmListFromProteinXml(file.complete_path).Count > 0) ||
                    Sweet.lollipop.get_files(Sweet.lollipop.input_files, Purpose.PtmList).Count() > 0));
        }
Beispiel #25
0
        /// <summary>
        /// Allow to add custom loader to the internal list
        /// </summary>
        /// <param name="loader">Loader to add</param>
        public void AddLoader(ILoader loader)
        {
            loader.AllocInstruments += AllocInstruments;
            loader.AllocPatterns    += AllocPatterns;
            loader.AllocSamples     += AllocSamples;
            loader.AllocTracks      += AllocTracks;

            Loaders.Add(loader);
        }
        public void TestUpdateElements()
        {
            var elementLocation = Path.Combine(TestContext.CurrentContext.TestDirectory, "lal.dat");

            Loaders.UpdateElements(elementLocation);
            Loaders.UpdateElements(elementLocation);
            Assert.IsTrue(PeriodicTable.ValidateAbundances(1e-15));
            Assert.IsTrue(PeriodicTable.ValidateAverageMasses(1e-2));
        }
        /// <summary>
        /// Requires at least one ProteinDatabase input file and one input file listing modifications.
        /// </summary>
        /// <returns></returns>
        public bool ready_to_make_database(string current_directory)
        {
            Loaders.LoadElements(Path.Combine(current_directory, "elements.dat"));
            List <InputFile> proteinDbs = SaveState.lollipop.get_files(SaveState.lollipop.input_files, Purpose.ProteinDatabase).ToList();

            return(proteinDbs.Count > 0 &&
                   (proteinDbs.Any(file => ProteinDbLoader.GetPtmListFromProteinXml(file.complete_path).Count > 0) ||
                    SaveState.lollipop.get_files(SaveState.lollipop.input_files, Purpose.PtmList).Count() > 0));
        }
Beispiel #28
0
        public WebLoader GetLoader(string url, string savePath)
        {
            WebLoader loader = Loaders.Find((t) =>
            {
                return((t.Url == url) && (t.SavePath == savePath));
            });

            return(loader);
        }
Beispiel #29
0
        public static void TestPeakSplittingRight()
        {
            string fileToWrite = "myMzml.mzML";
            string peptide     = "PEPTIDE";
            double intensity   = 1e6;

            Loaders.LoadElements(Path.Combine(TestContext.CurrentContext.TestDirectory, @"elements.dat"));

            // generate mzml file

            // 1 MS1 scan per peptide
            MsDataScan[] scans = new MsDataScan[10];
            double[]     intensityMultipliers = { 1, 3, 5, 10, 5, 3, 1, 1, 3, 1 };

            for (int s = 0; s < scans.Length; s++)
            {
                ChemicalFormula      cf          = new Proteomics.AminoAcidPolymer.Peptide(peptide).GetChemicalFormula();
                IsotopicDistribution dist        = IsotopicDistribution.GetDistribution(cf, 0.125, 1e-8);
                double[]             mz          = dist.Masses.Select(v => v.ToMz(1)).ToArray();
                double[]             intensities = dist.Intensities.Select(v => v * intensity * intensityMultipliers[s]).ToArray();

                // add the scan
                scans[s] = new MsDataScan(massSpectrum: new MzSpectrum(mz, intensities, false), oneBasedScanNumber: s + 1, msnOrder: 1, isCentroid: true,
                                          polarity: Polarity.Positive, retentionTime: 1.0 + s / 10.0, scanWindowRange: new MzRange(400, 1600), scanFilter: "f",
                                          mzAnalyzer: MZAnalyzerType.Orbitrap, totalIonCurrent: intensities.Sum(), injectionTime: 1.0, noiseData: null, nativeId: "scan=" + (s + 1));
            }

            // write the .mzML
            IO.MzML.MzmlMethods.CreateAndWriteMyMzmlWithCalibratedSpectra(new FakeMsDataFile(scans),
                                                                          Path.Combine(TestContext.CurrentContext.TestDirectory, fileToWrite), false);

            // set up spectra file info
            SpectraFileInfo file1 = new SpectraFileInfo(Path.Combine(TestContext.CurrentContext.TestDirectory, fileToWrite), "", 0, 0, 0);

            // create some PSMs
            var pg = new ProteinGroup("MyProtein", "gene", "org");

            Identification id1 = new Identification(file1, peptide, peptide,
                                                    new Proteomics.AminoAcidPolymer.Peptide(peptide).MonoisotopicMass, 1.3 + 0.001, 1, new List <ProteinGroup> {
                pg
            });

            // create the FlashLFQ engine
            FlashLFQEngine engine = new FlashLFQEngine(new List <Identification> {
                id1
            });

            // run the engine
            var results = engine.Run();
            ChromatographicPeak peak = results.Peaks.First().Value.First();

            Assert.That(peak.Apex.RetentionTime == 1.3);
            Assert.That(peak.SplitRT == 1.6);
            Assert.That(!peak.IsotopicEnvelopes.Any(p => p.RetentionTime > 1.6));
            Assert.That(peak.IsotopicEnvelopes.Count == 6);
        }
Beispiel #30
0
        public async Task Init()
        {
            await Loaders.Load();

            await Localization.Init();

            GoodState = new GoodState(await Loaders.GoodsLoader.Load());
            Countries = Country.GetAllCountries(this);
            Buildings = Building.Bootstrap(this, await Loaders.BuildingLoader.Load());
        }
Beispiel #31
0
        internal VGFont(VGDevice device, Loaders.VGFontData fontData, VGFontMode mode)
            : this(device, fontData.FillRule, fontData.EmSquareSize, fontData.LeadingSize)
        {
            _maxGlyphExtents = fontData.Extents;

            KerningTable = fontData.Kerning;
            FontMode = mode;
            if (mode == VGFontMode.CPU)
            {
                _bufferedGlyphs = new VertexBuffer(device.GraphicsDevice, StencilVertex.VertexDeclaration, fontData.Vertices.Length, BufferUsage.WriteOnly);
                _bufferedGlyphs.SetData(fontData.Vertices);
            }
            else
            {
                int h = fontData.Vertices.Length / device.MaxTextureSize;
                int s = device.MaxTextureSize * h;
                Vertices = new Texture2D(device.GraphicsDevice, device.MaxTextureSize, 1 + h, false, SurfaceFormat.Vector4);
                if (h > 0) Vertices.SetData(0, new Rectangle(0, 0, device.MaxTextureSize, h), fontData.Vertices, 0, s);
                Vertices.SetData(0, new Rectangle(0, h, fontData.Vertices.Length - s, 1), fontData.Vertices, s, fontData.Vertices.Length - s);
            }

            foreach(var def in fontData.Glyphs)
                _glyphs[def.Character] = new BufferGlyph(_bufferedGlyphs, def.Offset, def.Triangles, def.Escape);
        }