def run_correlation_test(data_generator, test, test_choices, pval_assignment_method, permutations=None):
 (corr_coefs, pvals) = ([], [])
 test_fn = test_choices[test]
 for (otu_vals, md_vals) in data_generator:
  r = test_fn(otu_vals, md_vals)
  if (pval_assignment_method == 'bootstrapped'):
   pval = assign_correlation_pval(r, len(otu_vals), pval_assignment_method, permutations, test_fn, otu_vals, md_vals)
  else:
   pval = assign_correlation_pval(r, len(otu_vals), pval_assignment_method)
  corr_coefs.append(r)
  pvals.append(pval)
 return (corr_coefs, pvals)

def run_correlation_test ( data_generator , test , test_choices , pval_assignment_method , permutations = None ) : ( corr_coefs , pvals ) = ( [ ] , [ ] ) test_fn = test_choices [ test ] for ( otu_vals , md_vals ) in data_generator : r = test_fn ( otu_vals , md_vals ) if ( pval_assignment_method == 'bootstrapped' ) : pval = assign_correlation_pval ( r , len ( otu_vals ) , pval_assignment_method , permutations , test_fn , otu_vals , md_vals ) else : pval = assign_correlation_pval ( r , len ( otu_vals ) , pval_assignment_method ) corr_coefs . append ( r ) pvals . append ( pval ) return ( corr_coefs , pvals )
run correlation tests .