Esempio n. 1
0
        public static IEnumerable <string> GreedyEpitomeEnumerable(string patchTableAsString)
        {
            //!!!Similar to other code

            string scorerName = "normal";
            PatchPatternFactory patchPatternFactory = PatchPatternFactory.GetFactory("strings");
            VaccineMaker        vaccineMaker        = VaccineMaker.GetInstance("Greedy");

            PatchTable patchTable = LoadPatchTable(patchTableAsString, scorerName, patchPatternFactory);

            patchTable.Normalize();
            AssertPointsTotalOne(patchTable);

            //yield return VaccineMaker.DisplayHeaderString;

            vaccineMaker.FirstVaccine(patchTable);
            VaccineAsString vaccineAsString = null;

            while (null != (vaccineAsString = vaccineMaker.VaccineAsString))
            {
                double rScoreOpt = patchTable.Score(vaccineAsString);
                yield return(vaccineMaker.DisplayString(rScoreOpt));

                vaccineMaker.ChangeToNext();
            }
        }
Esempio n. 2
0
        public static void MakeGreedyEpitomes(TextReader patchTableTextReader, TextWriter streamWriterOutputFile, int stopLength)
        {
            string scorerName = "normal";
            PatchPatternFactory patchPatternFactory = PatchPatternFactory.GetFactory("strings");
            VaccineMaker        vaccineMaker        = VaccineMaker.GetInstance("Greedy");

            PatchTable patchTable = LoadPatchTable(patchTableTextReader, scorerName, patchPatternFactory);

            patchTable.Normalize();
            AssertPointsTotalOne(patchTable);

            vaccineMaker.DisplayHeader(streamWriterOutputFile);

            vaccineMaker.FirstVaccine(patchTable);
            VaccineAsString vaccineAsString = null;

            while (null != (vaccineAsString = vaccineMaker.VaccineAsString))
            {
                double rScoreOpt = patchTable.Score(vaccineAsString);
                vaccineMaker.Display(streamWriterOutputFile, rScoreOpt);
                streamWriterOutputFile.Flush();

                if (vaccineAsString.TotalNumberOfAminoAcids > stopLength)
                {
                    break;
                }

                vaccineMaker.ChangeToNext();
            }
        }