public void UpdateDatasets() { Datasets.Clear(); foreach (var info in m_analysis.MetaData.Datasets) { var viewmodel = new DatasetInformationViewModel(info); Datasets.Add(viewmodel); } }
public PeptideViewModel(Peptide peptide) { m_peptide = peptide; var info = SingletonDataProviders.GetDatasetInformation(peptide.GroupId); if (info != null) { m_dataset = new DatasetInformationViewModel(info); } MatchedProteins = new ObservableCollection <ProteinViewModel>(); LoadProteinData(peptide); }
/// <summary> /// Implementation for <see cref="AddDatasetCommand" />. /// </summary> private void AddDatasetImpl() { var openFileDialog = new OpenFileDialog { Multiselect = true, DefaultExt = ".raw|.pbf|.csv|.ms1ft", Filter = DatasetLoader.SupportedFileFilter }; if (!string.IsNullOrWhiteSpace(this.LastInputDirectory)) { openFileDialog.InitialDirectory = this.LastInputDirectory; } else { openFileDialog.InitialDirectory = this.userDocuments; } var result = openFileDialog.ShowDialog(); if (result != true) { return; } var filePaths = openFileDialog.FileNames; var datasets = this.GetAndValidateDatasets(filePaths); if (datasets.Count == 0) { return; } this.LastInputDirectory = Path.GetDirectoryName(filePaths.First()); foreach (var dataset in datasets) { var datasetInformationViewModel = new DatasetInformationViewModel(dataset); datasetInformationViewModel.RemovalRequested += (s, e) => this.Datasets.Remove(datasetInformationViewModel); this.Datasets.Add(datasetInformationViewModel); this.CreateCommand.RaiseCanExecuteChanged(); } }
public MsSpectraViewModel(MSSpectra spectrum) { Peptides = new ObservableCollection <PeptideViewModel>(); spectrum.Peptides.ForEach(x => Peptides.Add(new PeptideViewModel(x))); var info = SingletonDataProviders.GetDatasetInformation(spectrum.GroupId); if (info != null) { Dataset = new DatasetInformationViewModel(info); } Spectrum = spectrum; SelectedSpectrumPlotModel = new MsMsSpectraViewModel(spectrum, ""); if (spectrum.ParentFeature != null) { var msFeature = spectrum.ParentFeature; var umc = msFeature.GetParentFeature(); if (umc != null) { var newList = new List <UMCLight> { umc }; var xic = new XicViewModel(newList, "xic") { Model = { IsLegendVisible = false, TitleFontSize = 0 } }; SelectedSpectrumXic = xic; } } }
public async Task UpdateDatasets() { this.Datasets.Clear(); var i = 0; foreach (var info in this.Analysis.MetaData.Datasets) { info.DatasetId = i++; SingletonDataProviders.AddDataset(info); var viewmodel = new DatasetInformationViewModel(info); viewmodel.RemovalRequested += (s, e) => { var vm = s as DatasetInformationViewModel; if (vm != null) { var result = MessageBox.Show( string.Format("Are you sure that you'd like to remove {0}", vm.Dataset.DatasetName), "Remove Dataset?", MessageBoxButton.YesNo); if (result == MessageBoxResult.Yes) { this.Datasets.Remove(vm); this.Analysis.MetaData.Datasets.Remove(vm.Dataset); this.deletedDatasets.Add(vm.Dataset); } } }; viewmodel.StateChanged += (s, e) => this.UpdateProject(); this.Datasets.Add(viewmodel); } await this.LoadRawData(this.Datasets); this.RaisePropertyChanged("analysisConfig"); }
public AnalysisDatasetSelectionViewModel(MultiAlignAnalysis analysis) { m_inputFileFilter = "Input Files (*.txt)| *.txt| All Files (*.*)|*.*"; m_featureFileFilter = DatasetFilterFactory.BuildFileFilters(InputFileType.Features); m_openFileDialog = new OpenFileDialog { Filter = m_inputFileFilter }; m_analysis = analysis; ShouldSearchSubDirectories = SearchOption.TopDirectoryOnly; // Create The Dataset View Model for Binding Datasets = new ObservableCollection <DatasetInformationViewModel>(); foreach (var information in analysis.MetaData.Datasets) { var info = new DatasetInformationViewModel(information); info.Selected += info_Selected; Datasets.Add(info); } // Route the events here... AddFolderCommand = new BaseCommand(AddFolderDelegate, BaseCommand.AlwaysPass); AddInputFileCommand = new BaseCommand(AddInputFileDelegate, BaseCommand.AlwaysPass); AddSingleFileCommand = new BaseCommand(AddSingleFileDelegate, BaseCommand.AlwaysPass); BrowseSingleFileCommand = new BaseCommand(BrowseSingleFile, BaseCommand.AlwaysPass); BrowseInputFileCommand = new BaseCommand(BrowseInput, BaseCommand.AlwaysPass); BrowseDataFolderCommand = new BrowseFolderCommand(x => { DataFolderPath = x; }); RemoveSelectedCommand = new BaseCommand(RemoveSelected, BaseCommand.AlwaysPass); SelectAllCommand = new BaseCommand(SelectAllDelegate, BaseCommand.AlwaysPass); SelectNoneCommand = new BaseCommand(SelectNoneDelegate, BaseCommand.AlwaysPass); SelectedDatasets = new ObservableCollection <DatasetInformationViewModel>(); }
public DatasetResolveMatchViewModel(DatasetInformationViewModel model, string newPath) { NewPath = newPath; Dataset = model; IsSelected = true; }
public DatasetResolveMatchViewModel(DatasetInformationViewModel model, string newPath) { NewPath = newPath; Dataset = model; IsSelected = true; }
/// <summary> /// Initializes a new instance of the <see cref="AlignmentSettingsViewModel"/> class. /// </summary> /// <param name="analysis">The analysis information to run alignment on.</param> /// <param name="datasets">List of all potential datasets to run alignment on.</param> /// <param name="alignmentWindowFactory"> /// Factory for creating windows related to alignment (such as alignment plot windows). /// </param> public AlignmentSettingsViewModel(MultiAlignAnalysis analysis, ObservableCollection <DatasetInformationViewModel> datasets, IAlignmentWindowFactory alignmentWindowFactory = null) { this.analysis = analysis; this.Datasets = datasets; if (analysis.MetaData.BaselineDataset != null) { // Don't set baseline if there are no files to choose from yet this.selectedBaseline = datasets.First(x => x.Name == analysis.MetaData.BaselineDataset.DatasetName); } this.alignmentWindowFactory = alignmentWindowFactory ?? new AlignmentViewFactory(); this.aligner = new LCMSFeatureAligner(); this.builder = new AlgorithmBuilder(); this.CalibrationOptions = new ObservableCollection <LcmsWarpAlignmentType>(Enum.GetValues(typeof(LcmsWarpAlignmentType)).Cast <LcmsWarpAlignmentType>()); this.AlignmentAlgorithms = new ObservableCollection <FeatureAlignmentType>( Enum.GetValues(typeof(FeatureAlignmentType)).Cast <FeatureAlignmentType>()); this.alignmentInformation = new List <AlignmentData>(); this.DatabaseSelectionViewModel = DatabaseSelectionViewModel.Instance; // When dataset is selected/unselected, update CanExecutes for alignment and plotting commands. this.MessengerInstance.Register <PropertyChangedMessage <bool> >( this, args => { if (args.Sender is DatasetInformationViewModel && args.PropertyName == "IsSelected") { ThreadSafeDispatcher.Invoke(() => this.AlignCommand.RaiseCanExecuteChanged()); ThreadSafeDispatcher.Invoke(() => this.DisplayAlignmentCommand.RaiseCanExecuteChanged()); ThreadSafeDispatcher.Invoke(() => this.SaveAlignmentPlotsCommand.RaiseCanExecuteChanged()); } }); // When dataset state changes, update CanExecutes for alignment and plotting commands. this.MessengerInstance.Register <PropertyChangedMessage <DatasetInformationViewModel.DatasetStates> >( this, args => { if (args.Sender is DatasetInformationViewModel && args.PropertyName == "DatasetState") { ThreadSafeDispatcher.Invoke(() => this.AlignCommand.RaiseCanExecuteChanged()); ThreadSafeDispatcher.Invoke(() => this.DisplayAlignmentCommand.RaiseCanExecuteChanged()); ThreadSafeDispatcher.Invoke(() => this.SaveAlignmentPlotsCommand.RaiseCanExecuteChanged()); } }); // When database server is selected, update CanExecute for the alignment command. this.MessengerInstance.Register <PropertyChangedMessage <DmsDatabaseServerViewModel> >( this, args => { if (args.Sender is DatabaseSelectionViewModel && args.PropertyName == "SelectedDatabase") { ThreadSafeDispatcher.Invoke(() => this.AlignCommand.RaiseCanExecuteChanged()); } }); this.AlignCommand = new RelayCommand(this.AsyncAlign, this.CanAlign); // Executable if the selected files are aligned and alignment information is available. this.DisplayAlignmentCommand = new RelayCommand( this.DisplayAlignment, () => this.Datasets.Any(file => file.IsAligned && file.IsSelected && this.alignmentInformation.Any(data => data.DatasetID == file.DatasetId))); // Executable if the selected files are aligned and alignment information is available. this.SaveAlignmentPlotsCommand = new RelayCommand( this.SaveAlignmentPlots, () => this.Datasets.Any(file => file.IsAligned && file.IsSelected && this.alignmentInformation.Any(data => data.DatasetID == file.DatasetId))); this.RestoreDefaultsCommand = new RelayCommand(this.RestoreDefaults); }