def grouped_correlation_formatter(bt, rhos, pvals, f_rhos, f_pvals, f_hs, grouping_category, category_values, md_key):
 header = (((['OTU'] + [('Rho_%s:%s' % (grouping_category, c)) for c in category_values]) + [('Pval_%s:%s' % (grouping_category, c)) for c in category_values]) + ['Fisher population correlation', 'Fisher combined p', 'Homogeneity pval', md_key])
 num_lines = len(f_rhos)
 lines = [' DCTB '.join(header)]
 for i in range(num_lines):
  tmp_rhos = [x[i] for x in rhos]
  tmp_pvals = [x[i] for x in pvals]
  tmp = ((((([bt.ids(axis='observation')[i]] + tmp_rhos) + tmp_pvals) + [f_rhos[i]]) + [f_pvals[i]]) + [f_hs[i]])
  lines.append(' DCTB '.join(map(str, tmp)))
 nls = _add_metadata(bt, md_key, lines)
 return nls

def grouped_correlation_formatter ( bt , rhos , pvals , f_rhos , f_pvals , f_hs , grouping_category , category_values , md_key ) : header = ( ( ( [ 'OTU' ] + [ ( 'Rho_%s:%s' % ( grouping_category , c ) ) for c in category_values ] ) + [ ( 'Pval_%s:%s' % ( grouping_category , c ) ) for c in category_values ] ) + [ 'Fisher population correlation' , 'Fisher combined p' , 'Homogeneity pval' , md_key ] ) num_lines = len ( f_rhos ) lines = [ ' DCTB ' . join ( header ) ] for i in range ( num_lines ) : tmp_rhos = [ x [ i ] for x in rhos ] tmp_pvals = [ x [ i ] for x in pvals ] tmp = ( ( ( ( ( [ bt . ids ( axis = 'observation' ) [ i ] ] + tmp_rhos ) + tmp_pvals ) + [ f_rhos [ i ] ] ) + [ f_pvals [ i ] ] ) + [ f_hs [ i ] ] ) lines . append ( ' DCTB ' . join ( map ( str , tmp ) ) ) nls = _add_metadata ( bt , md_key , lines ) return nls
format output from longitudinal tests to be written .