Пример #1
0
        public override PrositRTInput.PrositPeptideInput CreatePrositInputRow(SrmSettings settings, PeptideDocNodeWrapper skylineInput,
                                                                              out PrositException exception)
        {
            var sequence = PrositHelpers.EncodeSequence(settings, (PeptideDocNode)skylineInput, IsotopeLabelType.light, out exception);

            if (sequence == null)
            {
                return(null);
            }

            return(new PrositRTInput.PrositPeptideInput(sequence));
        }
Пример #2
0
        public override PrositIntensityInput.PrositPrecursorInput CreatePrositInputRow(SrmSettings settings, PeptidePrecursorNCE skylineInput, out PrositException exception)
        {
            var peptideSequence = PrositHelpers.EncodeSequence(settings, skylineInput.NodePep, IsotopeLabelType.light, out exception);

            if (peptideSequence == null) // equivalently, exception != null
            {
                return(null);
            }

            var precursorCharge = PrositHelpers.OneHotEncode(skylineInput.NodeGroup.PrecursorCharge - 1, PrositConstants.PRECURSOR_CHARGES);

            return(new PrositIntensityInput.PrositPrecursorInput(peptideSequence, precursorCharge, skylineInput.NCE.Value / 100.0f));
        }
Пример #3
0
 /// <summary>
 /// Construct Prosit input given Skyline input. Note that
 /// this function does not throw any exceptions but uses the exception out
 /// parameter to speed up constructing large amounts of inputs.
 /// </summary>
 /// <param name="settings">Settings to use for construction</param>
 /// <param name="skylineInput">The input at the Skyline level (for example docnodes)</param>
 /// <param name="exception">Exception that occured during the creating Process</param>
 /// <returns>The input at the Prosit level</returns>
 public abstract TPrositInputRow CreatePrositInputRow(SrmSettings settings, TSkylineInputRow skylineInput, out PrositException exception);
Пример #4
0
        /// <summary>
        /// Sequences are passed to Prosit as an array of indices mapping into an array
        /// of amino acids (with modifications). Actually throwing exceptions in this method
        /// slows down constructing inputs (for larger data sets with unknown mods (and aa's)significantly,
        /// which is why PrositExceptions (only) are set as an output parameter and null is returned.
        /// </summary>
        public static int[] EncodeSequence(SrmSettings settings, ISequenceContainer peptide, IsotopeLabelType label, out PrositException exception)
        {
            if (!peptide.Target.IsProteomic)
            {
                throw new PrositSmallMoleculeException(peptide.ModifiedTarget);
            }

            var sequence = peptide.Target.Sequence;

            if (sequence.Length > PrositConstants.PEPTIDE_SEQ_LEN)
            {
                exception = new PrositPeptideTooLongException(peptide.ModifiedTarget);
                return(null);
            }

            var modifiedSequence = ModifiedSequence.GetModifiedSequence(settings, peptide, label);
            var result           = new int[PrositConstants.PEPTIDE_SEQ_LEN];

            for (var i = 0; i < sequence.Length; ++i)
            {
                if (!PrositConstants.AMINO_ACIDS.TryGetValue(sequence[i], out var prositAA))
                {
                    exception = new PrositUnsupportedAminoAcidException(peptide.ModifiedTarget, i);
                    return(null);
                }

                var mods = modifiedSequence.ExplicitMods.Where(m => m.IndexAA == i).ToArray();
                foreach (var mod in mods)
                {
                    if (mod.MonoisotopicMass == 0.0)
                    {
                        continue;
                    }

                    var staticMod = UniMod.FindMatchingStaticMod(mod.StaticMod, true) ?? mod.StaticMod;
                    if (!PrositConstants.MODIFICATIONS.TryGetValue(staticMod.Name, out var prositAAMod))
                    {
                        exception = new PrositUnsupportedModificationException(peptide.ModifiedTarget,
                                                                               mod.StaticMod,
                                                                               mod.IndexAA);
                        return(null);
                    }

                    result[i] = prositAAMod.PrositIndex;
                    break;
                }

                if (result[i] == 0)
                {
                    // Not modified
                    result[i] = prositAA.PrositIndex;
                }
            }

            exception = null;
            return(result);
        }