Eitan177 commited on
Commit
f20d780
·
1 Parent(s): 12e0d60

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -2
app.py CHANGED
@@ -13,6 +13,10 @@ import numpy as np
13
  import pandas as pd
14
  import base64
15
  import streamlit.components.v1 as components
 
 
 
 
16
 
17
  curdir= os.getcwd()
18
 
@@ -214,6 +218,11 @@ if file_to_lookat !=[] and sub:
214
  else:
215
  table_of_penn_file=pd.read_excel(file_to_lookat[j])
216
  tovcf=pd.DataFrame()
 
 
 
 
 
217
  tovcf['Chrom']=table_of_penn_file['Chrom']
218
  tovcf['Pos']=table_of_penn_file['Pos']
219
  tovcf['db']='.'
@@ -226,10 +235,10 @@ if file_to_lookat !=[] and sub:
226
  st.write(nameuse)
227
  with open(nameuse,"rb") as txt_file:
228
  bytes_data=txt_file.read()
229
- txt_file.close()
230
  with open(os.path.join("input",nameuse),"wb") as f:
231
  f.write(bytes_data)
232
- f.close()
233
  seev=glob.glob('input/*')
234
  #for i in seev:
235
  # st.write(i)
 
13
  import pandas as pd
14
  import base64
15
  import streamlit.components.v1 as components
16
+ from liftover import get_lifter
17
+
18
+ converter = get_lifter('hg38', 'hg19')
19
+
20
 
21
  curdir= os.getcwd()
22
 
 
218
  else:
219
  table_of_penn_file=pd.read_excel(file_to_lookat[j])
220
  tovcf=pd.DataFrame()
221
+ table_of_penn_file=table_of_penn_file.iloc[1:,:]
222
+ tt=table_of_penn_file[['Chrom','Pos']].apply(lambda x: converter[x[0]][int(x[1])][0],axis=1)
223
+ table_of_penn_file['Chrom']= [a[0] for a in tt]
224
+ table_of_penn_file['Pos']= [a[1] for a in tt]
225
+
226
  tovcf['Chrom']=table_of_penn_file['Chrom']
227
  tovcf['Pos']=table_of_penn_file['Pos']
228
  tovcf['db']='.'
 
235
  st.write(nameuse)
236
  with open(nameuse,"rb") as txt_file:
237
  bytes_data=txt_file.read()
238
+ txt_file.close()
239
  with open(os.path.join("input",nameuse),"wb") as f:
240
  f.write(bytes_data)
241
+ f.close()
242
  seev=glob.glob('input/*')
243
  #for i in seev:
244
  # st.write(i)