In [1]:
# settings and modules
%config InlineBackend.figure_format = 'retina'
%pylab inline
from nsaba.nsaba import nsaba
from nsaba.nsaba import analysis
In [2]:
ns_path = "/Users/Torben/Documents/ABI analysis/current_data_new/"
aba_path = '/Users/Torben/Documents/ABI analysis/normalized_microarray_donor9861/'
#nsaba.Nsaba.aba_load(aba_path)
nsaba.Nsaba.ns_load(ns_path)
nsaba.Nsaba.aba_load(aba_path)
N = nsaba.Nsaba()
N.load_ge_pickle(pkl_file='/Users/Torben/Documents/ABI analysis/normalized_microarray_donor9861/Nsaba_ABA_ge.pkl')
In [3]:
N.get_ns_act('depression', thresh=-1, method='knn',smoothing='sum')
N.get_ns_act('dopamine', thresh=-1, method='knn',smoothing='sum')
N.get_ns_act('reward', thresh=-1, method='knn',smoothing='sum')
N.get_ns_act('serotonin', thresh=-1, method='knn',smoothing='sum')
N.get_ns_act('anxiety', thresh=-1, method='knn',smoothing='sum')
N.get_ns_act('schizophrenia', thresh=-1, method='knn',smoothing='sum')
In [4]:
depression_genes = analysis.load_gene_list('/Users/Torben/Documents/ABI analysis/gene_collections/','DepressionGenes.csv')
dopamine_genes = analysis.load_gene_list('/Users/Torben/Documents/ABI analysis/gene_collections/','DopamineGenes2.csv')
reward_genes = analysis.load_gene_list('/Users/Torben/Documents/ABI analysis/gene_collections/','rewardGenes2.csv')
serotonin_genes = analysis.load_gene_list('/Users/Torben/Documents/ABI analysis/gene_collections/','SerotoninGenes.csv')
anxiety_genes = analysis.load_gene_list('/Users/Torben/Documents/ABI analysis/gene_collections/','AnxietyGenes.csv')
schizophrenia_genes = analysis.load_gene_list('/Users/Torben/Documents/ABI analysis/gene_collections/','SchizophreniaGenes.csv')
In [5]:
import scipy.stats as stats
A = analysis.NsabaAnalysis(N)
all_analyses = np.zeros((6,4))
methods = ['pearson','spearman','regression','t_test']
for m in xrange(len(methods)):
all_analyses[0,m]= stats.ttest_1samp(A.validate_with_t_test('depression',depression_genes,method=methods[m],quant=85)[0],0)[1]
all_analyses[1,m]= stats.ttest_1samp(A.validate_with_t_test('dopamine',dopamine_genes,method=methods[m],quant=85)[0],0)[1]
all_analyses[2,m]= stats.ttest_1samp(A.validate_with_t_test('reward',reward_genes,method=methods[m],quant=85)[0],0)[1]
all_analyses[3,m]= stats.ttest_1samp(A.validate_with_t_test('serotonin',serotonin_genes,method=methods[m],quant=85)[0],0)[1]
all_analyses[4,m]= stats.ttest_1samp(A.validate_with_t_test('anxiety',anxiety_genes,method=methods[m],quant=85)[0],0)[1]
all_analyses[5,m]= stats.ttest_1samp(A.validate_with_t_test('schizophrenia',schizophrenia_genes,method=methods[m],quant=85)[0],0)[1]
print all_analyses
In [ ]:
t_test_analyses = np.zeros((6,6))
quants = [50,75,85,95]
for q in xrange(len(quants)):
t_test_analyses[0,q]= stats.ttest_1samp(A.validate_with_t_test('depression',depression_genes,quant=quants[q])[0],0)[1]
t_test_analyses[1,q]= stats.ttest_1samp(A.validate_with_t_test('dopamine',dopamine_genes,quant=quants[q])[0],0)[1]
t_test_analyses[2,q]= stats.ttest_1samp(A.validate_with_t_test('reward',reward_genes,quant=quants[q])[0],0)[1]
t_test_analyses[3,q]= stats.ttest_1samp(A.validate_with_t_test('serotonin',serotonin_genes,quant=quants[q])[0],0)[1]
t_test_analyses[4,q]= stats.ttest_1samp(A.validate_with_t_test('anxiety',anxiety_genes,quant=quants[q])[0],0)[1]
t_test_analyses[5,q]= stats.ttest_1samp(A.validate_with_t_test('schizophrenia',schizophrenia_genes,quant=quants[q])[0],0)[1]
methods = ['kmeans','mog']
for m in xrange(len(methods)):
t_test_analyses[0,m+4]= stats.ttest_1samp(A.validate_with_t_test('depression',depression_genes,split_method=methods[m])[0],0)[1]
t_test_analyses[1,m+4]= stats.ttest_1samp(A.validate_with_t_test('dopamine',dopamine_genes,split_method=methods[m])[0],0)[1]
t_test_analyses[2,m+4]= stats.ttest_1samp(A.validate_with_t_test('reward',reward_genes,split_method=methods[m])[0],0)[1]
t_test_analyses[3,m+4]= stats.ttest_1samp(A.validate_with_t_test('serotonin',serotonin_genes,split_method=methods[m])[0],0)[1]
t_test_analyses[4,m+4]= stats.ttest_1samp(A.validate_with_t_test('anxiety',anxiety_genes,split_method=methods[m])[0],0)[1]
t_test_analyses[5,m+4]= stats.ttest_1samp(A.validate_with_t_test('schizophrenia',schizophrenia_genes,split_method=methods[m])[0],0)[1]
print t_test_analyses
In [ ]:
In [30]:
In [7]:
import csv
with open('/Users/Torben/Documents/ABI analysis/validation/summed_validation.csv', 'wb') as csvfile:
spamwriter = csv.writer(csvfile)
for a in all_analyses:
spamwriter.writerow(a)
with open('/Users/Torben/Documents/ABI analysis/validation/summed_validation.csv', 'wb') as csvfile:
spamwriter = csv.writer(csvfile)
for a in t_test_analyses:
spamwriter.writerow(a)
In [12]:
a= A.validate_with_t_test('anxiety',anxiety_genes,split_method=methods[m])[0]
In [8]:
[1 for t in xrange(10)]
Out[8]:
In [ ]: