Exemplo n.º 1
0
        public void TestDisplaySpectra(string rawFile, string idFile)
        {
            // init
            var idFileReader = IdFileReaderFactory.CreateReader(idFile);
            var ids          = idFileReader.Read();
            var lcms         = PbfLcMsRun.GetLcMsRun(rawFile);
            var idList       = ids.ToList();

            foreach (var id in idList)
            {
                id.LcMs        = lcms;
                id.RawFileName = Path.GetFileNameWithoutExtension(rawFile);
            }
            idList.Sort(new PrSm.PrSmScoreComparer());

            var prsm = idList[0];

            // init XicPlotViewModel
            var dialogService     = new TestableMainDialogService();
            var spectrumViewModel = new SpectrumViewModel(dialogService, lcms);

            // init test ions
            var baseIonTypes = new List <BaseIonType> {
                BaseIonType.B, BaseIonType.Y
            };
            var neutralLosses = new List <NeutralLoss> {
                NeutralLoss.NoLoss
            };
            const int charge = 1;
            const int minCharge = 1, maxCharge = 2;
            var       ionTypeFactory = new IonTypeFactory(maxCharge);
            var       ionTypes       = IonUtils.GetIonTypes(ionTypeFactory, baseIonTypes, neutralLosses, minCharge, maxCharge);
            var       ions           = IonUtils.GetFragmentIonLabels(prsm.Sequence, charge, ionTypes);
            var       ionVms         = ions.Select(label => new LabeledIonViewModel(label.Composition, label.IonType, label.IsFragmentIon, lcms, label.PrecursorIon, label.IsChargeState, label.Index)).ToList();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets selected ion types based on the selected BaseIonTypes and NeutralLosses.
        /// </summary>
        /// <returns>Array of IonTypes.</returns>
        private IonType[] GetIonTypes()
        {
            var charge = Math.Min(this.fragmentationSequence.Charge - 1, 100);

            charge = Math.Max(charge, 1);

            return(IonUtils.GetIonTypes(
                       IcParameters.Instance.IonTypeFactory,
                       this.BaseIonTypes.Where(bit => bit.IsSelected).Select(bit => bit.BaseIonType).ToList(),
                       this.NeutralLosses.Where(nl => nl.IsSelected).Select(nl => nl.NeutralLoss).ToList(),
                       1,
                       charge).ToArray());
        }
Exemplo n.º 3
0
        /// <summary>
        /// Update ion types based on selected base ion types, selected neutral losses, and charge range.
        /// </summary>
        private void UpdateIonTypes()
        {
            // set ion types
            var selectedBase   = this.SelectedBaseIonTypes.Cast <BaseIonType>().ToList();
            var selectedLosses = this.SelectedNeutralLosses.Cast <NeutralLoss>().ToList();

            this.IonTypes =
                new ReactiveList <IonType>(
                    IonUtils.GetIonTypes(
                        IcParameters.Instance.IonTypeFactory,
                        selectedBase,
                        selectedLosses,
                        this.MinCharge,
                        this.MaxCharge));
        }