Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -22,7 +22,18 @@ def load_LLR(uniprot_id):
|
|
22 |
with ZipFile(LLR_FILE) as myzip:
|
23 |
data = myzip.open(myzip.namelist()[0]+uniprot_id+'_LLR.csv')
|
24 |
return pd.read_csv(data,index_col=0)
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
def plot_interactive(uniprot_id, show_clinvar=False):
|
28 |
primaryLLR = load_LLR(uniprot_id)
|
@@ -105,4 +116,11 @@ show_clinvar = st.checkbox('show ClinVar annotations (red: pathogenic, green: be
|
|
105 |
|
106 |
fig = plot_interactive(uid,show_clinvar=show_clinvar)
|
107 |
fig.update_layout(width = 800, height = 600, autosize = False)
|
108 |
-
st.plotly_chart(fig, use_container_width=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
with ZipFile(LLR_FILE) as myzip:
|
23 |
data = myzip.open(myzip.namelist()[0]+uniprot_id+'_LLR.csv')
|
24 |
return pd.read_csv(data,index_col=0)
|
25 |
+
|
26 |
+
def meltLLR(LLR,gene_prefix=None,ignore_pos=False):
|
27 |
+
vars = LLR.melt(ignore_index=False)
|
28 |
+
vars['variant'] = [''.join(i.split(' '))+j for i,j in zip(vars['variable'],vars.index)]
|
29 |
+
vars['score'] = vars['value']
|
30 |
+
vars = vars.set_index('variant')
|
31 |
+
if not ignore_pos:
|
32 |
+
vars['pos'] = [int(i[1:-1]) for i in vars.index]
|
33 |
+
del vars['variable'],vars['value']
|
34 |
+
if gene_prefix is not None:
|
35 |
+
vars.index=gene_prefix+'_'+vars.index
|
36 |
+
return vars
|
37 |
|
38 |
def plot_interactive(uniprot_id, show_clinvar=False):
|
39 |
primaryLLR = load_LLR(uniprot_id)
|
|
|
116 |
|
117 |
fig = plot_interactive(uid,show_clinvar=show_clinvar)
|
118 |
fig.update_layout(width = 800, height = 600, autosize = False)
|
119 |
+
st.plotly_chart(fig, use_container_width=True)
|
120 |
+
|
121 |
+
st.download_button(
|
122 |
+
label="Download data as CSV",
|
123 |
+
data=meltLLR(load_LLR(uid)),
|
124 |
+
file_name=selection+'.csv',
|
125 |
+
mime='text/csv',
|
126 |
+
)
|