Beispiel #1
0
 /// <summary>
 /// Generates decoys for a list of proteins
 /// </summary>
 /// <param name="proteins"></param>
 /// <param name="decoyType"></param>
 /// <param name="digestionParams"></param>
 /// <param name="randomSeed">Used when decoy type is shuffle for shuffling the peptides</param>
 /// <returns></returns>
 public static List <Protein> GenerateDecoys(List <Protein> proteins, DecoyType decoyType, int maxThreads = -1)
 {
     if (decoyType == DecoyType.None)
     {
         return(new List <Protein>());
     }
     else if (decoyType == DecoyType.Reverse)
     {
         return(GenerateReverseDecoys(proteins, maxThreads));
     }
     else if (decoyType == DecoyType.Slide)
     {
         return(GenerateSlideDecoys(proteins, maxThreads));
     }
     else
     {
         throw new ArgumentException("Decoy type " + decoyType.ToString() + " is not implemented.");
     }
 }
        public void MoreTests(string filename, DecoyType decoyType = DecoyType.None)
        {
            string xmlName  = Path.Combine(TestContext.CurrentContext.TestDirectory, "TestData", filename);
            var    proteins = ProteinDbLoader.LoadProteinXML(xmlName, decoyType == DecoyType.None, decoyType, null, false, null, out var un);
            var    peps     = proteins[1].Digest(CommonParameters.DigestionParams, null, null).ToList();
            PeptideWithSetModifications pep = peps[peps.Count - 2];

            string     mzmlName     = $"ajgdiv{filename}{decoyType.ToString()}.mzML";
            MsDataFile myMsDataFile = new TestDataFile(new List <PeptideWithSetModifications> {
                pep
            });

            IO.MzML.MzmlMethods.CreateAndWriteMyMzmlWithCalibratedSpectra(myMsDataFile, mzmlName, false);
            string outputFolder = Path.Combine(TestContext.CurrentContext.TestDirectory, $"TestSearchWithVariants{filename}{decoyType.ToString()}");

            Directory.CreateDirectory(outputFolder);

            SearchTask st = new SearchTask
            {
                SearchParameters = new SearchParameters
                {
                    DoParsimony             = true,
                    DecoyType               = decoyType,
                    SearchTarget            = decoyType == DecoyType.None,
                    ModPeptidesAreDifferent = false
                },
                CommonParameters = new CommonParameters(scoreCutoff: 1, digestionParams: new DigestionParams(minPeptideLength: 2), precursorMassTolerance: new PpmTolerance(20)),
            };

            st.RunTask(outputFolder, new List <DbForTask> {
                new DbForTask(xmlName, false)
            }, new List <string> {
                mzmlName
            }, "");
            var psms = File.ReadAllLines(Path.Combine(outputFolder, "AllPSMs.psmtsv"));

            //Assert.IsTrue(psms.Any(line => line.Contains($"\t{variantPsmShort}\t" + (containsVariant ? variantPsmShort : "\t"))));

            Directory.Delete(outputFolder, true);
            File.Delete(mzmlName);
            //Directory.Delete(Path.Combine(TestContext.CurrentContext.TestDirectory, @"Task Settings"), true);
        }