from __future__ import print_function import setup from os.path import join from dev_stages import dev_stages from scalers import LogScaler from project_dirs import results_dir filename = join(results_dir(), 'dev-stages.txt') with open(filename, 'w') as f: scaler = LogScaler() header = '{:<30} {:<8} {:<10} {:<10}'.format('Full Name', 'Label', 'Age', 'Log Scale') print(header, file=f) print(len(header) * '-', file=f) for stage in dev_stages: name = stage.name short_name = stage.short_name age = stage.central_age log_age = stage.scaled(scaler).central_age print('{:<30} {:<8} {:<10.3g} {:<10.3g}'.format( name, short_name, age, log_age), file=f)
fontsize=xtick_fontsize, fontstretch='condensed', rotation=90) # set y ticks (first and last only) ax.set_ylabel('expression level', fontsize=fontsize) ticks = ax.get_yticks() ticks = np.array([ticks[0], ticks[-1]]) ax.set_yticks(ticks) ax.set_yticklabels(['{:g}'.format(t) for t in ticks], fontsize=fontsize) return fig cfg.verbosity = 1 age_scaler = LogScaler() data = GeneData.load('both').scale_ages(age_scaler) shapes = [ Sigmoid('sigmoid_wide'), Poly(1, 'poly1'), Poly(3, 'poly3'), Spline() ] GRs = [ ('ADRB1', 'A1C', (5, 8)), ('GLRA2', 'STC', (5, 12)), ('TUBA1A', 'V1C', (10, 14)), ]
import setup from load_data import load_data import numpy as np import scipy as sp import matplotlib as mpl import matplotlib.pyplot as plt from plots import * from all_fits import * import config as cfg from fitter import Fitter from shapes.sigmoid import Sigmoid from shapes.spline import Spline from scalers import LogScaler cfg.verbosity = 1 data = load_data(pathway='serotonin', scaler=LogScaler()) series = data.get_one_series('HTR1A', 'MD') x = series.ages y = series.single_expression fitter = Fitter(Spline()) theta, sigma, LOO_predictions, _ = fitter.fit(x, y) spline = theta[0] preds = spline(x) print preds