2017-03-06 1 views
0

현재 다중 서열 정렬에서 각 아미노산 위치의 보존을 계산하려고합니다. BioConductor에서 "msa"를 사용하여 분석을 수행합니다. 이를 통해 ClustalW를 사용하여 다중 시퀀스 정렬을 수행합니다. 이것은 나에게 내가 ClustalW에 그것의 계산에 BLOSUM80 행렬을 사용하여 알고 유사한 정렬 ...서열 정렬에서 각 위치의 보존 계산

[1] FEYLKLLGKGTFGKVILVKEKATG...KKDPKQRLGGGSEDAKEIMQHRFF 
[2] FDYLKLLGKGTFGKVILVREKATG...KKDPKQRLGGGPSDAKEVMEHRFF 
[3] FDYLKLLGKGTFGKVILVREKASG...IKDPNKRLGGGPDDAKEIMRHSFF 
[4] FIFMEVLGSGAFSEVFLVKQRLTG...EKDPNERY-----TCEKALSHPWI 
[5] YRLEKTLGKGQTGLVKLGVHCVTC...EVDAARRL-----TLEHIQKHIWY 
[6] ITMKHKLGGGQYGEVYEGVWKKYS...QWNPSDRP-----SFAEIHQAF-- 
... 

을 제공하지만이 명령은 각 위치에서 보존을 인쇄 할 수 있습니다 인수를 찾을 수 없습니다. 내가 찾은 가장 가까운 쌍에 대한 점수의 BLOSUM80의 페어 매트릭스와 결합과 같은 약간 보이는 보존 매트릭스 출력 ...

v1 v2 v3 v4 v5 ... 
- 2 2 1 0 0 
A 0 1 0 1 0 
C 0 0 0 0 0 
D 0 2 0 1 0 
E 0 1 0 1 10 
F 4 0 2 0 0 
... 

이 정보를 사용하는 방법이 있나요은, 합계를 계산하는 것입니다 정렬의 각 정렬 된 위치 ??

제공 할 수있는 도움이나 조언을 주셔서 감사합니다.

행복을 빌며,

나탈리

+0

는 메가 소프트웨어 확인은, 거기 당신은 많이 찾을 수 있습니다 거리의 합계를 계산하기위한 것입니다. d 알고리즘에 대한 이해를 가지고, 어렵지 않게 구현하고, 트리플 루프 만 수행하면, 필요한 경우 C# 구현 코드를 보여줄 수 있습니다. –

+0

안녕하세요 @ RicardoOrtegaMagaña - 만약 당신이 나에게 정말 감사하겠습니다 쌍의 합계의 C#을 구현에 대한 코드를 보여주는 상관 없어. 감사 – NatalieStephenson

답변

0

이 기능은 객체의 숯을 (seqToAlign) 목록의 목록을 가지고 있고, BLOSUM62 또는 간단한 갭 페널티 상수를 사용하여 쌍 합계 점수 수, 무시하세요 코드의 여분의 라인, 나는 그 기능에 문제가 있었기 때문에 나는 제대로 작동하는지, 그리고 그것을 연마 할 시간이 없는지 확인해야했다. 그리고 명료하게하기 위해 나의 나쁜 영어.

/// <summary> 
    /// Scoring matrix BLOSUM62 
    /// Matrix is ordered by the English alphabet to compare, on missing letter is assigned an arbitrary value 
    /// example Blosum62 structure: 
    ///  A B C D E F G .... 
    /// A 4 -2 0 -2 -1 -2 0 .... 
    /// B -2 4 -3 4 1 -3 -1 .... 
    /// C 0 -3 9 -3 -4 -2 -3 .... 
    /// D -2 4 -3 6 2 -3 -1 .... 
    /// . . . . . . . . .... 
    /// . . . . . . . . .... 
    /// . . . . . . . . .... 
    /// </summary> 
    private int[][] Blosum62; 

그리고 갭 기능 :

public int gap(string val) 
    { 
     if (val == "gap-gap") { return gapgap; } 
     if (val == "gap opening") { return gapopening; } 
     if (val == "gap mismatch") { return gapmismatch; } 
     return 0; 
    } 

BLOSUM62 매트릭스 : BLOSUM62는

/// <summary> 
    /// Score function using a substitution matrix [matrixSub] for pairwise comparison or blank matrixSub for 
    /// penalty of S(Letter, dash)=-2, S(Different Letters)=-1, S(Same letters)=1 , S(dashes)=0 
    /// Optional parameters: Start, End to manage to score from sequence[Start] to sequence[end] 
    /// </summary> 
    /// <returns>int with sum of all scoring combinations of columns between sequences</returns> 
    public int sumOfPairs(String matrixSub = "Blosum62", int start = 0, int end = -1) 
    { 
     if (matrixSub == "Blosum62") 
     { 
      int backGM = gap(2); 

      //gap(gap(0), gap(1), -10); 

      int sum = 0; 
      int totsum = 0; 
      int k = seqToAlign.longest(); 
      for (int c = 0; c != k; c++) 
      { 
       sum = 0; 
       for (int seq = 0; seq != seqToAlign.count(); seq++) 
       { 
        for (int seqToCompare = seq; seqToCompare != seqToAlign.count(); seqToCompare++) 
        { 
         if (seqToCompare != seq) 
         { 
          if (c < seqToAlign.sequences.ElementAt(seq).Count && c < seqToAlign.sequences.ElementAt(seqToCompare).Count) 
          { 
           if (seqToAlign.sequences.ElementAt(seq).ElementAt(c) - 65 < 27 && seqToAlign.sequences.ElementAt(seq).ElementAt(c) - 65 >= 0 && seqToAlign.sequences.ElementAt(seqToCompare).ElementAt(c) - 65 < 27 && seqToAlign.sequences.ElementAt(seqToCompare).ElementAt(c) - 65 >= 0) 
           { 
            sum += Blosum62[seqToAlign.sequences.ElementAt(seq).ElementAt(c) - 65][seqToAlign.sequences.ElementAt(seqToCompare).ElementAt(c) - 65]; 
           } 
           else 
           { 
            if (seqToAlign.sequences.ElementAt(seq).ElementAt(c) == seqToAlign.sequences.ElementAt(seqToCompare).ElementAt(c)) 
            { 
             sum += gap("gap-gap"); 
            } 
            else 
            { 
             sum += gap("mismatch"); 
            } 
           } 
          } 
          else 
          { 
           sum += gap("mismatch"); 
          } 
         } 
        } 
       } 
       totsum += sum; 
       sum = 0; 
      } 
      //gap(gap(0), gap(1), backGM); 
      return totsum; 
     } 
     else 
     { 
      int st = 0, en = 0; 
      if (start < 0) { st = 0; } else { st = start; } 
      if (en < st || end > seqToAlign.count() || end == -1) { en = seqToAlign.count(); } else { en = end + 1; } 

      int sum = 0; 
      int totsum = 0; 
      int k = seqToAlign.longest(); 
      if (k != -1) 
      { 
       for (int c = 0; c != k; c++) 
       { 
        sum = 0; 
        for (int seq = st; seq != en; seq++) 
        { 
         for (int seqToCompare = seq; seqToCompare != en; seqToCompare++) 
         { 
          if (seqToCompare != seq) 
          { 
           if (c < seqToAlign.sequences.ElementAt(seq).Count && c < seqToAlign.sequences.ElementAt(seqToCompare).Count) 
           { 
            if (seqToAlign.sequences.ElementAt(seq).ElementAt(c) - 65 < 27 && seqToAlign.sequences.ElementAt(seq).ElementAt(c) - 65 >= 0 && seqToAlign.sequences.ElementAt(seqToCompare).ElementAt(c) - 65 < 27 && seqToAlign.sequences.ElementAt(seqToCompare).ElementAt(c) - 65 >= 0) 
            { 
             if (seqToAlign.sequences.ElementAt(seq).ElementAt(c) == seqToAlign.sequences.ElementAt(seqToCompare).ElementAt(c)) 
             { 
              sum += 1; 
             } 
             else 
             { 
              sum += -1; 
             } 
            } 
            else 
            { 
             if (seqToAlign.sequences.ElementAt(seq).ElementAt(c) == seqToAlign.sequences.ElementAt(seqToCompare).ElementAt(c)) 
             { 
              sum += 0; 
             } 
             else 
             { 
              sum += -2; 
             } 
            } 
           } 
           else 
           { 
            sum += -2; 
           } 
          } 
         } 
        } 
        totsum += sum; 
        sum = 0; 
       } 
      } 
      else 
      { 
       Console.Write("Empty sequence. Check your input file."); 
      } 
      return totsum; 
     } 
    } 

Blosum62 = new int[27][]; 
    Blosum62[0] = new int[27] { 4, -2, 0, -2, -1, -2, 0, -2, -1, -4, -1, -1, -1, -2, -4, -1, -1, -1, 1, 0, -4, 0, -3, -20, -2, -1, -4 }; 
    Blosum62[1] = new int[27] { -2, 4, -3, 4, 1, -3, -1, 0, -3, -4, 0, -4, -3, 3, -4, -2, 0, -1, 0, -1, -4, -3, -4, -20, -3, 1, -4 }; 
    Blosum62[2] = new int[27] { 0, -3, 9, -3, -4, -2, -3, -3, -1, -4, -3, -1, -1, -3, -4, -3, -3, -3, -1, -1, -4, -1, -2, -20, -2, -3, -4 }; 
    Blosum62[3] = new int[27] { -2, 4, -3, 6, 2, -3, -1, -1, -3, -4, -1, -4, -3, 1, -4, -1, 0, -2, 0, -1, -4, -3, -4, -20, -3, 1, -4 }; 
    Blosum62[4] = new int[27] { -1, 1, -4, 2, 5, -3, -2, 0, -3, -4, 1, -3, -2, 0, -4, -1, 2, 0, 0, -1, -4, -2, -3, -20, -2, 4, -4 }; 
    Blosum62[5] = new int[27] { -2, -3, -2, -3, -3, 6, -3, -1, 0, -4, -3, 0, 0, -3, -4, -4, -3, -3, -2, -2, -4, -1, 1, -20, 3, -3, -4 }; 
    Blosum62[6] = new int[27] { 0, -1, -3, -1, -2, -3, 6, -2, -4, -4, -2, -4, -3, 0, -4, -2, -2, -2, 0, -2, -4, -3, -2, -20, -3, -2, -4 }; 
    Blosum62[7] = new int[27] { -2, 0, -3, -1, 0, -1, -2, 8, -3, -4, -1, -3, -2, 1, -4, -2, 0, 0, -1, -2, -4, -3, -2, -20, 2, 0, -4 }; 
    Blosum62[8] = new int[27] { -1, -3, -1, -3, -3, 0, -4, -3, 4, -4, -3, 2, 1, -3, -4, -3, -3, -3, -2, -1, -4, 3, -3, -20, -1, -3, -4 }; 
    Blosum62[9] = new int[27] { -4, -4, -4, -4, -4, -4, -4, -4, -4, 1, -4, -4, -4, -4, 1, -4, -4, -4, -4, -4, 1, -4, -4, -20, -4, -4, 1 }; 
    Blosum62[10] = new int[27] { -1, 0, -3, -1, 1, -3, -2, -1, -3, -4, 5, -2, -1, 0, -4, -1, 1, 2, 0, -1, -4, -2, -3, -20, -2, 1, -4 }; 
    Blosum62[11] = new int[27] { -1, -4, -1, -4, -3, 0, -4, -3, 2, -4, -2, 4, 2, -3, -4, -3, -2, -2, -2, -1, -4, 1, -2, -20, -1, -3, -4 }; 
    Blosum62[12] = new int[27] { -1, -3, -1, -3, -2, 0, -3, -2, 1, -4, -1, 2, 5, -2, -4, -2, 0, -1, -1, -1, -4, 1, -1, -20, -1, -1, -4 }; 
    Blosum62[13] = new int[27] { -2, 3, -3, 1, 0, -3, 0, 1, -3, -4, 0, -3, -2, 6, -4, -2, 0, 0, 1, 0, -4, -3, -4, -20, -2, 0, -4 }; 
    Blosum62[14] = new int[27] { -4, -4, -4, -4, -4, -4, -4, -4, -4, 1, -4, -4, -4, -4, 1, -4, -4, -4, -4, -4, 1, -4, -4, -20, -4, -4, 1 }; 
    Blosum62[15] = new int[27] { -1, -2, -3, -1, -1, -4, -2, -2, -3, -4, -1, -3, -2, -2, -4, 7, -1, -2, -1, -1, -4, -2, -4, -20, -3, -1, -4 }; 
    Blosum62[16] = new int[27] { -1, 0, -3, 0, 2, -3, -2, 0, -3, -4, 1, -2, 0, 0, -4, -1, 5, 1, 0, -1, -4, -2, -2, -20, -1, 3, -4 }; 
    Blosum62[17] = new int[27] { -1, -1, -3, -2, 0, -3, -2, 0, -3, -4, 2, -2, -1, 0, -4, -2, 1, 5, -1, -1, -4, -3, -3, -20, -2, 0, -4 }; 
    Blosum62[18] = new int[27] { 1, 0, -1, 0, 0, -2, 0, -1, -2, -4, 0, -2, -1, 1, -4, -1, 0, -1, 4, 1, -4, -2, -3, -20, -2, 0, -4 }; 
    Blosum62[19] = new int[27] { 0, -1, -1, -1, -1, -2, -2, -2, -1, -4, -1, -1, -1, 0, -4, -1, -1, -1, 1, 5, -4, 0, -2, -20, -2, -1, -4 }; 
    Blosum62[20] = new int[27] { -4, -4, -4, -4, -4, -4, -4, -4, -4, 1, -4, -4, -4, -4, 1, -4, -4, -4, -4, -4, 1, -4, -4, -20, -4, -4, 1 }; 
    Blosum62[21] = new int[27] { 0, -3, -1, -3, -2, -1, -3, -3, 3, -4, -2, 1, 1, -3, -4, -2, -2, -3, -2, 0, -4, 4, -3, -20, -1, -2, -4 }; 
    Blosum62[22] = new int[27] { -3, -4, -2, -4, -3, 1, -2, -2, -3, -4, -3, -2, -1, -4, -4, -4, -2, -3, -3, -2, -4, -3, 11, -20, 2, -3, -4 }; 
    Blosum62[23] = new int[27] { -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20 }; 
    Blosum62[24] = new int[27] { -2, -3, -2, -3, -2, 3, -3, 2, -1, -4, -2, -1, -1, -2, -4, -3, -1, -2, -2, -2, -4, -1, 2, -20, 7, -2, -4 }; 
    Blosum62[25] = new int[27] { -1, 1, -3, 1, 4, -3, -2, 0, -3, -4, 1, -3, -1, 0, -4, -1, 3, 0, 0, -1, -4, -2, -3, -20, -2, 4, -4 }; 
    Blosum62[26] = new int[27] { -4, -4, -4, -4, -4, -4, -4, -4, -4, 1, -4, -4, -4, -4, 1, -4, -4, -4, -4, -4, 1, -4, -4, -20, -4, -4, 1 };