Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -30,6 +30,9 @@ def show_pdf(file_path):
|
|
30 |
|
31 |
@st.experimental_memo(suppress_st_warning=True)
|
32 |
def dl(file_vcf):
|
|
|
|
|
|
|
33 |
with open("output/SBS96/Suggested_Solution/COSMIC_SBS96_Decomposed_Solution/SBS96_Decomposition_Plots.pdf", "rb") as pdf_file:
|
34 |
PDFbyte1 = pdf_file.read()
|
35 |
st.download_button(label="Download image with single base substitution profiles", key='1',
|
@@ -49,31 +52,38 @@ def dl(file_vcf):
|
|
49 |
|
50 |
|
51 |
#st.write(glob.glob(os.path.join(os.path.dirname(SigProfilerMatrixGenerator.__file__),'references/*txt')))
|
52 |
-
|
53 |
-
if glob.glob(os.path.join(os.path.dirname(SigProfilerMatrixGenerator.__file__),'references
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
##genInstall.install('GRCh37')
|
66 |
|
67 |
-
if not os.path.exists('input'):
|
68 |
-
|
|
|
|
|
|
|
|
|
69 |
|
70 |
-
if not os.path.exists('input/input'):
|
71 |
-
os.mkdir('input/input')
|
72 |
|
73 |
-
file_to_lookat=st.file_uploader('VCF upload here',type=[".vcf"],accept_multiple_files=True)
|
74 |
-
remove_old_vcf()
|
75 |
|
76 |
-
if file_to_lookat !=[]:
|
77 |
bytes_data=file_to_lookat[0].read()
|
78 |
with open(os.path.join("input",file_to_lookat[0].name),"wb") as f:
|
79 |
f.write(bytes_data)
|
|
|
30 |
|
31 |
@st.experimental_memo(suppress_st_warning=True)
|
32 |
def dl(file_vcf):
|
33 |
+
seev=glob.glob('output/SBS96/Suggested_Solution/COSMIC_SBS96_Decomposed_Solution/*pdf')
|
34 |
+
for i in seev:
|
35 |
+
st.write('pdf file with sbs96 output is here: '+i)
|
36 |
with open("output/SBS96/Suggested_Solution/COSMIC_SBS96_Decomposed_Solution/SBS96_Decomposition_Plots.pdf", "rb") as pdf_file:
|
37 |
PDFbyte1 = pdf_file.read()
|
38 |
st.download_button(label="Download image with single base substitution profiles", key='1',
|
|
|
52 |
|
53 |
|
54 |
#st.write(glob.glob(os.path.join(os.path.dirname(SigProfilerMatrixGenerator.__file__),'references/*txt')))
|
55 |
+
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')
|
62 |
+
|
63 |
+
if sub and file_to_lookat !=[]::
|
64 |
+
#if st.button('get reference genome'):
|
65 |
+
st.write(os.path.dirname(SigProfilerMatrixGenerator.__file__))
|
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'):
|
79 |
+
os.mkdir('input')
|
80 |
+
|
81 |
+
if not os.path.exists('input/input'):
|
82 |
+
os.mkdir('input/input')
|
83 |
+
|
84 |
|
|
|
|
|
85 |
|
|
|
|
|
86 |
|
|
|
87 |
bytes_data=file_to_lookat[0].read()
|
88 |
with open(os.path.join("input",file_to_lookat[0].name),"wb") as f:
|
89 |
f.write(bytes_data)
|