public void TestAveragine() { var methodName = MethodBase.GetCurrentMethod().Name; Utils.ShowStarting(methodName); //for (var nominalMass = 1000; nominalMass <= 1000; nominalMass++) //{ // Console.WriteLine("{0}\t{1}", nominalMass, // string.Join(",", Averagine.GetIsotopomerEnvelopeFromNominalMass(nominalMass).Envelope.Select(v => string.Format("{0:f3}", v)))); //} for (var nominalMass = 1000; nominalMass <= 50000; nominalMass++) { var averagine = Averagine.GetIsotopomerEnvelopeFromNominalMass(nominalMass); } }
/// <summary> /// Initializes a new instance of the MainWindowViewModel class. /// </summary> /// <param name="dialogService">Service for view model friendly dialogs</param> /// <param name="dataReader">Service for reading raw files, id files, and feature files</param> public MainWindowViewModel(IMainDialogService dialogService, IDataReader dataReader) { this.dialogService = dialogService; this.dataReader = dataReader; // Initialize child view models DataSets = new ReactiveList <DataSetViewModel> { ChangeTrackingEnabled = true }; CreateSequenceViewModel = new CreateSequenceViewModel(this.dialogService); ScanViewModel = new ScanViewModel(this.dialogService, new List <PrSm>()); // Remove filter by unidentified scans from ScanViewModel filters ScanViewModel.Filters.Remove(ScanViewModel.Filters.FirstOrDefault(f => f.Name == "Hide Unidentified Scans")); // Create commands for file operations OpenDataSetCommand = ReactiveCommand.CreateFromTask(async _ => await OpenDataSetImplementation()); OpenRawFileCommand = ReactiveCommand.CreateFromTask(async _ => await OpenRawFileImplementation()); OpenTsvFileCommand = ReactiveCommand.CreateFromTask(async _ => await OpenIdFileImplementation()); OpenFeatureFileCommand = ReactiveCommand.CreateFromTask(async _ => await OpenFeatureFileImplementation()); OpenFromDmsCommand = ReactiveCommand.CreateFromTask(async _ => await OpenFromDmsImplementation()); // Create command to open settings window OpenSettingsCommand = ReactiveCommand.Create(() => this.dialogService.OpenSettings(new SettingsViewModel(this.dialogService))); // Create command to open isotopic profile viewer OpenIsotopicProfileViewerCommand = ReactiveCommand.Create(OpenIsotopicProfileViewer); //this.OpenIsotopicProfileViewer(new object()); // Create command to open about box OpenAboutBoxCommand = ReactiveCommand.Create(() => this.dialogService.OpenAboutBox()); // Create command to open new modification management window OpenManageModificationsCommand = ReactiveCommand.Create(ManageModificationsImplementation); // Create MSPathFinder search command RunMsPathFinderSearchCommand = ReactiveCommand.Create(RunMsPathFinderSearchImplementation); // Create export command ExportResultsCommand = ReactiveCommand.Create(ExportResultsImplementation, DataSets.WhenAnyValue(x => x.Count).Select(count => count > 0)); // Create export command QuitProgramCommand = ReactiveCommand.Create(() => this.dialogService.QuitProgram()); ShowSplash = true; // When a data set sets its ReadyToClose property to true, remove it from dataset list DataSets.ItemChanged.Where(x => x.PropertyName == "ReadyToClose") .Select(x => x.Sender).Where(sender => sender.ReadyToClose) .Subscribe(dataSet => { ScanViewModel.RemovePrSmsFromRawFile(dataSet.Title); DataSets.Remove(dataSet); }); // If all datasets are closed, show splash screen DataSets.BeforeItemsRemoved.Subscribe(x => ShowSplash = DataSets.Count == 1); // If a dataset is opened, show splash screen DataSets.BeforeItemsAdded.Subscribe(x => ShowSplash = false); // When the data reader is reading an ID file, show the loading screen this.dataReader.WhenAnyValue(x => x.ReadingIdFiles) .Subscribe(readingIdFiles => IdFileLoading = readingIdFiles); // When a PrSm is selected in the Protein Tree, make all data sets show the PrSm ScanViewModel.WhenAnyValue(x => x.SelectedPrSm) .Where(selectedPrSm => selectedPrSm != null) .Subscribe(selectedPrSm => { foreach (var dataSet in DataSets) { dataSet.SelectedPrSm = selectedPrSm; } }); // Warm up InformedProteomics Averagine using arbitrary mass Task.Run(() => Averagine.GetIsotopomerEnvelopeFromNominalMass(50000)); }