示例#1
0
        public List <string> Sequences(string sequence, FilterSequence filter)
        {
            List <string> pepList        = new List <string>();
            List <int>    cutOffPosition = FindCutOffPosition(sequence);
            //generate substring from sequences
            int start, end;

            for (int i = 0; i <= miss_cleavage_; i++)
            {
                for (int j = 0; j < cutOffPosition.Count - i - 1; j++)
                {
                    start = cutOffPosition[j] + 1;
                    end   = cutOffPosition[j + 1 + i];
                    if (end - start + 1 >= min_length_)  // put minimum length in place
                    {
                        string sub = sequence.Substring(start, end - start + 1);
                        if (filter(sub))
                        {
                            pepList.Add(sub);
                        }
                    }
                }
            }
            return(pepList);
        }
示例#2
0
        public void IsAtEnd_Test()
        {
            var target = new FilterSequence <int>(
                new ListSequence <int>(
                    new[] { 1, 2, 3 },
                    0
                    ),
                x => x % 2 == 0
                );

            target.IsAtEnd.Should().BeFalse();
            target.GetNext().Should().Be(2);
            target.IsAtEnd.Should().BeTrue();
        }
示例#3
0
        public void GetNext_Test()
        {
            var target = new FilterSequence <int>(
                new ListSequence <int>(
                    new[] { 1, 2, 3, 4, 5, 6 },
                    0
                    ),
                x => x % 2 == 0
                );

            target.GetNext().Should().Be(2);
            target.GetNext().Should().Be(4);
            target.GetNext().Should().Be(6);
            target.GetNext().Should().Be(0);
        }
示例#4
0
        public void Checkpoint_Test()
        {
            var target = new FilterSequence <char>(
                "aBcDeFgH".ToCharacterSequence(),
                x => char.IsUpper(x)
                );

            target.GetNext().Should().Be('B');
            var cp = target.Checkpoint();

            target.GetNext().Should().Be('D');
            target.GetNext().Should().Be('F');
            target.GetNext().Should().Be('H');
            target.GetNext().Should().Be('\0');
            cp.Rewind();
            target.GetNext().Should().Be('D');
            target.GetNext().Should().Be('F');
            target.GetNext().Should().Be('H');
            target.GetNext().Should().Be('\0');
        }
示例#5
0
            public IEnumerable <object> Get(FilterSequence sequence)
            {
                switch (sequence)
                {
                case FilterSequence.Before:
                {
                    return(_before);
                }

                case FilterSequence.After:
                {
                    return(_after);
                }

                default:
                {
                    return(_actual);
                }
                }
            }
示例#6
0
        public static HashSet <string> DynamicModification(HashSet <string> peptides,
                                                           FilterSequence filter, bool oxidation = true, bool deamidation = true)
        {
            HashSet <string> peptideModifieds = new HashSet <string>();

            if (oxidation)
            {
                peptides = Oxidation(peptides);
            }
            if (deamidation)
            {
                peptides = Deamidation(peptides);
            }

            foreach (string peptide in peptides)
            {
                if (filter(peptide))
                {
                    peptideModifieds.Add(peptide);
                }
            }

            return(peptideModifieds);
        }
示例#7
0
        public MainViewModel()
        {
            ProgressBarValue = 0;
            ProgressBarInfo  = "";


            FileManager.OnChange += FileMng_OnChange;

            foreach (var filterName in GraphFilter.GetFilterNames())
            {
                FilterToAdd.Add(new ComboBoxItem()
                {
                    Content = filterName
                });
            }
            SelectAddFilter = FilterToAdd[0];

            var bitmap = new Bitmap(@"Res\default.png");

            SetImageSource(bitmap, "default.png");

            LoadFilter = graphFilter.Add(FilterType.File, "MainFile");
            FilterSequence.Add(LoadFilter);

            bitmap.Dispose();


            ExportButton = new SyncButtonViewModel()
            {
                Text     = "Export",
                Enabled  = true,
                PressCmd = async(SyncButtonViewModel button) =>
                {
                    if (!m_exportInProgress)
                    {
                        button.Enabled = false;
                        ExportDlgView  dlg      = new ExportDlgView();
                        ExportDlgModel dlgModel = new ExportDlgModel(dlg, "export_settigs.xml");
                        dlg.DataContext = dlgModel;
                        var res = dlg.ShowDialog();

                        button.Enabled = true;

                        if (res == true)
                        {
                            m_exportInProgress = true;
                            button.Text        = "Cancel";

                            ExportSettings exportSettings = dlgModel.Result;


                            await Task.Run(() =>
                            {
                                int totalCnt = FileManager.FileListInfo.Count;
                                for (int infoId = 0; m_exportInProgress && (infoId < totalCnt); infoId++)
                                {
                                    string infoStr = FileManager.FileListInfo[infoId].Info;

                                    App.Current.Dispatcher.Invoke(() =>
                                    {
                                        ProgressBarValue = (100 * infoId) / totalCnt;
                                        ProgressBarInfo  = infoStr;
                                    });

                                    ExportGraphFilterResult(infoId, infoStr, exportSettings);
                                }
                            });

                            ProgressBarValue   = 0;
                            m_exportInProgress = false;
                            button.Text        = "Export";
                        }
                    }
                    else
                    {
                        m_exportInProgress = false;
                        ProgressBarValue   = 0;
                    }
                }
            };
        }