Eitan177 commited on
Commit
0b0c338
·
1 Parent(s): 2dc56c6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -16
app.py CHANGED
@@ -30,17 +30,19 @@ def show_pdf(file_path):
30
 
31
 
32
 
33
- if st.button('get reference genome'):
34
- st.write(os.path.dirname(SigProfilerMatrixGenerator.__file__))
35
- dirtest=os.path.dirname(SigProfilerMatrixGenerator.__file__)
36
- #st.write(sys.path)
37
- urllib.request.urlretrieve('https://dl.dropboxusercontent.com/s/et97ewsct862x7m/references.zip?dl=0','references.zip')
38
- with zipfile.ZipFile('references.zip', 'r') as zip_ref:
39
- zip_ref.extractall(dirtest)
40
- seev=glob.glob('/home/appuser/venv/lib/python3.9/site-packages/SigProfilerMatrixGenerator/references/*')
41
- for i in seev:
42
- st.write(i)
43
- ##genInstall.install('GRCh37')
 
 
44
 
45
  if not os.path.exists('input'):
46
  os.mkdir('input')
@@ -63,9 +65,24 @@ if file_to_lookat !=[]:
63
  with st.spinner('computing signatures'):
64
  sig.sigProfilerExtractor("vcf", "output", "input", minimum_signatures=1, maximum_signatures=3)
65
 
66
- show_pdf('output/SBS96/Suggested_Solution/COSMIC_SBS96_Decomposed_Solution/SBS96_Decomposition_Plots.pdf')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
 
68
- components.iframe("https://cancer.sanger.ac.uk/signatures/sbs/", height=3000,width=800)
69
- show_pdf('output/ID83/Suggested_Solution/COSMIC_ID83_Decomposed_Solution/ID83_Decomposition_Plots.pdf')
70
- components.iframe("https://cancer.sanger.ac.uk/signatures/id/",height=3000,width=800)
71
- remove_old_vcf()
 
 
30
 
31
 
32
 
33
+ if glob.glob(os.path.dirname(SigProfilerMatrixGenerator.__file__)) == []:
34
+ if st.button('get reference genome'):
35
+ st.write(os.path.dirname(SigProfilerMatrixGenerator.__file__))
36
+ dirtest=os.path.dirname(SigProfilerMatrixGenerator.__file__)
37
+ #st.write(sys.path)
38
+ with st.spinner('downloading hg19 reference'):
39
+ urllib.request.urlretrieve('https://dl.dropboxusercontent.com/s/et97ewsct862x7m/references.zip?dl=0','references.zip')
40
+ with zipfile.ZipFile('references.zip', 'r') as zip_ref:
41
+ zip_ref.extractall(dirtest)
42
+ seev=glob.glob(os.path.join(dirtest,'references'))
43
+ for i in seev:
44
+ st.write(i)
45
+ ##genInstall.install('GRCh37')
46
 
47
  if not os.path.exists('input'):
48
  os.mkdir('input')
 
65
  with st.spinner('computing signatures'):
66
  sig.sigProfilerExtractor("vcf", "output", "input", minimum_signatures=1, maximum_signatures=3)
67
 
68
+ #show_pdf('output/SBS96/Suggested_Solution/COSMIC_SBS96_Decomposed_Solution/SBS96_Decomposition_Plots.pdf')
69
+ with open("output/SBS96/Suggested_Solution/COSMIC_SBS96_Decomposed_Solution/SBS96_Decomposition_Plots.pdf", "rb") as pdf_file:
70
+ PDFbyte1 = pdf_file.read()
71
+ st.download_button(label="Download image with single base substitution profiles", key='1',
72
+ data=PDFbyte1,
73
+ file_name="SBS.pdf",
74
+ mime='application/octet-stream')
75
+
76
+
77
+ with open("output/ID83/Suggested_Solution/COSMIC_ID83_Decomposed_Solution/ID83_Decomposition_Plots.pdf", "rb") as pdf_file:
78
+ PDFbyte2 = pdf_file.read()
79
+ st.download_button(label="Download image with indel profiles", key='2',
80
+ data=PDFbyte2,
81
+ file_name="idel.pdf",
82
+ mime='application/octet-stream')
83
 
84
+
85
+ components.iframe("https://cancer.sanger.ac.uk/signatures/sbs/", height=3000,width=800)
86
+ #show_pdf('output/ID83/Suggested_Solution/COSMIC_ID83_Decomposed_Solution/ID83_Decomposition_Plots.pdf')
87
+ components.iframe("https://cancer.sanger.ac.uk/signatures/id/",height=3000,width=800)
88
+ remove_old_vcf()