-
Notifications
You must be signed in to change notification settings - Fork 0
/
main_multiple_prediction.py
29 lines (25 loc) · 1.21 KB
/
main_multiple_prediction.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
from src import fastqc_extract, data_preparation, feature_engineering, ml_model
#import sys
def main (data_dir, model_dir, exports_dir, organism):
if organism not in ['Ecoli', 'Efcm', 'Sau']:
organism = 'complete_data'
ngs_reads = fastqc_extract.import_all_reads(data_dir, exports_dir, include_metadata=False)
filenames = ngs_reads.index
ngs_reads = data_preparation.prepare_fastqc_data(ngs_reads)
ngs_reads = feature_engineering.apply_feature_engineering(ngs_reads, exports_dir)
pred = ml_model.predict_evaluation(ngs_reads, model_dir+'/model_rf_'+organism+'.pkl')
with open(exports_dir+'/evaluations.txt', 'w') as f:
for id, prediction in enumerate(pred):
f.write(filenames[id]+': ')
if prediction == 0:
print(filenames[id]+ ': ugly')
f.write('ugly\n')
elif prediction == 1:
print(filenames[id]+ ': good')
f.write('good\n')
if __name__ == "__main__":
data_dir = 'test_data/all' #sys.argv[1]
model_dir = 'models' #sys.argv[2]
exports_dir = 'exports_evaluation_multiple' #sys.argv[3]
organism = 'complete_data' #sys.argv[4]
main(data_dir, model_dir, exports_dir, organism)