Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="seq1">The peptide to be queried</param>
        /// <param name="theDB">The sequence database</param>
        /// <returns></returns>
        public List <List <int[]> > SwapAlignBulk(char[] seq1, List <FastaItem> theDB)
        {
            List <char[]> seq1Swapped = Swapper.Swap(seq1);

            Console.WriteLine("------------------------------- Swap solutions ---------------------------------");
            for (int i = 0; i < seq1Swapped.Count; i++)
            {
                Console.WriteLine("{0}:{1}", i, new string(seq1Swapped[i]));
            }

            Console.WriteLine("\n-------------------------------------------------------------------------------\n");

            List <List <int[]> > returnResult = new List <List <int[]> >(seq1Swapped.Count);

            int counter = 0;

            foreach (FastaItem fi in theDB)
            {
                counter++;
                if (counter % 100 == 0)
                {
                    Console.WriteLine("DB item " + counter);
                }

                List <int[]> alignmentResult = SWAPAlign2(seq1, fi.Sequence.ToCharArray());

                if (alignmentResult != null)
                {
                    returnResult.Add(alignmentResult);
                }
            }
            return(returnResult);
        }
Ejemplo n.º 2
0
        public double SimilarityScore(KeyValuePair <int, List <List <int> > > PBSA, List <FastaItem> DB, List <List <int[]> > swapBulk, char [] seq1)
        {
            List <char[]> seq1Swapped = Swapper.Swap(seq1);

            double score = 0;
            int    cont  = 0;

            for (int i = 0; i < PBSA.Value[0].Count; i++)
            {
                for (int j = 0; j < swapBulk[0].Count; j++)
                {
                    for (int k = 0; k < seq1Swapped[0].Length; k++)
                    {
                        if (DB[PBSA.Value[0][i]].Sequence[k].ToString() != seq1Swapped[j][k].ToString())
                        {
                            score = swapBulk[i][j][k] + score;
                            cont++;
                        }
                    }
                }
            }

            score = score / cont;
            return(score);
        }
Ejemplo n.º 3
0
        public List <int[]> SWAPAlign2(char[] seq1, char[] seq2)
        {
            List <char[]> seq1Swapped  = Swapper.Swap(seq1);
            List <int[]>  returnResult = new List <int[]>(seq1Swapped.Count);


            for (int y = 0; y < seq1Swapped.Count; y++)
            {
                Debug.Write(new string (seq1Swapped[y]) + "\n");
                int[] result = Align(seq1Swapped[y], seq2);
                returnResult.Add(result);
            }

            return(returnResult);
        }
Ejemplo n.º 4
0
        public int IdentitylScore(KeyValuePair <int, List <List <int> > > PBSA, List <FastaItem> DB, List <List <int[]> > swapBulk, char[] seq1)
        {
            List <char[]> seq1Swapped = Swapper.Swap(seq1);

            int score = 0;

            for (int i = 0; i < PBSA.Value[0].Count; i++)
            {
                for (int j = 0; j < swapBulk[0].Count; j++)
                {
                    for (int k = 0; k < seq1Swapped[0].Length; k++)
                    {
                        if (DB[PBSA.Value[0][i]].Sequence[k].ToString() == seq1Swapped[j][k].ToString())
                        {
                            score = swapBulk[i][j][k] + score;
                        }
                    }
                }
            }

            return(score);
        }