Author: bugman Date: Mon Jan 26 19:11:26 2015 New Revision: 27317 URL: http://svn.gna.org/viewcvs/relax?rev=27317&view=rev Log: Bug fixes for the new lib.structure.internal.coordinates.common_residues() function. This function for determining the common residues between multiple sets of pairwise alignments was failing in quite a number of cases. The logic has been updated to handle these. Modified: trunk/lib/structure/internal/coordinates.py Modified: trunk/lib/structure/internal/coordinates.py URL: http://svn.gna.org/viewcvs/relax/trunk/lib/structure/internal/coordinates.py?rev=27317&r1=27316&r2=27317&view=diff ============================================================================== --- trunk/lib/structure/internal/coordinates.py (original) +++ trunk/lib/structure/internal/coordinates.py Mon Jan 26 19:11:26 2015 @@ -339,6 +339,11 @@ if skip[0][j]: sys.stdout.write("-") + # A gap, so skip the residue. + elif gap_matrices[0][0, j]: + sys.stdout.write("-") + sys.stdout.write(one_letter_codes[0][j]) + # Keep the residue. else: sys.stdout.write(one_letter_codes[0][j]) @@ -355,12 +360,7 @@ # Loop over the residues of alignment mol_index. seq1_index = -1 seq2_index = -1 - for j in range(max(res_counts)): - # No more residues. - if j >= len(gap_matrices[mol_index-1][1]): - sys.stdout.write("-") - continue - + for j in range(len(gap_matrices[mol_index-1][0])): # Increment the sequence indices. if not gap_matrices[mol_index-1][0, j]: seq1_index += 1 @@ -386,7 +386,7 @@ # Already skipped in the first molecule. elif skip[0][seq1_index] and not gap_matrices[mol_index-1][1, j]: - skip[mol_index][seq2_index] = 1 + skip[mol_index][seq1_index] = 1 skip_counts[mol_index] += 1 sys.stdout.write("-")