def summarize_pcoas(master_pcoa, support_pcoas, method='IQR', apply_procrustes=True):
 if apply_procrustes:
  support_pcoas = [list(sp) for sp in support_pcoas]
  master_pcoa = list(master_pcoa)
  for (i, pcoa) in enumerate(support_pcoas):
   (master_std, pcoa_std, m_squared) = procrustes(master_pcoa[1], pcoa[1])
   support_pcoas[i][1] = pcoa_std
  master_pcoa[1] = master_std
 m_matrix = master_pcoa[1]
 m_eigvals = master_pcoa[2]
 m_names = master_pcoa[0]
 jn_flipped_matrices = []
 all_eigvals = []
 for rep in support_pcoas:
  matrix = rep[1]
  eigvals = rep[2]
  all_eigvals.append(eigvals)
  jn_flipped_matrices.append(_flip_vectors(matrix, m_matrix))
 (matrix_average, matrix_low, matrix_high) = _compute_jn_pcoa_avg_ranges(jn_flipped_matrices, method)
 all_eigvals_stack = vstack(all_eigvals)
 eigval_sum = np_sum(all_eigvals_stack, axis=0)
 eigval_average = (eigval_sum / float(len(all_eigvals)))
 return (matrix_average, matrix_low, matrix_high, eigval_average, m_names)

def summarize_pcoas ( master_pcoa , support_pcoas , method = 'IQR' , apply_procrustes = True ) : if apply_procrustes : support_pcoas = [ list ( sp ) for sp in support_pcoas ] master_pcoa = list ( master_pcoa ) for ( i , pcoa ) in enumerate ( support_pcoas ) : ( master_std , pcoa_std , m_squared ) = procrustes ( master_pcoa [ 1 ] , pcoa [ 1 ] ) support_pcoas [ i ] [ 1 ] = pcoa_std master_pcoa [ 1 ] = master_std m_matrix = master_pcoa [ 1 ] m_eigvals = master_pcoa [ 2 ] m_names = master_pcoa [ 0 ] jn_flipped_matrices = [ ] all_eigvals = [ ] for rep in support_pcoas : matrix = rep [ 1 ] eigvals = rep [ 2 ] all_eigvals . append ( eigvals ) jn_flipped_matrices . append ( _flip_vectors ( matrix , m_matrix ) ) ( matrix_average , matrix_low , matrix_high ) = _compute_jn_pcoa_avg_ranges ( jn_flipped_matrices , method ) all_eigvals_stack = vstack ( all_eigvals ) eigval_sum = np_sum ( all_eigvals_stack , axis = 0 ) eigval_average = ( eigval_sum / float ( len ( all_eigvals ) ) ) return ( matrix_average , matrix_low , matrix_high , eigval_average , m_names )
returns the average pcoa vector values for the support pcoas also returns the ranges as calculated with the specified method .