"""
Function of this code: one method of feature extraciton from the numerical values.
Contact for help: gch_liu@163.com 
"""

import numpy as np
import c1_data_preprocess
data_path3=r"E:\lgc_cal2020\data_human_no_TE_2.75M\human_noTE_3000bp_2.75M.fasta"
input_data=c1_data_preprocess.start(data_path3,"seqs")
input_num=len(input_data)
#input_data.iloc[:,0].to_csv('virus_dsDNA_100bp_10M_preprossed_seq_name.txt',index=False,header=0)
input_data.iloc[:,1].to_csv('human_noTE_3000bp_2.75M_preprossed_seq_data.txt',index=False,header=0)

import seq2num
seq_test=[]
for line in open("human_noTE_3000bp_2.75M_preprossed_seq_data.txt"):  # 这里接上c0_data_preprocess.py中的输出矩阵
    seq_test.append(line)
num_seq_test=seq2num.seq2num(seq_test)
#print(num_seq_test[:,0])

# 实际计算中，这个num_seq_Test里可能有元素为NaN,
# 需要把这些NaN更换为数字0，下面两行是我增加的代码，但是运行报错！
data=np.nan_to_num(num_seq_test)

#import scipy.io as scio
import pandas as pd
#scio.savemat('s1000-4000bp.mat',{'data':data})
pd.DataFrame(data).to_csv('human_noTE_3000bp_2.75M.txt',index=False,header=None)
#h=pd.DataFrame(datapredict)
#writer=pd.ExcelWriter('virus_dsDNA_100bp_10M.75M.xlsx')
#h.to_excel(writer,header=None,index=None)
#writer.save()