Eitan177 commited on
Commit
f74f335
·
1 Parent(s): fd6e95c

Delete App.py

Browse files
Files changed (1) hide show
  1. App.py +0 -71
App.py DELETED
@@ -1,71 +0,0 @@
1
- import streamlit as st
2
- import zipfile
3
- import urllib.request
4
- import glob
5
- import SigProfilerMatrixGenerator
6
- from SigProfilerMatrixGenerator import install as genInstall
7
- import shutil
8
- import os
9
- from SigProfilerExtractor import sigpro as sig
10
- import sys
11
- import base64
12
- import streamlit.components.v1 as components
13
-
14
- curdir= os.getcwd()
15
-
16
- def remove_old_vcf():
17
- vcfrem=glob.glob('input/*.vcf')
18
- for filepath in vcfrem:
19
- os.remove(filepath)
20
- vcfrem=glob.glob('input/input/*.vcf')
21
- for filepath in vcfrem:
22
- os.remove(filepath)
23
-
24
- def show_pdf(file_path):
25
- with open(file_path,"rb") as f:
26
- base64_pdf = base64.b64encode(f.read()).decode('utf-8')
27
- pdf_display = f'<iframe src="data:application/pdf;base64,{base64_pdf}" width="1500" height="1000" type="application/pdf"></iframe>'
28
- st.markdown(pdf_display, unsafe_allow_html=True)
29
-
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')
47
-
48
- if not os.path.exists('input/input'):
49
- os.mkdir('input/input')
50
-
51
- file_to_lookat=st.file_uploader('VCF upload here',type=[".vcf"],accept_multiple_files=True)
52
- remove_old_vcf()
53
-
54
- if file_to_lookat !=[]:
55
- bytes_data=file_to_lookat[0].read()
56
- with open(os.path.join("input",file_to_lookat[0].name),"wb") as f:
57
- f.write(bytes_data)
58
- f.close()
59
-
60
- #vcfuse=glob.glob('file_to_lookat[0].name')[0]
61
- #shutil.copy2(vcfuse,'input/'+vcfuse)
62
- #pdb.set_trace()
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()