Ejemplo n.º 1
0
        /// <summary>
        /// Best Alignments
        /// </summary>
        /// <param name="swapPossibilities"> Value swap in DB </param>
        /// <param name="DB"> Data Base if sequence </param>
        /// <returns>Key Value Pair contains maxvalue (i.e. best alignment), DBIndex, SwapIndex, SeqPosIndex </returns>
        public KeyValuePair <int, List <List <int> > > ProvideBestSwapBulkAlignments(List <List <int[]> > swapPossibilities, List <FastaItem> DB)
        {
            int maxValue = int.MinValue;


            List <int> DBIndex     = new List <int>();
            List <int> SwapIndex   = new List <int>();
            List <int> SeqPosIndex = new List <int>();


            int counter = 0;

            for (int i = 0; i < swapPossibilities.Count; i++) //
            {
                counter++;
                Console.WriteLine("Verifying swap " + counter + " of " + swapPossibilities.Count);
                List <int[]> swapOptions = swapPossibilities[i];

                for (int j = 0; j < swapOptions.Count; j++) //SwappedOptions
                {
                    for (int k = 0; k < swapOptions[j].Length; k++)
                    {
                        if (swapOptions[j][k] > maxValue)
                        {
                            maxValue = swapOptions[j][k];

                            DBIndex = new List <int>()
                            {
                                i
                            };
                            SwapIndex = new List <int>()
                            {
                                j
                            };
                            SeqPosIndex = new List <int>()
                            {
                                k
                            };
                        }
                        else if (swapOptions[j][k] == maxValue)
                        {
                            DBIndex.Add(i);
                            SwapIndex.Add(j);
                            SeqPosIndex.Add(k);
                        }
                    }
                }
            }
            Console.WriteLine();
            return(new KeyValuePair <int, List <List <int> > >(maxValue, new List <List <int> >()
            {
                DBIndex, SwapIndex, SeqPosIndex
            }));
        }