/*
         * public static int TargetDecoyComparison(Protein left, Protein right)
         * {
         *  if (left.Target)
         *      if (right.Target)
         *          return 0;
         *      else
         *          return -1;
         *  else
         *      if (right.Target)
         *          return 1;
         *      else
         *          return 0;
         * }//*/

        public IEnumerable <Peptide> Digest(Protease protease, int maximumMissedCleavages, InitiatorMethionineBehavior initiatorMethionineBehavior,
                                            int?minimumPeptideLength, int?maximumPeptideLength, bool onTheFlyDecoy)
        {
            List <int> indices = protease.GetDigestionSiteIndices(this);

            indices.Insert(0, -1);
            indices.Add(Length - 1);

            for (int missed_cleavages = 0; missed_cleavages <= maximumMissedCleavages; missed_cleavages++)
            {
                for (int i = 0; i < indices.Count - missed_cleavages - 1; i++)
                {
                    if (initiatorMethionineBehavior != InitiatorMethionineBehavior.Cleave || indices[i] + 1 != 0 || this[0] != 'M')
                    {
                        Peptide peptide = new Peptide(this, indices[i] + 1, indices[i + missed_cleavages + 1], missed_cleavages);

                        if ((!minimumPeptideLength.HasValue || peptide.Length >= minimumPeptideLength.Value) &&
                            (!maximumPeptideLength.HasValue || peptide.Length <= maximumPeptideLength.Value))
                        {
                            yield return(peptide);

                            if (onTheFlyDecoy)
                            {
                                yield return(new Peptide(this, indices[i + missed_cleavages + 1], indices[i] + 1, missed_cleavages));
                            }
                        }
                    }

                    if (initiatorMethionineBehavior != InitiatorMethionineBehavior.Retain && indices[i] + 1 == 0 && this[0] == 'M')
                    {
                        Peptide peptide_without_initiator_methionine = new Peptide(this, indices[i] + 1 + 1, indices[i + missed_cleavages + 1], missed_cleavages);

                        if ((!minimumPeptideLength.HasValue || peptide_without_initiator_methionine.Length >= minimumPeptideLength.Value) &&
                            (!maximumPeptideLength.HasValue || peptide_without_initiator_methionine.Length <= maximumPeptideLength.Value))
                        {
                            yield return(peptide_without_initiator_methionine);

                            if (onTheFlyDecoy)
                            {
                                yield return(new Peptide(this, indices[i + missed_cleavages + 1], indices[i] + 1 + 1, missed_cleavages));
                            }
                        }
                    }
                }
            }
        }
Exemple #2
0
        public DBOptions(string fasta, IConSol console = null)
        {
            if (console == null)
            {
                ConSole = new ConSolCommandLine();
            }
            else
            {
                ConSole = console;
            }
            //Create with default values
            this.DecoyFusion           = true;
            this.FastaDatabaseFilepath = fasta;
            this.MaximumPeptideMass    = 10000;
            ProteaseDictionary proteases = ProteaseDictionary.Instance;

            this.DigestionEnzyme                     = proteases["no enzyme"]; // proteases["trypsin (no proline rule)"];
            this.NoEnzymeSearch                      = true;
            this.ToleratedMissedCleavages            = 100;                    // 3;//determines the length of peptides with no-enzyme option
            this.initiatorMethionineBehavior         = InitiatorMethionineBehavior.Variable;
            this.fixedModifications                  = new GraphML_List <Modification>();
            this.variableModifications               = new GraphML_List <Modification>();
            this.maximumVariableModificationIsoforms = 1024;

            this.MinimumPrecursorChargeState         = 1;
            this.MaximumPrecursorChargeState         = 4;
            this.MaximumNumberOfFragmentsPerSpectrum = 400;
            //TODO Add precision to the precursor by reading MS part of file
            this.precursorMassTolerance = new MassTolerance(0.005, MassToleranceUnits.Da);//2.1
            //TODO Add precision to the product masses by reading corresponding MS part of raw file
            this.productMassTolerance = new MassTolerance(0.005, MassToleranceUnits.Da);

            this.PSMFalseDiscoveryRate = 0.25;             // 0.05;

            this.OutputFolder    = @"C:\_IRIC\DATA\Test2"; //C:\Documents and Settings\ProteoAdmin\Desktop\AEffacer\Morpheus\Output";
            this.MinimumPSMScore = 0.0001;
        }