Example #1
0
        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.ParentFeature;
                if (umc != null)
                {
                    var newList = new List<UMCLight> {umc};

                    var xic = new XicViewModel(newList, "xic")
                    {
                        Model =
                        {
                            IsLegendVisible = false,
                            TitleFontSize = 0
                        }
                    };

                    SelectedSpectrumXic = xic;
                }
            }
        }
        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>();
        }
Example #3
0
        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);
        }
 public void UpdateDatasets()
 {
     Datasets.Clear();
     foreach (var info in m_analysis.MetaData.Datasets)
     {
         var viewmodel = new DatasetInformationViewModel(info);
         Datasets.Add(viewmodel);
     }
 }
Example #5
0
 public void UpdateDatasets()
 {
     Datasets.Clear();
     foreach (var info in Analysis.MetaData.Datasets)
     {
         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);
                 }
             }
         };
         Datasets.Add(viewmodel);
     }
 }
Example #6
0
        /// <summary>
        /// Implementation for <see cref="AddDatasetCommand" />.
        /// </summary>
        private void AddDatasetImpl()
        {
            var openFileDialog = new OpenFileDialog
            {
                Multiselect = true,
                DefaultExt = ".raw|.csv",
                Filter = @"Supported Files|*.raw;*.csv;|Raw Files (*.raw)|*.raw|CSV Files (*.csv)|*.csv;"
            };

            var result = openFileDialog.ShowDialog();
            if (result != null && result.Value)
            {
                var filePaths = openFileDialog.FileNames;
                var allFilesSelected = filePaths.Any(file => file.EndsWith(".raw")) &&
                                       filePaths.Any(file => file.EndsWith("_isos.csv")) &&
                                       filePaths.Any(file => file.EndsWith("_scans.csv"));
                if (!allFilesSelected)
                {
                    var statusMessage =
                        "MultiAlign Rogue requires at least a .raw file, an isos file, and a scans file.";
                    ApplicationStatusMediator.SetStatus(statusMessage);
                    MessageBox.Show(statusMessage);
                    return;
                }

                var datasets = DatasetInformation.ConvertInputFilesIntoDatasets(this.GetInputFilesFromPath(filePaths));
                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();
                }
            }
        }