-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathload.py
52 lines (42 loc) · 1.64 KB
/
load.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
from joblib import load
from statistics import statisticsClass
import argparse
import pandas as pd
import numpy as np
from sklearn.preprocessing import StandardScaler
import os
parser = argparse.ArgumentParser()
parser.add_argument("--o", type=str, help="The File Name")
parser.add_argument("--m", type=str, help="Model Name")
args = parser.parse_args()
inputFileStatistics = statisticsClass()
fileName = "oneSampIn"
if (args.o):
fileName = str(args.o)
else:
print("WARNING:main: No filename provided. Using oneSampIn")
modelName = "oneSampIn"
if (args.m):
modelName = str(args.m)
else:
print("WARNING:main: No filename provided. Using oneSampIn")
# t = time.time()
inputFileStatistics.readData(fileName)
inputFileStatistics.filterIndividuals(0.2)
inputFileStatistics.filterLoci(0.2)
#if (args.n):
# inputFileStatistics.filterMonomorphicLoci()
inputFileStatistics.test_stat1()
inputFileStatistics.test_stat2()
inputFileStatistics.test_stat3()
inputFileStatistics.test_stat5()
inputFileStatistics.test_stat4()
inputStatsList = [str(inputFileStatistics.stat1), str(inputFileStatistics.stat2), str(inputFileStatistics.stat3),
str(inputFileStatistics.stat4), str(inputFileStatistics.stat5)]
inputStatsList = pd.DataFrame([inputStatsList], columns=['Emean_exhyt', 'Fix_index', 'Mlocus_homozegosity_mean', 'Mlocus_homozegosity_variance', 'Gametic_disequilibrium'])
Z = np.array(inputStatsList[['Emean_exhyt','Fix_index','Mlocus_homozegosity_mean','Mlocus_homozegosity_variance','Gametic_disequilibrium']])
name, ext = os.path.splitext(modelName)
model = load(modelName)
res = model.predict(Z)
print(res)
print("chosen Alpha: ", model.alpha_)