Eitan177 commited on
Commit
2db3f30
·
1 Parent(s): 73d2a6c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -8
app.py CHANGED
@@ -56,6 +56,8 @@ with st.form('get signature'):
56
  if glob.glob(os.path.join(os.path.dirname(SigProfilerMatrixGenerator.__file__),'references/chromosomes/tsb/GRCh37/')+'*txt') == []:
57
  st.write('There is no reference genome, we need to download this')
58
  refdownload=True
 
 
59
  file_to_lookat=st.file_uploader('VCF upload here',type=[".vcf"],accept_multiple_files=True)
60
  remove_old_vcf()
61
  sub=st.form_submit_button('submit input')
@@ -66,13 +68,14 @@ if sub and file_to_lookat !=[]:
66
  dirtest=os.path.join(os.path.dirname(SigProfilerMatrixGenerator.__file__),'references/chromosomes/tsb/GRCh37/')+'*txt'
67
  st.write(dirtest)
68
  #st.write(sys.path)
69
- with st.spinner('downloading hg19 reference'):
70
- urllib.request.urlretrieve('https://dl.dropboxusercontent.com/s/et97ewsct862x7m/references.zip?dl=0','references.zip')
71
- with zipfile.ZipFile('references.zip', 'r') as zip_ref:
72
- zip_ref.extractall(dirtest)
73
- seev=glob.glob(dirtest)
74
- for i in seev:
75
- st.write(i)
 
76
  ##genInstall.install('GRCh37')
77
 
78
  if not os.path.exists('input'):
@@ -93,7 +96,7 @@ if sub and file_to_lookat !=[]:
93
  #shutil.copy2(vcfuse,'input/'+vcfuse)
94
  #pdb.set_trace()
95
  with st.spinner('computing signatures'):
96
- sig.sigProfilerExtractor("vcf", "output", "input", minimum_signatures=1, maximum_signatures=3)
97
 
98
  #show_pdf('output/SBS96/Suggested_Solution/COSMIC_SBS96_Decomposed_Solution/SBS96_Decomposition_Plots.pdf')
99
  dl(file_to_lookat)
 
56
  if glob.glob(os.path.join(os.path.dirname(SigProfilerMatrixGenerator.__file__),'references/chromosomes/tsb/GRCh37/')+'*txt') == []:
57
  st.write('There is no reference genome, we need to download this')
58
  refdownload=True
59
+ else:
60
+ refdownload=False
61
  file_to_lookat=st.file_uploader('VCF upload here',type=[".vcf"],accept_multiple_files=True)
62
  remove_old_vcf()
63
  sub=st.form_submit_button('submit input')
 
68
  dirtest=os.path.join(os.path.dirname(SigProfilerMatrixGenerator.__file__),'references/chromosomes/tsb/GRCh37/')+'*txt'
69
  st.write(dirtest)
70
  #st.write(sys.path)
71
+ if refdownload=True:
72
+ with st.spinner('downloading hg19 reference'):
73
+ urllib.request.urlretrieve('https://dl.dropboxusercontent.com/s/et97ewsct862x7m/references.zip?dl=0','references.zip')
74
+ with zipfile.ZipFile('references.zip', 'r') as zip_ref:
75
+ zip_ref.extractall(dirtest)
76
+ seev=glob.glob(dirtest)
77
+ for i in seev:
78
+ st.write(i)
79
  ##genInstall.install('GRCh37')
80
 
81
  if not os.path.exists('input'):
 
96
  #shutil.copy2(vcfuse,'input/'+vcfuse)
97
  #pdb.set_trace()
98
  with st.spinner('computing signatures'):
99
+ sig.sigProfilerExtractor("vcf", "output", "input", minimum_signatures=1, maximum_signatures=3,nmf_test_conv= 1000,nmf_tolerance= 1e- 10,max_nmf_iterations=100000,min_nmf_iterations= 1000)
100
 
101
  #show_pdf('output/SBS96/Suggested_Solution/COSMIC_SBS96_Decomposed_Solution/SBS96_Decomposition_Plots.pdf')
102
  dl(file_to_lookat)