Esempio n. 1
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (Client != null ? Client.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (IntensityModel != null ? IntensityModel.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (RTModel != null ? RTModel.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Settings != null ? Settings.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Precursor != null ? Precursor.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Peptide != null ? Peptide.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ NCE;
         return(hashCode);
     }
 }
Esempio n. 2
0
            public override PrositHelpers.PrositRequest Predict()
            {
                ActionUtil.RunAsync(() =>
                {
                    try
                    {
                        var labelType = Precursor.LabelType;
                        var ms        = IntensityModel.PredictSingle(Client, Settings,
                                                                     new PrositIntensityModel.PeptidePrecursorNCE(Peptide, Precursor, labelType, NCE), _tokenSource.Token);

                        var iRTMap = RTModel.PredictSingle(Client,
                                                           Settings,
                                                           Peptide, _tokenSource.Token);

                        var spectrumInfo = new SpectrumInfoProsit(ms, Precursor, labelType, NCE);
                        var irt          = iRTMap[Peptide];
                        Spectrum         = new SpectrumDisplayInfo(
                            spectrumInfo, Precursor, irt);
                    }
                    catch (Exception ex)
                    {
                        Exception = ex;

                        // Ignore, UpdateUI is already working on a new request,
                        // so don't even update UI
                        if (ex.InnerException is RpcException rpcEx && rpcEx.StatusCode == StatusCode.Cancelled)
                        {
                            return;
                        }
                    }

                    // Bad timing could cause the ping to finish right when we cancel as the form closes
                    // causing a UI update to be called after the form was destroyed
                    if (!_tokenSource.IsCancellationRequested)
                    {
                        _updateCallback.Invoke();
                    }
                });

                return(this);
            }
Esempio n. 3
0
            public virtual PrositRequest Predict()
            {
                ActionUtil.RunAsync(() =>
                {
                    try
                    {
                        var labelType = LabelType ?? Precursor.LabelType;
                        var skyIn     = new PrositIntensityModel.PeptidePrecursorNCE(Peptide,
                                                                                     Precursor, labelType, NCE);
                        var massSpectrum = IntensityModel.PredictSingle(Client,
                                                                        Settings, skyIn,
                                                                        _tokenSource.Token);
                        var iRT = RTModel.PredictSingle(Client,
                                                        Settings,
                                                        Peptide, _tokenSource.Token);
                        Spectrum = new SpectrumDisplayInfo(
                            new SpectrumInfoProsit(massSpectrum, Precursor, labelType, NCE),
                            // ReSharper disable once AssignNullToNotNullAttribute
                            Precursor,
                            iRT[Peptide]);
                    }
                    catch (PrositException ex)
                    {
                        Exception = ex;

                        // Ignore, UpdateUI is already working on a new request,
                        // so don't even update UI
                        if (ex.InnerException is RpcException rpcEx && rpcEx.StatusCode == StatusCode.Cancelled)
                        {
                            return;
                        }
                    }

                    _updateCallback.Invoke();
                });
                return(this);
            }