Esempio n. 1
0
        protected override string buildIsosResultOutput(DeconTools.Backend.Core.IsosResult result)
        {
            Check.Require(result is UIMFIsosResult, "UIMF Isos Exporter is only used with UIMF results");
            var uimfResult = (UIMFIsosResult)result;

            if (MSFeatureIDsWritten.Contains(result.MSFeatureID))   //this prevents duplicate IDs from being written
            {
                return(string.Empty);
            }

            MSFeatureIDsWritten.Add(result.MSFeatureID);

            var sb = new StringBuilder();

            //We wish to report the FrameNum Not the FrameIndex.   FrameNum is unique
            sb.Append(uimfResult.MSFeatureID);
            sb.Append(delimiter);
            sb.Append(uimfResult.ScanSet.PrimaryScanNumber);
            sb.Append(delimiter);
            sb.Append(uimfResult.IMSScanSet.PrimaryScanNumber);
            sb.Append(delimiter);
            sb.Append(uimfResult.IsotopicProfile.ChargeState);
            sb.Append(delimiter);
            sb.Append(DblToString(uimfResult.IntensityAggregate, 4, true));           // Abundance
            sb.Append(delimiter);
            sb.Append(DblToString(uimfResult.IsotopicProfile.GetMZ(), 5));
            sb.Append(delimiter);
            sb.Append(DblToString(uimfResult.IsotopicProfile.GetScore(), 4));
            sb.Append(delimiter);
            sb.Append(DblToString(uimfResult.IsotopicProfile.AverageMass, 5));
            sb.Append(delimiter);
            sb.Append(DblToString(uimfResult.IsotopicProfile.MonoIsotopicMass, 5));
            sb.Append(delimiter);
            sb.Append(DblToString(uimfResult.IsotopicProfile.MostAbundantIsotopeMass, 5));
            sb.Append(delimiter);
            sb.Append(DblToString(uimfResult.IsotopicProfile.GetFWHM(), 4));
            sb.Append(delimiter);
            sb.Append(DblToString(uimfResult.IsotopicProfile.GetSignalToNoise(), 2));
            sb.Append(delimiter);
            sb.Append(DblToString(uimfResult.IsotopicProfile.GetMonoAbundance(), 4, true));
            sb.Append(delimiter);
            sb.Append(DblToString(uimfResult.IsotopicProfile.GetMonoPlusTwoAbundance(), 4, true));
            sb.Append(delimiter);
            sb.Append(DblToString(uimfResult.IsotopicProfile.OriginalIntensity, 4, true));
            sb.Append(delimiter);
            sb.Append(uimfResult.IsotopicProfile.IsSaturated ? 1 : 0);
            sb.Append(delimiter);
            sb.Append(DblToString(uimfResult.DriftTime, 3));
            sb.Append(delimiter);
            sb.Append(ResultValidators.ResultValidationUtils.GetStringFlagCode(result.Flags));
            sb.Append(delimiter);
            sb.Append(DblToString(uimfResult.InterferenceScore, 5));


            return(sb.ToString());
        }
        public override void ValidateResult(DeconTools.Backend.Core.ResultCollection resultColl, DeconTools.Backend.Core.IsosResult currentResult)
        {
            if (currentResult.IsotopicProfile == null)
            {
                return;
            }

            Check.Require(currentResult != null, String.Format("{0} failed. CurrentResult has not been defined.", this.Name));
            if (resultColl.Run.PeakList == null || resultColl.Run.PeakList.Count == 0)
            {
                currentResult.InterferenceScore = -1;
                return;
            }


            var monoPeak = currentResult.IsotopicProfile.getMonoPeak();
            var lastPeak = currentResult.IsotopicProfile.Peaklist[currentResult.IsotopicProfile.Peaklist.Count - 1];

            var leftMZBoundary  = monoPeak.XValue - 1.1;
            var rightMZBoundary = lastPeak.XValue + lastPeak.Width / 2.35 * 2;      // 2 sigma

            double interferenceVal = -1;

            if (UsePeakBasedInterferenceValue)
            {
                var scanPeaks = resultColl.Run.PeakList.Select <Peak, MSPeak>(i => (MSPeak)i).ToList();
                interferenceVal = m_scorer.GetInterferenceScore(scanPeaks, currentResult.IsotopicProfile.Peaklist, leftMZBoundary, rightMZBoundary);
            }
            else
            {
                var startIndexOfXYData = MathUtils.BinarySearchWithTolerance(resultColl.Run.XYData.Xvalues, monoPeak.XValue - 3, 0, (resultColl.Run.XYData.Xvalues.Length - 1), 2);
                if (startIndexOfXYData < 0)
                {
                    startIndexOfXYData = 0;
                }

                interferenceVal = m_scorer.GetInterferenceScore(resultColl.Run.XYData, currentResult.IsotopicProfile.Peaklist, leftMZBoundary, rightMZBoundary, startIndexOfXYData);
            }



            currentResult.InterferenceScore = interferenceVal;
        }
        public override void ValidateResult(DeconTools.Backend.Core.ResultCollection resultColl, DeconTools.Backend.Core.IsosResult currentResult)
        {
            Check.Require(currentResult is N14N15_TResult, "Currently, this is only implemented for N14N15 results");

            var n14n15result = (N14N15_TResult)currentResult;

            Check.Require(n14n15result.Target.IsotopicProfileLabelled != null, "Cannot validate labelled isotopic profile. Theoretical profile was not defined.");

            // stop, but don't throw an error if there is no labelled isotopic profile.
            if (n14n15result.IsotopicProfileLabeled == null)
            {
                return;
            }

            var isoN15 = n14n15result.IsotopicProfileLabeled;


            var scanPeaks = resultColl.Run.PeakList.Select <Peak, MSPeak>(i => (MSPeak)i).ToList();

            // get i_score
            n14n15result.InterferenceScoreN15 = getIScore(scanPeaks, isoN15);

            // get fit score

            var fitval = getFitValue(resultColl.Run.XYData, n14n15result.Target.IsotopicProfileLabelled, isoN15);

            n14n15result.ScoreN15 = fitval;
        }
Esempio n. 4
0
 //This is the primary way to add an IsosResult
 public void AddIsosResult(IsosResult addedResult)
 {
     addedResult.MSFeatureID = MSFeatureCounter;
     MSFeatureCounter++;    // by placing it here, we make the MSFeatureID a zero-based ID, as Kevin requested in an email (Jan 20/2010)
     this.IsosResultBin.Add(addedResult);
 }