예제 #1
0
        /// <summary>
        /// Initializes static members of the Alphabets class.
        /// </summary>
        static Alphabets()
        {
            // get the registered alphabets.
            IList <IAlphabet> registeredAlphabets = RegisteredAddIn.GetAlphabets(true);

            if (null != registeredAlphabets && registeredAlphabets.Count > 0)
            {
                foreach (IAlphabet alphabet in registeredAlphabets)
                {
                    if (alphabet != null && all.FirstOrDefault(IA => string.Compare(IA.Name, alphabet.Name, StringComparison.OrdinalIgnoreCase) == 0) == null)
                    {
                        all.Add(alphabet);
                    }
                }

                registeredAlphabets.Clear();
            }

            AmbiguousAlphabetMap = new Dictionary <IAlphabet, IAlphabet>();
            MapAlphabetToAmbiguousAlphabet(DnaAlphabet.Instance, AmbiguousDnaAlphabet.Instance);
            MapAlphabetToAmbiguousAlphabet(RnaAlphabet.Instance, AmbiguousRnaAlphabet.Instance);
            MapAlphabetToAmbiguousAlphabet(ProteinAlphabet.Instance, AmbiguousProteinAlphabet.Instance);
            MapAlphabetToAmbiguousAlphabet(AmbiguousDnaAlphabet.Instance, AmbiguousDnaAlphabet.Instance);
            MapAlphabetToAmbiguousAlphabet(AmbiguousRnaAlphabet.Instance, AmbiguousRnaAlphabet.Instance);

            AlphabetToBaseAlphabetMap = new Dictionary <IAlphabet, IAlphabet>();
            MapAlphabetToBaseAlphabet(AmbiguousDnaAlphabet.Instance, DnaAlphabet.Instance);
            MapAlphabetToBaseAlphabet(AmbiguousRnaAlphabet.Instance, RnaAlphabet.Instance);
            MapAlphabetToBaseAlphabet(AmbiguousProteinAlphabet.Instance, ProteinAlphabet.Instance);

            MapAlphabetToBaseAlphabet(Bio.Algorithms.MUMmer.MummerDnaAlphabet.Instance, DnaAlphabet.Instance);
            MapAlphabetToBaseAlphabet(Bio.Algorithms.MUMmer.MummerRnaAlphabet.Instance, RnaAlphabet.Instance);
            MapAlphabetToBaseAlphabet(Bio.Algorithms.MUMmer.MummerProteinAlphabet.Instance, ProteinAlphabet.Instance);
        }
예제 #2
0
        /// <summary>
        /// Static constructor
        /// </summary>
        static Alphabets()
        {
            //get the registered alphabets
            IList <IAlphabet> registeredAlphabets = RegisteredAddIn.GetAlphabets(true);

            if (null != registeredAlphabets && registeredAlphabets.Count > 0)
            {
                foreach (IAlphabet alphabet in registeredAlphabets)
                {
                    if (alphabet != null && all.FirstOrDefault(IA => string.Compare(IA.Name,
                                                                                    alphabet.Name, StringComparison.InvariantCultureIgnoreCase) == 0) == null)
                    {
                        all.Add(alphabet);
                    }
                }
                registeredAlphabets.Clear();
            }
        }
예제 #3
0
        public void GetAlphabetsTest()
        {
            //IMPORTANT: To pass this test case, it required two folders under...\MBF\MBF.Test\bin
            // 1. ...\MBF\MBF.Test\bin\Core
            // 2. ...\MBF\MBF.Test\bin\Add-ins
            // MBF.Test.dll needs to be copied under Add-ins folder.
            IList <IAlphabet> finalValue = new List <IAlphabet>();

            finalValue.Add(new NewAlphabet4TestingRegistration());

            IList <IAlphabet> registeredAlphabets = RegisteredAddIn.GetAlphabets(true);

            if (null != registeredAlphabets && registeredAlphabets.Count > 0)
            {
                foreach (IAlphabet alphabet in finalValue)
                {
                    string name = null;
                    registeredAlphabets.FirstOrDefault(IA => string.Compare(name = IA.Name, alphabet.Name, StringComparison.InvariantCultureIgnoreCase) == 0);
                    Assert.AreSame(alphabet.Name, name);
                }
            }
        }
예제 #4
0
        public void RegisterAddinsRegisterAlphabet()
        {
            CreateAddinsFolder();
            IList <IAlphabet> finalValue = new List <IAlphabet>();

            finalValue.Add(new TestAutomationAlphabet());

            // Gets the registered Alphabets
            IList <IAlphabet> registeredAlphabets = RegisteredAddIn.GetAlphabets(true);

            if (null != registeredAlphabets && registeredAlphabets.Count > 0)
            {
                foreach (IAlphabet alphabet in finalValue)
                {
                    string name = string.Empty;

                    registeredAlphabets.FirstOrDefault(IA => string.Compare(name = IA.Name,
                                                                            alphabet.Name, StringComparison.OrdinalIgnoreCase) == 0);

                    // Validates the Name
                    Assert.AreEqual(alphabet.Name, name);
                    Console.WriteLine(
                        string.Format((IFormatProvider)null, @"Successfully validated the Registered components for Alphabet '{0}'.",
                                      name));
                    ApplicationLog.WriteLine(
                        string.Format((IFormatProvider)null, @"Successfully validated the Registered components for Alphabet '{0}'.",
                                      name));
                }
            }
            else
            {
                Console.WriteLine("No Components to Register.");
                ApplicationLog.WriteLine("No Components to Register.");
                Assert.Fail();
            }
            DeleteAddinsFolder();
        }