Eitan177 commited on
Commit
e35ab95
·
1 Parent(s): 22e9212

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -9
app.py CHANGED
@@ -175,15 +175,17 @@ if file_to_lookat !=[] and sub:
175
  dirtest=os.path.dirname(SigProfilerMatrixGenerator.__file__)
176
 
177
  #st.write(sys.path)
178
- if refdownload==True and referencegenome=='hg19':
179
-
 
180
  with st.spinner('downloading hg19 reference'):
181
  urllib.request.urlretrieve('https://dl.dropboxusercontent.com/s/et97ewsct862x7m/references.zip?dl=0','references.zip')
182
  with zipfile.ZipFile('references.zip', 'r') as zip_ref:
183
  zip_ref.extractall(dirtest)
184
- elif refdownload==True and referencegenome=='GRCh38':
185
- with st.spinner('downloading GRCh38 reference'):
186
- genInstall.install('GRCh38')
 
187
  #seev=glob.glob(dirtest+'/references/chromosomes/tsb/GRCh37/*txt')
188
  #for i in seev:
189
  # st.write(i)
@@ -230,19 +232,21 @@ if file_to_lookat !=[] and sub:
230
  tovcf['alt']=table_of_penn_file['Alt']
231
  nameuse=re.sub('xlsx$','vcf',file_to_lookat[j].name)
232
  tovcf.to_csv(nameuse,sep='\t',header=False, index=False)
 
233
  st.write(table_of_penn_file)
234
- st.write(tovcf)
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
  st.write(os.path.join("input",nameuse))
241
  f.write(bytes_data)
242
  f.close()
243
  seev=glob.glob('input/*')
244
 
245
- st.write(pd.read_csv(os.path.join("input",nameuse) ))
246
  #vcfuse=glob.glob('file_to_lookat[0].name')[0]
247
  #shutil.copy2(vcfuse,'input/'+vcfuse)
248
  #pdb.set_trace()
@@ -252,7 +256,7 @@ if file_to_lookat !=[] and sub:
252
 
253
 
254
  if file_to_lookat !=[] and glob.glob('output/SBS96/Suggested_Solution/COSMIC_SBS96_Decomposed_Solution/*pdf'):
255
- sbs_result,indel_result,dbs_result,sbs_text,indel_text,dbs_text,summary_sbs,dummary_id,summary_dbs=dl(j)
256
 
257
  to_dl_sbs.append(sbs_result)
258
  to_dl_sbs_text.append(sbs_text)
 
175
  dirtest=os.path.dirname(SigProfilerMatrixGenerator.__file__)
176
 
177
  #st.write(sys.path)
178
+ if refdownload==True:
179
+ if referencegenome=='GRCh38':
180
+ st.write('using liftover with hg19 instead of downloading Grch38')
181
  with st.spinner('downloading hg19 reference'):
182
  urllib.request.urlretrieve('https://dl.dropboxusercontent.com/s/et97ewsct862x7m/references.zip?dl=0','references.zip')
183
  with zipfile.ZipFile('references.zip', 'r') as zip_ref:
184
  zip_ref.extractall(dirtest)
185
+ #elif refdownload==True and referencegenome=='GRCh38':
186
+
187
+ #with st.spinner('downloading GRCh38 reference'):
188
+ # genInstall.install('GRCh38')
189
  #seev=glob.glob(dirtest+'/references/chromosomes/tsb/GRCh37/*txt')
190
  #for i in seev:
191
  # st.write(i)
 
232
  tovcf['alt']=table_of_penn_file['Alt']
233
  nameuse=re.sub('xlsx$','vcf',file_to_lookat[j].name)
234
  tovcf.to_csv(nameuse,sep='\t',header=False, index=False)
235
+ st.write('original file read as:')
236
  st.write(table_of_penn_file)
237
+ #st.write(tovcf)
238
+ #st.write(nameuse)
239
  with open(nameuse,"rb") as txt_file:
240
  bytes_data=txt_file.read()
241
  txt_file.close()
242
  with open(os.path.join("input",nameuse),"wb") as f:
243
+ st.write('file after liftover:')
244
  st.write(os.path.join("input",nameuse))
245
  f.write(bytes_data)
246
  f.close()
247
  seev=glob.glob('input/*')
248
 
249
+ #st.write(pd.read_csv(os.path.join("input",nameuse) ))
250
  #vcfuse=glob.glob('file_to_lookat[0].name')[0]
251
  #shutil.copy2(vcfuse,'input/'+vcfuse)
252
  #pdb.set_trace()
 
256
 
257
 
258
  if file_to_lookat !=[] and glob.glob('output/SBS96/Suggested_Solution/COSMIC_SBS96_Decomposed_Solution/*pdf'):
259
+ sbs_result,indel_result,dbs_result,sbs_text,indel_text,dbs_text,summary_sbs,summary_id,summary_dbs=dl(j)
260
 
261
  to_dl_sbs.append(sbs_result)
262
  to_dl_sbs_text.append(sbs_text)