public void PeptideReader_ReadTsv_Pass(string filePath, string groupPath, int reqNumPepMeasurements, int peptideCount)
        {
            //check throws error if file references no good
            //var noFilePeptideReaderTest = PeptideReader.ReadTsv("", filePathGroupsOnePeptideTest);
            //Assert.Throws(, onePeptideReaderTest.Count);

            List <Peptide> pepsInFile = PeptideReader.ReadTsv(filePath, groupPath, reqNumPepMeasurements, 5, "FlashLFQ");

            Assert.AreEqual(peptideCount, pepsInFile.Count());

            //test group dictonaries & lists!
        }
        public void Extensions_IncludeSharedPeptides_Pass(string filePathSharedPeptides, string groupPath, int reqNumPepMeasurements, string filePathUniquePeptides, int numRazorPep)
        {
            List <Peptide> sharedPeps = PeptideReader.ReadTsv(filePathSharedPeptides, groupPath, reqNumPepMeasurements, 5, "FlashLFQ");
            List <Peptide> uniquePeps = PeptideReader.ReadTsv(filePathUniquePeptides, groupPath, reqNumPepMeasurements, 5, "FlashLFQ");

            //include razor peptides
            sharedPeps = Extensions.IncludeSharedPeptides(sharedPeps, true);
            Assert.AreNotEqual(uniquePeps.Count(), sharedPeps.Count());
            //remove razor peptides
            sharedPeps = Extensions.IncludeSharedPeptides(sharedPeps, false);

            Assert.AreEqual(uniquePeps.Count(), sharedPeps.Count());
        }
예제 #3
0
        public void Peptide_FlashLFQIntensity_Pass(string filePath, string groupPath1, string groupPath2, int reqNumPepMeasurements)
        {
            List <Peptide> pepsGroup1 = PeptideReader.ReadTsv(filePath, groupPath1, reqNumPepMeasurements, 5, "FlashLFQ");
            List <Peptide> pepsGroup2 = PeptideReader.ReadTsv(filePath, groupPath2, reqNumPepMeasurements, 5, "FlashLFQ");

            Assert.AreEqual(pepsGroup1.Count(), pepsGroup2.Count());
            Assert.AreEqual(pepsGroup1.Select(p => p.Sequence), pepsGroup2.Select(p => p.Sequence));

            for (int i = 0; i < pepsGroup1.Count(); i++)
            {
                Assert.AreEqual(pepsGroup1[i].Intensities.Count(), pepsGroup2[i].Intensities.Count());
                Assert.AreEqual(pepsGroup1[i].Intensities.Select(p => p.FileName), pepsGroup2[i].Intensities.Select(p => p.FileName));
                Assert.AreEqual(pepsGroup1[i].Intensities.Select(p => p.IntensityVal), pepsGroup2[i].Intensities.Select(p => p.IntensityVal));
                Assert.AreEqual(pepsGroup1[i].Intensities.Select(p => p.FileName), pepsGroup2[i].Intensities.Select(p => p.FileName));
            }
        }
        public void BenjaminiHochbergTester(string filepathpeptides, string filepathgroups,
                                            int reqNumUnmodPeptides, int reqNumModPeptides, int reqNumOfPepeptides, int reqNumBaselineMeasurements,
                                            Boolean useBaselinePeptides, double alpha,
                                            string correctPValsUngroupedFile, string correctPValsGroupedFile)
        {
            List <string> correctPValsUngroupedS = File.ReadLines(correctPValsUngroupedFile).ToList();
            List <double> correctPValsUngrouped  = correctPValsUngroupedS.Select(p => double.Parse(p)).ToList();
            List <string> correctPValsGroupedS   = File.ReadLines(correctPValsGroupedFile).ToList();
            List <double> correctPValsGrouped    = correctPValsGroupedS.Select(p => double.Parse(p)).ToList();


            Dictionary <string, string> groups = PeptideReader.GetGroups(filepathgroups);
            List <string>  groupsList          = PeptideReader.GetGroupList(filepathgroups);
            List <Peptide> testPeptide         = PeptideReader.ReadTsv(filepathpeptides, filepathgroups, 3, 5, "FlashLFQ");

            testPeptide = Extensions.IncludeSharedPeptides(testPeptide, false);

            //group peptides by protein
            var proteins = testPeptide.Select(p => p.ProteinGroup).Distinct().ToArray();
            List <ProteinGroup> testProt = new List <ProteinGroup>();

            for (int i = 0; i < proteins.Length; i++)
            {
                testProt.Add(new ProteinGroup(proteins[i], testPeptide, groupsList, reqNumUnmodPeptides, reqNumModPeptides, reqNumOfPepeptides,
                                              useBaselinePeptides, reqNumUnmodPeptides, reqNumBaselineMeasurements, 0.5, false, 3));
            }
            var correctPValsUnGroupedProt = testProt.Where(p => p.ProteinPairwiseComparisons != null).ToList();
            var correctPValsGroupedProt   = testProt.Where(p => p.ProteinPairwiseComparisons != null).ToList();

            Extensions.CalcCorrectedPValue(correctPValsUnGroupedProt, false, alpha);
            Extensions.CalcCorrectedPValue(correctPValsGroupedProt, true, alpha);

            List <double> pValsGroupedPeps   = new List <double>();
            List <double> pValsUngroupedPeps = new List <double>();

            for (int i = 0; i < correctPValsUnGroupedProt.Count(); ++i)
            {
                pValsGroupedPeps.AddRange(correctPValsGroupedProt[i].ProteinPairwiseComparisons.Select(p => p.CorrectedpVal));
                pValsUngroupedPeps.AddRange(correctPValsUnGroupedProt[i].ProteinPairwiseComparisons.Select(p => p.CorrectedpVal));
            }
            pValsGroupedPeps.Sort();
            correctPValsGrouped.Sort();
            Assert.That(pValsUngroupedPeps, Is.EqualTo(correctPValsUngrouped).Within(0.001));
            Assert.That(pValsGroupedPeps, Is.EqualTo(correctPValsGrouped).Within(0.001));
        }
예제 #5
0
        public void Peptide_FlashLFQGetter_Pass(string filePath, string groupPath, int reqNumPepMeasurements, int lineToCompare, string sequence, string baseSequence,
                                                string proteinGroup, string geneName, string organism, int numberIntensities, int intensityColToCompare, string fileName,
                                                string groupID, double intensityVal, bool isUnique, bool detectedMinNum)
        {
            //check that valid entries in constuctor lead to object in getter
            List <Peptide> pepsInFile = PeptideReader.ReadTsv(filePath, groupPath, reqNumPepMeasurements, 5, "FlashLFQ");

            Assert.AreEqual(sequence, pepsInFile[lineToCompare].Sequence);
            Assert.AreEqual(baseSequence, pepsInFile[lineToCompare].BaseSeq);
            Assert.AreEqual(proteinGroup, pepsInFile[lineToCompare].ProteinGroup);
            Assert.AreEqual(geneName, pepsInFile[lineToCompare].GeneName);
            Assert.AreEqual(numberIntensities, pepsInFile[lineToCompare].Intensities.Count);
            Assert.AreEqual(detectedMinNum, pepsInFile[lineToCompare].DetectedMinNum);

            //check setting isUnique
            Extensions.IncludeSharedPeptides(pepsInFile, true);
            Assert.AreEqual(isUnique, pepsInFile[lineToCompare].IsUnique);

            //check intensities
            Assert.AreEqual(fileName, pepsInFile[lineToCompare].Intensities[intensityColToCompare].FileName);
            Assert.AreEqual(groupID, pepsInFile[lineToCompare].Intensities[intensityColToCompare].GroupID);
            Assert.That(intensityVal, Is.EqualTo(pepsInFile[lineToCompare].Intensities[intensityColToCompare].IntensityVal).Within(0.001));
        }
예제 #6
0
        public void Peptide_DetectedMinNum_Pass(string filePath, string groupPath, int reqNumPepMeasurements, int numPeptidesMeetMeasurementReq)
        {
            List <Peptide> pepsInFile = PeptideReader.ReadTsv(filePath, groupPath, reqNumPepMeasurements, 5, "FlashLFQ");

            Assert.AreEqual(numPeptidesMeetMeasurementReq, pepsInFile.Where(p => p.DetectedMinNum).Count());
        }