Eitan177 commited on
Commit
a115539
·
1 Parent(s): ea9c8bb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -132,11 +132,13 @@ def dl(valforkey):
132
 
133
  #st.write(glob.glob(os.path.join(os.path.dirname(SigProfilerMatrixGenerator.__file__),'references/*txt')))
134
  with st.form('get signature'):
135
- if glob.glob(os.path.join(os.path.dirname(SigProfilerMatrixGenerator.__file__),'references/chromosomes/tsb/GRCh37/')+'*txt') == []:
136
  st.write('There is no reference genome, we need to download this')
137
  refdownload=True
138
  else:
139
- refdownload=False
 
 
140
  file_to_lookat=st.file_uploader('VCF upload here',type=[".vcf"],accept_multiple_files=True)
141
  remove_old_vcf()
142
 
@@ -148,11 +150,15 @@ if file_to_lookat !=[] and sub:
148
  dirtest=os.path.dirname(SigProfilerMatrixGenerator.__file__)
149
 
150
  #st.write(sys.path)
151
- if refdownload==True:
 
152
  with st.spinner('downloading hg19 reference'):
153
  urllib.request.urlretrieve('https://dl.dropboxusercontent.com/s/et97ewsct862x7m/references.zip?dl=0','references.zip')
154
  with zipfile.ZipFile('references.zip', 'r') as zip_ref:
155
  zip_ref.extractall(dirtest)
 
 
 
156
  #seev=glob.glob(dirtest+'/references/chromosomes/tsb/GRCh37/*txt')
157
  #for i in seev:
158
  # st.write(i)
 
132
 
133
  #st.write(glob.glob(os.path.join(os.path.dirname(SigProfilerMatrixGenerator.__file__),'references/*txt')))
134
  with st.form('get signature'):
135
+ if glob.glob(os.path.join(os.path.dirname(SigProfilerMatrixGenerator.__file__),'references/chromosomes/tsb/GRCh3[78]/')+'*txt') == []:
136
  st.write('There is no reference genome, we need to download this')
137
  refdownload=True
138
  else:
139
+ st.write('using reference from here:'+glob.glob(os.path.join(os.path.dirname(SigProfilerMatrixGenerator.__file__),'references/chromosomes/tsb/GRCh3[78]/'))[0])
140
+ refdownload=False
141
+ referencegenome =st.radio('reference',['hg19','GRCh38'])
142
  file_to_lookat=st.file_uploader('VCF upload here',type=[".vcf"],accept_multiple_files=True)
143
  remove_old_vcf()
144
 
 
150
  dirtest=os.path.dirname(SigProfilerMatrixGenerator.__file__)
151
 
152
  #st.write(sys.path)
153
+ if refdownload==True and referencegenome=='hg19':
154
+
155
  with st.spinner('downloading hg19 reference'):
156
  urllib.request.urlretrieve('https://dl.dropboxusercontent.com/s/et97ewsct862x7m/references.zip?dl=0','references.zip')
157
  with zipfile.ZipFile('references.zip', 'r') as zip_ref:
158
  zip_ref.extractall(dirtest)
159
+ elif refdownload==True and referencegenome=='GRCh38':
160
+ with st.spinner('downloading GRCh38 reference'):
161
+ genInstall.install('GRCh38')
162
  #seev=glob.glob(dirtest+'/references/chromosomes/tsb/GRCh37/*txt')
163
  #for i in seev:
164
  # st.write(i)