|
a |
|
b/Input_files/tsv2pkl.py |
|
|
1 |
#When eigenvec or tsv are converted to PKL, the PANDAS version and model version should be the same as DNNGP. |
|
|
2 |
#So, please run the program in a DNNGP environment. |
|
|
3 |
import pandas as pd |
|
|
4 |
########Set path section |
|
|
5 |
inpath=r".\wheat599_pc95.tsv" #Set input path |
|
|
6 |
outpath=r".\wheat599_pc95.pkl" #Set output path |
|
|
7 |
|
|
|
8 |
########Conversion format section |
|
|
9 |
inpath=inpath.replace('\\','/') #Replace '\' with '/' in the input path. |
|
|
10 |
outpath=outpath.replace('\\','/') #Replace '\' with '/' in the output path. |
|
|
11 |
if "eigenvec" in inpath: |
|
|
12 |
Gene = pd.read_csv(inpath, sep='\t',header=0,index_col=1) #read eigenvec file. |
|
|
13 |
del Gene['#FID'] #Delete the '#FID' column |
|
|
14 |
Gene.to_pickle(outpath) #output pkl file |
|
|
15 |
elif "csv" in inpath: |
|
|
16 |
Gene = pd.read_csv(inpath, sep=',',header=0,index_col=0) #read csv file. |
|
|
17 |
Gene.to_pickle(outpath) #output pkl file |
|
|
18 |
else: |
|
|
19 |
Gene = pd.read_csv(inpath, sep='\t',header=0,index_col=0) #read tsv file. |
|
|
20 |
Gene.to_pickle(outpath) #output pkl file |