def get_fdr_cutoffs( self, identifier, timestamp, alphas=[.05]): """ By benjamini-hochberg """ res = DataForDisplay.get(identifier, timestamp) s3 = boto.connect_s3() bucket = s3.get_bucket( res.data_bucket ) k = bucket.get_key( res.data_file ) with tempfile.TemporaryFile() as fp: k.get_contents_to_file(fp) fp.seek(0) res = stat.get_fdr_cutoffs(fp, alphas=alphas) return res
def set_qval_table( self, identifier, timestamp ): res = DataForDisplay.get(identifier, timestamp) s3 = boto.connect_s3() bucket = s3.get_bucket( res.data_bucket ) k = bucket.get_key( res.data_file ) with tempfile.TemporaryFile() as fp: k.get_contents_to_file(fp) fp.seek(0) qv = stat.get_qval_table(fp) with tempfile.TemporaryFile() as fp2: qv.to_csv( fp2, sep='\t', index_label='networks' ) fp2.seek(0) k = Key(bucket) k.key = 'qvals-' + identifier + '-' + timestamp + '.tsv' k.set_contents_from_file(fp2) res.qvalue_file = 'qvals-' + identifier + '-' + timestamp + '.tsv' res.save()