Exemplo n.º 1
0
 public RankScore(ActivationMethod activationMethod, Ms2DetectorType ms2DetectorType, Enzyme enzyme, Protocol protocol)
 {
     if (activationMethod == ActivationMethod.HCD && enzyme == Enzyme.Trypsin)
     {
         var paramFile = Properties.Resources.HCD_Trypsin;
         var stream = new MemoryStream();
         var writer = new StreamWriter(stream);
         writer.Write(paramFile);
         writer.Flush();
         stream.Position = 0;
         _trainingParameters = new TrainingParameters(stream);
     }
     else
     {
         throw new ArgumentException("No parameter file available for selected arguments.");
     }
 }
Exemplo n.º 2
0
 public int GetActivationMethodIndex(ActivationMethod actMethod)
 {
     return (actMethod != ActivationMethod.ETD) ? 0 : 1;
 }
Exemplo n.º 3
0
 public double GetEdgeScore(ActivationMethod activationMethod, int charge1, double mass1, int charge2, double mass2)
 {
     var mzErrorPpm = (Math.Abs(mass1 - mass2)/mass1)*1e6;
     return GetEdgeScore(activationMethod, Math.Abs(charge1 - charge2), mzErrorPpm);
 }
Exemplo n.º 4
0
 public double GetEdgeScore(ActivationMethod activationMethod, int chargeDiff, double massErrorPpm)
 {
     return 0d;
 }
Exemplo n.º 5
0
 public double GetNodeScore(ActivationMethod activationMethod, bool isPrefix, double fragmentIonMass, int fragmentIonCharge, 
     double corrScore, double distScore, double intensityScore, double massErrorPpm)
 {
     var score = GetNodeScoreWithoutMassError(activationMethod, isPrefix, fragmentIonMass, fragmentIonCharge, corrScore,
         distScore, intensityScore);
     score += GetMassErrorScore(massErrorPpm);
     return score;
 }
Exemplo n.º 6
0
 public double GetNodeScore(ActivationMethod activationMethod, bool isPrefix, double fragmentIonMass, DeconvolutedPeak matchedPeak, double refIntensity)
 {
     var massErrorPpm = 1e6 * ((matchedPeak.Mass - fragmentIonMass) / fragmentIonMass);
     return GetNodeScore(activationMethod, isPrefix, fragmentIonMass, matchedPeak.Charge, matchedPeak.Corr, matchedPeak.Dist, matchedPeak.Intensity / refIntensity, massErrorPpm);   
 }
Exemplo n.º 7
0
 // minScanNum, maxScanNum, minCharge, maxCharge: inclusive
 public ProductSpectrum GetSummedMs2Spectrum(double monoIsotopicMass,
     int minScanNum, int maxScanNum, int minCharge, int maxCharge, ActivationMethod activationMethod = ActivationMethod.Unknown)
 {
     var isoEnv = Averagine.GetIsotopomerEnvelope(monoIsotopicMass);
     var ms2ScanNums = new List<int>();
     for (var charge = minCharge; charge <= maxCharge; charge++)
     {
         var mostAbundantIsotopeMz = Ion.GetIsotopeMz(monoIsotopicMass, charge, isoEnv.MostAbundantIsotopeIndex);
         ms2ScanNums.AddRange(GetFragmentationSpectraScanNums(mostAbundantIsotopeMz)
             .Where(ms2ScanNum => ms2ScanNum >= minScanNum && ms2ScanNum <= maxScanNum && 
                 (activationMethod == ActivationMethod.Unknown || 
                 ((ProductSpectrum) GetSpectrum(ms2ScanNum)).ActivationMethod == activationMethod)))
                 ;
     }
     var summedSpec = GetSummedSpectrum(ms2ScanNums);
     return new ProductSpectrum(summedSpec.Peaks, 0) {ActivationMethod = activationMethod};
 }
Exemplo n.º 8
0
 public ChoEtl(ActivationMethod activationMethod)
 {
     _activationMethod = activationMethod;
 }
Exemplo n.º 9
0
        /// <summary>
        /// Get the scorer by scan number.
        /// </summary>
        /// <param name="scanNum">The scan number to get the scorer for.</param>
        /// <param name="precursorMass">The precursor mass to get the scorer for.</param>
        /// <param name="precursorCharge">The precursor charge to get the scorer for.</param>
        /// <param name="activationMethod">The activation method to get the scorer for.</param>
        /// <returns>The scorer selected based on the arguments.</returns>
        public IScorer GetScorer(int scanNum, double precursorMass = 0, int precursorCharge = 1, ActivationMethod activationMethod = ActivationMethod.Unknown)
        {
            IScorer scorer;

            if (this.scorerHash.ContainsKey(scanNum))
            {
                scorer = this.scorerHash[scanNum];
            }
            else
            {
                var parameters = this.scoringParameterSet.GetScoringParameters(activationMethod, precursorMass);
                scorer = new FlipScorer <DeconvolutedSpectrum>(parameters, this.lcmsRun.GetSpectrum(scanNum) as DeconvolutedSpectrum);
                this.scorerHash.Add(scanNum, scorer);
            }

            return(scorer);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Get a summed MS2 spectrum from the dataset, with the provided limits
        /// </summary>
        /// <param name="monoIsotopicMass"></param>
        /// <param name="minScanNum">min scan number, inclusive</param>
        /// <param name="maxScanNum">max scan number, inclusive</param>
        /// <param name="minCharge">min charge, inclusive</param>
        /// <param name="maxCharge">max charge, inclusive</param>
        /// <param name="activationMethod"></param>
        /// <returns></returns>
        public ProductSpectrum GetSummedMs2Spectrum(double monoIsotopicMass,
                                                    int minScanNum, int maxScanNum, int minCharge, int maxCharge, ActivationMethod activationMethod = ActivationMethod.Unknown)
        {
            var isoEnv      = Averagine.GetIsotopomerEnvelope(monoIsotopicMass);
            var ms2ScanNums = new List <int>();

            for (var charge = minCharge; charge <= maxCharge; charge++)
            {
                var mostAbundantIsotopeMz = Ion.GetIsotopeMz(monoIsotopicMass, charge, isoEnv.MostAbundantIsotopeIndex);
                ms2ScanNums.AddRange(GetFragmentationSpectraScanNums(mostAbundantIsotopeMz)
                                     .Where(ms2ScanNum => ms2ScanNum >= minScanNum && ms2ScanNum <= maxScanNum &&
                                            (activationMethod == ActivationMethod.Unknown ||
                                             ((ProductSpectrum)GetSpectrum(ms2ScanNum)).ActivationMethod == activationMethod)))
                ;
            }
            var summedSpec = GetSummedSpectrum(ms2ScanNums);

            return(new ProductSpectrum(summedSpec.Peaks, 0)
            {
                ActivationMethod = activationMethod
            });
        }
Exemplo n.º 11
0
        /// <summary>
        /// Get the scorer by spectrum.
        /// This creates the scorer directly for that spectrum. It bypasses the scorer cache.
        /// </summary>
        /// <param name="spectrum">The spectrum number to get the scorer for.</param>
        /// <param name="precursorMass">The precursor mass to get the scorer for.</param>
        /// <param name="precursorCharge">The precursor charge to get the scorer for.</param>
        /// <returns>The scorer selected based on the arguments.</returns>
        public IScorer GetScorer(ProductSpectrum spectrum, double precursorMass, int precursorCharge, ActivationMethod activationMethod = ActivationMethod.Unknown)
        {
            var parameters = this.scoringParameterSet.GetScoringParameters(spectrum.ActivationMethod, precursorMass);
            var targetedDeconvolutedSpectrum = new TargetedDeconvolutedSpectrum(spectrum, 1, precursorCharge - 1);

            return(new FlipScorer <TargetedDeconvolutedSpectrum>(parameters, targetedDeconvolutedSpectrum));
        }
Exemplo n.º 12
0
 public FastCsvParser(ActivationMethod activationMethod)
 {
     _activationMethod = activationMethod;
 }
Exemplo n.º 13
0
 public TxtCsvHelper(ActivationMethod activationMethod)
 {
     _activationMethod = activationMethod;
 }
Exemplo n.º 14
0
 public double GetNodeScoreWithoutMassError(ActivationMethod activationMethod, bool isPrefix, DeconvolutedPeak matchedPeak, double refIntensity)
 {
     return GetNodeScoreWithoutMassError(activationMethod, isPrefix, matchedPeak.Mass, matchedPeak.Charge, matchedPeak.Corr, matchedPeak.Dist, matchedPeak.Intensity / refIntensity);
 }
Exemplo n.º 15
0
 public Precursor()
 {
     Ions = new List<SelectedIon>();
     IsolationWindowTargetMz = 0.0;
     IsolationWindowLowerOffset = 0.0;
     IsolationWindowUpperOffset = 0.0;
     Activation = ActivationMethod.Unknown;
 }
Exemplo n.º 16
0
        public double GetNodeScoreWithoutMassError(ActivationMethod activationMethod, bool isPrefix, double fragmentIonMass, int fragmentIonCharge,
            double corrScore, double distScore, double intensityScore)
        {
            var m = MassBinning.GetBinIndex(fragmentIonMass);
            var c = GetChargeIndex(fragmentIonCharge);
            var a = GetActivationMethodIndex(activationMethod);
            var t = GetIonTypeIndex(isPrefix);

            var ci = CorrBinning.GetBinIndex(corrScore);
            var di = DistBinning.GetBinIndex(distScore);
            var ii = IntensityBinning.GetBinIndex(intensityScore);

            var score = IonTypeScoreTable[a][t];
            score += MassScoreTable[a][t][m];
            score += ChargeScoreTable[m][c];
            score += CorrScoreTable[c][m][ci];
            score += DistScoreTable[c][m][di];
            score += IntensityScoreTable[c][m][ii];

            return score;
        }
Exemplo n.º 17
0
 public CommonLibrary_NET(ActivationMethod activationMethod)
 {
     _activationMethod = activationMethod;
 }