示例#1
0
 //!!!could be nice to have a version that writes to a stream and to a string
 public static void DebugReportCollection(VaccineAsString[] vaccineAsStringCollection)
 {
     for (int iVaccineAsString = 0; iVaccineAsString < vaccineAsStringCollection.Length; ++iVaccineAsString)
     {
         VaccineAsString aVaccineAsString = vaccineAsStringCollection[iVaccineAsString];
         Debug.WriteLine(string.Format("{0}\t{1}", iVaccineAsString, aVaccineAsString.String));
     }
 }
示例#2
0
        public Component MakePatchAComponent(Patch aPatch)
        {
            RemovePatchFromTables(aPatch);
            VaccineAsString.AddComponent(aPatch.PatchPattern());
            Component aComponent = Component.GetInstance(aPatch);

            Components.AddNew(aComponent);
            UpdateComponentTables(aComponent);

            return(aComponent);
        }
        private static List <PatchPattern> PatchPatternCollection(VaccineAsString vaccineUncompressed)
        {
            List <PatchPattern> rg = new List <PatchPattern>();

            PatchPatternFactory aPatchPatternFactory = PatchPatternFactory.GetFactory("strings");

            foreach (string componentAsString in vaccineUncompressed.NiceStringCollection())
            {
                PatchPattern patchPattern = aPatchPatternFactory.GetInstance(componentAsString);
                rg.Add(patchPattern);
            }
            return(rg);
        }
示例#4
0
        static public VaccineAsString GetInstance(int maximumWindowLength, string name)
        {
            VaccineAsString aVaccineAsString = new VaccineAsString();

            aVaccineAsString.Border = new string('_', (int)maximumWindowLength);              //!!!Using _____ of varying length now seems not so good. How about using newlines?

            aVaccineAsString.String                  = string.Format("{0}", aVaccineAsString.Border);
            aVaccineAsString.NumberOfComponents      = 0;
            aVaccineAsString.TotalNumberOfAminoAcids = 0;
            aVaccineAsString.Name = name;

            return(aVaccineAsString);
        }
示例#5
0
        override public void FirstVaccine(PatchTable patchTable)
        {
            PatchTable      = patchTable;
            VaccineAsString = VaccineAsString.GetInstance(patchTable.MaxPatchLength, Name);

            PointsInPatchTable = 0.0;
            foreach (Patch aPatch in patchTable.SortedPatchCollection)
            {
                PointsInPatchTable += aPatch.Weight;
                UnusedPatches.AddNew(aPatch);
            }

            Patch patchBest = patchTable.SortedPatchCollection[0];

            MakePatchAComponent(patchBest);
        }
示例#6
0
        internal static VaccineAsString GetInstanceFromNice(string name, string nice)
        {
            string[] components = nice.Split(',');
            int      max        = 0;

            foreach (string component in components)
            {
                max = Math.Max(max, component.Length);
            }

            VaccineAsString aVaccineAsString = VaccineAsString.GetInstance(max, name);

            foreach (string component in components)
            {
                aVaccineAsString.AddComponent(component);
            }
            return(aVaccineAsString);
        }
        public override double DupScore(Dictionary <PatchPattern, Patch> patchPaternToPatch, VaccineAsString vaccine)
        {
            double score = 0.0;

            foreach (string component in vaccine.NiceStringCollection())
            {
                foreach (Patch aPatch in patchPaternToPatch.Values)
                {
                    if (aPatch.PatchPattern().IsMatch(component))
                    {
                        score += aPatch.Weight;
                    }
                }
            }

            return(score);
        }
        public override double Score(Dictionary <PatchPattern, Patch> patchPaternToPatch, VaccineAsString vaccineAsString)
        {
            double score = 0.0;

            foreach (Patch aPatch in patchPaternToPatch.Values)
            {
                if (aPatch.PatchPattern().IsMatch(vaccineAsString.String))
                {
                    score += aPatch.Weight;
                }
            }

            return(score);
        }
 public abstract double DupScore(Dictionary <PatchPattern, Patch> patchPaternToPatch, VaccineAsString vaccine);
 public double Score(VaccineAsString vaccineAsString)
 {
     return(PatchTableScorer.Score(PatchPatternToPatch, vaccineAsString));
 }
 internal double DupScore(VaccineAsString vaccine)
 {
     return(PatchTableScorer.DupScore(PatchPatternToPatch, vaccine));
 }
 internal static PatchTable GetInstanceWithUniformWeightByLength(VaccineAsString vaccineUncompressed)
 {
     return(GetInstanceWithUniformWeightByLength(PatchPatternCollection(vaccineUncompressed)));
 }