second
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- app.py +349 -2
- assets/faq/ddb1.png +0 -0
- assets/fragFiguresSingle/C001.png +0 -0
- assets/fragFiguresSingle/C002.png +0 -0
- assets/fragFiguresSingle/C003.png +0 -0
- assets/fragFiguresSingle/C004.png +0 -0
- assets/fragFiguresSingle/C006.png +0 -0
- assets/fragFiguresSingle/C007.png +0 -0
- assets/fragFiguresSingle/C008.png +0 -0
- assets/fragFiguresSingle/C009.png +0 -0
- assets/fragFiguresSingle/C010.png +0 -0
- assets/fragFiguresSingle/C011.png +0 -0
- assets/fragFiguresSingle/C012.png +0 -0
- assets/fragFiguresSingle/C013.png +0 -0
- assets/fragFiguresSingle/C014.png +0 -0
- assets/fragFiguresSingle/C015.png +0 -0
- assets/fragFiguresSingle/C017.png +0 -0
- assets/fragFiguresSingle/C018.png +0 -0
- assets/fragFiguresSingle/C020.png +0 -0
- assets/fragFiguresSingle/C021.png +0 -0
- assets/fragFiguresSingle/C022.png +0 -0
- assets/fragFiguresSingle/C023.png +0 -0
- assets/fragFiguresSingle/C024.png +0 -0
- assets/fragFiguresSingle/C025.png +0 -0
- assets/fragFiguresSingle/C026.png +0 -0
- assets/fragFiguresSingle/C027-Dipyri.png +0 -0
- assets/fragFiguresSingle/C027-E1.png +0 -0
- assets/fragFiguresSingle/C027-E2.png +0 -0
- assets/fragFiguresSingle/C027-E3.png +0 -0
- assets/fragFiguresSingle/C027-E4.png +0 -0
- assets/fragFiguresSingle/C027-E5.png +0 -0
- assets/fragFiguresSingle/C027-E7.png +0 -0
- assets/fragFiguresSingle/C027-E8.png +0 -0
- assets/fragFiguresSingle/C027-E9.png +0 -0
- assets/fragFiguresSingle/C027-N.png +0 -0
- assets/fragFiguresSingle/C027-NBMPR.png +0 -0
- assets/fragFiguresSingle/C027.png +0 -0
- assets/fragFiguresSingle/C028-E2.png +0 -0
- assets/fragFiguresSingle/C028-E3.png +0 -0
- assets/fragFiguresSingle/C028-E4.png +0 -0
- assets/fragFiguresSingle/C028-E5.png +0 -0
- assets/fragFiguresSingle/C028-E6.png +0 -0
- assets/fragFiguresSingle/C028-E7.png +0 -0
- assets/fragFiguresSingle/C028.png +0 -0
- assets/fragFiguresSingle/C029.png +0 -0
- assets/fragFiguresSingle/C030.png +0 -0
- assets/fragFiguresSingle/C031.png +0 -0
- assets/fragFiguresSingle/C032.png +0 -0
- assets/fragFiguresSingle/C033.png +0 -0
- assets/fragFiguresSingle/C034.png +0 -0
app.py
CHANGED
@@ -1,5 +1,352 @@
|
|
|
|
1 |
import streamlit as st
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
-
|
4 |
-
|
|
|
|
|
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# streamlit_app.py
|
2 |
import streamlit as st
|
3 |
+
import pandas as pd
|
4 |
+
pd.options.mode.chained_assignment = None # default='warn'
|
5 |
+
import numpy as np
|
6 |
+
from io import BytesIO
|
7 |
+
import os
|
8 |
+
import sys
|
9 |
|
10 |
+
# relative imports
|
11 |
+
ROOT = os.path.abspath(os.path.dirname(__file__))
|
12 |
+
sys.path.append(os.path.join(ROOT, "./src/"))
|
13 |
+
from agstyler import PINLEFT, PRECISION_TWO, draw_grid
|
14 |
|
15 |
+
st.set_page_config(
|
16 |
+
page_title="Fragment-Protein interactions in Chemical Proteomics Screening",
|
17 |
+
page_icon=":home:",
|
18 |
+
layout="wide", # "centered",
|
19 |
+
initial_sidebar_state="expanded"
|
20 |
+
)
|
21 |
+
|
22 |
+
st.markdown("""
|
23 |
+
<style>
|
24 |
+
.css-13sdm1b.e16nr0p33 {
|
25 |
+
margin-top: -75px;
|
26 |
+
}
|
27 |
+
</style>
|
28 |
+
""", unsafe_allow_html=True)
|
29 |
+
|
30 |
+
hide_streamlit_style = """
|
31 |
+
<style>
|
32 |
+
#MainMenu {visibility: hidden;}
|
33 |
+
footer {visibility: hidden;}
|
34 |
+
#header {visibility: hidden;}
|
35 |
+
</style>
|
36 |
+
"""
|
37 |
+
st.markdown(hide_streamlit_style, unsafe_allow_html=True)
|
38 |
+
|
39 |
+
pIdDf = pd.read_csv(os.path.join(ROOT, "../data/general/proteinNames4.tsv"), sep="\t")
|
40 |
+
|
41 |
+
pId = pIdDf['UniProtID'].values
|
42 |
+
pIdDes = pIdDf['Description'].values
|
43 |
+
|
44 |
+
def applyFilters(df, pFil, pAdjFil, hitFil):
|
45 |
+
if pFil != 'no filter':
|
46 |
+
if pFil == '< 0.05':
|
47 |
+
df = df[df['ml10p'] > 1.30103]
|
48 |
+
else:
|
49 |
+
df = df[df['ml10p'] > 2]
|
50 |
+
|
51 |
+
if pAdjFil != 'no filter':
|
52 |
+
if pAdjFil == '< 0.05':
|
53 |
+
df = df[df['ml10adjP'] > 1.30103]
|
54 |
+
elif pAdjFil == '< 0.1':
|
55 |
+
df = df[df['ml10adjP'] > 1]
|
56 |
+
else:
|
57 |
+
df = df[df['ml10adjP'] > 0.60206]
|
58 |
+
|
59 |
+
if hitFil != 'no filter':
|
60 |
+
if hitFil == 'Low':
|
61 |
+
df = df[df['mdfClass'] >= 1]
|
62 |
+
elif hitFil == 'Medium (hits)':
|
63 |
+
df = df[df['mdfClass'] >= 2]
|
64 |
+
elif hitFil == 'Low (hits)':
|
65 |
+
df = df[df['mdfClass'] >= 1]
|
66 |
+
else:
|
67 |
+
df = df[df['mdfClass'] == 3]
|
68 |
+
|
69 |
+
return df
|
70 |
+
|
71 |
+
def getVarText(df):
|
72 |
+
if (len(df.index)) > 0:
|
73 |
+
bestProt = df["geneName"].values[0]
|
74 |
+
numProtHitss = len(df.index)
|
75 |
+
df.index = np.arange(1,len(df)+1)
|
76 |
+
protList = df.index[df["accession"]==myPid].tolist()
|
77 |
+
if len(protList) > 0:
|
78 |
+
protRank = protList[0]
|
79 |
+
varText1 = "hit rank is"
|
80 |
+
varText2 = "is best"
|
81 |
+
else:
|
82 |
+
varText1 = "is not a hit"
|
83 |
+
protRank = ""
|
84 |
+
varText2 = "protein is best"
|
85 |
+
del protList
|
86 |
+
else:
|
87 |
+
bestProt = "No "
|
88 |
+
numProtHitss = 0
|
89 |
+
varText1 = "is not a hit"
|
90 |
+
protRank = ""
|
91 |
+
varText2 = ""
|
92 |
+
return [bestProt, numProtHitss, protRank, varText1, varText2]
|
93 |
+
|
94 |
+
|
95 |
+
st.sidebar.title("Fragment-Protein Interactions")
|
96 |
+
st.title("Chemical Proteomics Screening")
|
97 |
+
|
98 |
+
help_input3='''
|
99 |
+
|
100 |
+
use **:blue[UniProt Accession]**, Short Gene Name(s) or Protein Description to search\n
|
101 |
+
**Tip**:\n
|
102 |
+
To change selected protein, **:red[NO]** need to select whole existing term, delete and type new.\n
|
103 |
+
:blue[Just start to type new protein, old text will be automatically cleared]'''
|
104 |
+
|
105 |
+
pIdIndex = st.sidebar.selectbox(label = "Select Protein", help = help_input3, options = range(len(pIdDes)), format_func= lambda x: pIdDes[x], index= 1706)
|
106 |
+
|
107 |
+
myPid = pId[pIdIndex]
|
108 |
+
|
109 |
+
intDfOri = pd.read_csv(os.path.join(ROOT, "../data/general/finalScreen.tsv"), sep="\t")
|
110 |
+
fpDf = pd.read_csv(os.path.join(ROOT, "../data/general/finalFp.tsv"), sep="\t")
|
111 |
+
intDf = intDfOri[intDfOri["accession"]==myPid]
|
112 |
+
|
113 |
+
if len(intDf) == 0:
|
114 |
+
st.sidebar.write("We did **:red[not]** detect selected protein interacting with any fragment in our screen, try another protein")
|
115 |
+
else:
|
116 |
+
selectedGeneName = intDf["geneName"].values[0]
|
117 |
+
tempDf = applyFilters(intDf, '< 0.05', '< 0.25', 'Medium (hits)')
|
118 |
+
if (len(tempDf.index)) > 0:
|
119 |
+
tempDf = tempDf.sort_values(by=['protHits', 'l2fc'], ascending=[True, False])
|
120 |
+
bestFrag = tempDf["fragId"].values[0]
|
121 |
+
top5Frags = tempDf["fragId"].values[0:5]
|
122 |
+
numLigaHits = len(tempDf.index) # numLigaHits is already present in base input table
|
123 |
+
varText3 = "is best"
|
124 |
+
else:
|
125 |
+
bestFrag = "No"
|
126 |
+
varText3 = ""
|
127 |
+
numLigaHits = 0
|
128 |
+
|
129 |
+
######## Screening Protein Centric View ############
|
130 |
+
|
131 |
+
st.write("**Selected Protein**: ", pIdDes[pIdIndex])
|
132 |
+
st.markdown("""---""")
|
133 |
+
|
134 |
+
st.subheader(f"First generation fragments (Gen1) that enrich **:blue[{selectedGeneName}]** over background")
|
135 |
+
|
136 |
+
numInt = len(intDf.index)
|
137 |
+
st.write(f"**:blue[{numInt}]** (out of 407 screened) Gen1 fragments enrich **{selectedGeneName}**. **:blue[{numLigaHits}]**/{numInt} fragments are labelled as **hits** by applying **medium** filter Set **(:blue[fS])**. **:blue[{bestFrag}]** {varText3} **hit**.")
|
138 |
+
|
139 |
+
if (numLigaHits/407)>0.1:
|
140 |
+
hitRatio = np.round((numLigaHits/407)*100, 1)
|
141 |
+
st.write(f"**:blue[{selectedGeneName}]** is a **:red[promiscuous]** protein (**hit**/enriched ratio is **:red[{hitRatio}]**%).")
|
142 |
+
|
143 |
+
col1, col2, col3, colX, colY, colZ = st.columns(6)
|
144 |
+
with col1:
|
145 |
+
pFilter = st.selectbox(label = "*P* Value", help = "Select threshold for signifiance", options = ('< 0.05', 'no filter', '< 0.01'))
|
146 |
+
with col2:
|
147 |
+
pAdjFilter = st.selectbox(label = "adjusted *P* Value", help = "Select threshold for signifiance", options = ('< 0.25', '< 0.1', 'no filter', '< 0.05'))
|
148 |
+
with col3:
|
149 |
+
help_input='''
|
150 |
+
|
151 |
+
**:blue[0]**. no filter\n
|
152 |
+
**:blue[1]**. Low Confidence: Fc > 1, Median > 1, p < 0.05, adj.p < 0.25, Rank < 500\n
|
153 |
+
**:blue[2]**. Medium confidence ('**:blue[hits]**'): Fc > 2.3, Median > 1, p < 0.05, adj.p < 0.25, Rank < 500\n
|
154 |
+
**:blue[3]**. High Confidence (also '**:blue[hits]**'): Fc > 2.3, Median > 2.3, p < 0.01, adj.p < 0.1, Rank < 500'''
|
155 |
+
mdfClass = st.selectbox(label = "filter Set (**:blue[fS]**)", help = help_input, options = ('Medium (hits)', 'no filter', 'Low', 'High (hits)'))
|
156 |
+
|
157 |
+
if len(tempDf.index) == 0:
|
158 |
+
st.write("**:red[No]** data to display with selected filters. Applied **:blue[no filter]**")
|
159 |
+
intDf = applyFilters(intDf, 'no filter', 'no filter', 'no filter')
|
160 |
+
|
161 |
+
else:
|
162 |
+
intDf = applyFilters(intDf, pFilter, pAdjFilter, mdfClass)
|
163 |
+
|
164 |
+
del tempDf
|
165 |
+
|
166 |
+
intDf = intDf.sort_values(by=['protHits', 'l2fc'], ascending=[True, False])
|
167 |
+
|
168 |
+
col4, col5 = st.columns(2)
|
169 |
+
with col4:
|
170 |
+
formatter = {
|
171 |
+
'fragId': ('Fragment', {**PINLEFT, 'width': 10}),
|
172 |
+
'l2fc': ('Fc(log2)', {**PRECISION_TWO, 'width': 15}),
|
173 |
+
'l2fcM': ('Fc Median adjusted', {**PRECISION_TWO, 'width': 25}),
|
174 |
+
'protHits': ('# Protein Hits', {'width': 15}),
|
175 |
+
'mdfClass': ('fS', {'width': 10})
|
176 |
+
}
|
177 |
+
data = draw_grid(intDf, formatter=formatter, fit_columns=True, selection='none', max_height=340)
|
178 |
+
with col5:
|
179 |
+
st.image(os.path.join(ROOT, "../assets/proteinCentric/") + myPid + ".png")
|
180 |
+
|
181 |
+
fragId = st.sidebar.selectbox(label = "Select Gen1 Fragment", options = intDf["fragId"])
|
182 |
+
intDf2 = intDfOri[intDfOri["fragId"]==fragId]
|
183 |
+
|
184 |
+
############ Screening Fragment Centric ###############################
|
185 |
+
|
186 |
+
st.subheader(f"Proteins enriched by **:blue[{fragId}]**")
|
187 |
+
|
188 |
+
tempDf2 = intDfOri[intDfOri["fragId"]==fragId]
|
189 |
+
numProtDetected = len(tempDf2.index)
|
190 |
+
tempDf2 = applyFilters(tempDf2, '< 0.05', '< 0.25', 'Medium (hits)')
|
191 |
+
|
192 |
+
tempDf2 = tempDf2.sort_values(by=['ligHits', 'l2fc'], ascending=[True, False])
|
193 |
+
[bestProt, numProtHits, protRank, varText, varText2] = getVarText(tempDf2)
|
194 |
+
|
195 |
+
if len(tempDf2.index) == 0:
|
196 |
+
intDf3 = applyFilters(intDf2, 'no filter', 'no filter', 'no filter')
|
197 |
+
|
198 |
+
else:
|
199 |
+
intDf3 = applyFilters(intDf2, pFilter, pAdjFilter, mdfClass)
|
200 |
+
|
201 |
+
intDf3 = intDf3.sort_values(by=['ligHits', 'l2fc'], ascending=[True, False])
|
202 |
+
|
203 |
+
st.sidebar.image(os.path.join(ROOT, "../assets/fragFiguresSingle/") + fragId + ".png")
|
204 |
+
|
205 |
+
st.write(f"**:blue[{numProtDetected}]** proteins were enriched by fragment **{fragId}** (Fc compared to **CRF** control). **:blue[{numProtHits}]** of those proteins were labelled as **hits** by applying **medium** filter Set **(:blue[fS])**. **:blue[{bestProt}]** {varText2} **hit**. **:blue[{selectedGeneName}]** {varText} **:blue[{protRank}]**.")
|
206 |
+
|
207 |
+
if (numProtHits/numProtDetected)>0.05:
|
208 |
+
fragHitRatio = np.round((numProtHits/numProtDetected)*100, 1)
|
209 |
+
st.write(f"**:blue[{fragId}]** is **:red[promiscuous]** fragment (**hit**/enriched ratio is **:red[{fragHitRatio}]**%).")
|
210 |
+
|
211 |
+
col6, col7 = st.columns(2)
|
212 |
+
with col6:
|
213 |
+
st.image(os.path.join(ROOT, "../assets/ligandVolcanoPlots/") + fragId + ".png")
|
214 |
+
with col7:
|
215 |
+
if len(tempDf2.index) == 0:
|
216 |
+
st.write("**:red[No]** data to display with selected filters. Applied **:blue[no filter]**")
|
217 |
+
formatter = {
|
218 |
+
'accession': ('Protein', {**PINLEFT, 'width': 15}),
|
219 |
+
'geneName': ('Gene', {**PINLEFT, 'width': 15}),
|
220 |
+
'l2fc': ('Fc(log2)', {**PRECISION_TWO, 'width': 15}),
|
221 |
+
'l2fcM': ('Fc Median adjusted', {**PRECISION_TWO, 'width': 25}),
|
222 |
+
'ligHits': ('# Fragment Hits', {'width': 15}),
|
223 |
+
'mdfClass': ('fS', {'width': 10})
|
224 |
+
}
|
225 |
+
data = draw_grid(
|
226 |
+
intDf3, formatter=formatter, fit_columns=True, selection='none', max_height=340)
|
227 |
+
if not isinstance(protRank, str):
|
228 |
+
if protRank < 5:
|
229 |
+
st.subheader(f"**:blue[{fragId}-{selectedGeneName}]** interaction: :first_place_medal:")
|
230 |
+
st.write(f"**:blue[{fragId}]** is in top 5 **Fragment hits** for **{selectedGeneName}**. **:blue[{selectedGeneName}]** is in top 5 **Protein hits** for **{fragId}**.")
|
231 |
+
|
232 |
+
del tempDf2
|
233 |
+
############# Fingerprinting / Elaborates Data ######################
|
234 |
+
|
235 |
+
gen2List = ["C027", "C028", "C044", "C046", "C064", "C115", "C127", "C160", "C179", "C186", "C197", "C219", "C240", "C270", "C275", "C303", "C310", "C320", "C378", "C391"]
|
236 |
+
if fragId in gen2List:
|
237 |
+
st.markdown("""---""")
|
238 |
+
# st.sidebar.markdown("""---""")
|
239 |
+
|
240 |
+
############ Elaborates Protein Centric View ##########################
|
241 |
+
st.subheader(f"Second generation fragments (Gen2) of **:blue[{fragId}]** that compete **:blue[{selectedGeneName}]**")
|
242 |
+
|
243 |
+
gen1Df = fpDf[fpDf["gen1Lig"]==fragId]
|
244 |
+
|
245 |
+
numGen2Ligs = len(np.unique(gen1Df['fragId']))
|
246 |
+
|
247 |
+
temp4Df = gen1Df[gen1Df["accession"]==myPid]
|
248 |
+
temp4Df = temp4Df[temp4Df["mdfClass"]>=1]
|
249 |
+
# temp4Df = temp4Df.sort_values(by='l2fc', ascending=True)
|
250 |
+
temp4Df = temp4Df.sort_values(by='l2fc', ascending=True)
|
251 |
+
|
252 |
+
sidebarList1 = temp4Df["fragId"]
|
253 |
+
|
254 |
+
if len(temp4Df.index)>0:
|
255 |
+
bestGen2Lig = temp4Df['fragId'].values[0]
|
256 |
+
varText5 = "is best Gen2 fragment hit."
|
257 |
+
else:
|
258 |
+
bestGen2Lig = ""
|
259 |
+
varText5 = ""
|
260 |
+
|
261 |
+
st.write(f"**:blue[{numGen2Ligs}]** Gen2 fragments were screened in **competition** experiments against Gen1 fragment **{fragId}**. **:blue[{len(temp4Df.index)}]**/{numGen2Ligs} Gen2 fragments of **{fragId}** pass **low** filter Set (**:blue[fS2]**).")
|
262 |
+
# **:blue[{bestGen2Lig}]** {varText5}")
|
263 |
+
# **compete** **:blue[{selectedGeneName}]** after applying
|
264 |
+
|
265 |
+
formatter = {
|
266 |
+
'fragId': ('Gen2', {**PINLEFT, 'width': 10}),
|
267 |
+
'l2fc': ('Fc(log2)', {**PRECISION_TWO, 'width': 10}),
|
268 |
+
'l2fcM': ('Fc Median adjusted', {**PRECISION_TWO, 'width': 20}),
|
269 |
+
'protHits': ('# Gen2 Protein Hits', {'width': 15}),
|
270 |
+
'mdfClass': ('fS2', {'width': 10})
|
271 |
+
}
|
272 |
+
|
273 |
+
col10, col11 = st.columns(2)
|
274 |
+
with col10:
|
275 |
+
st.write(f":blue[Hits] (fS2 > 0)")
|
276 |
+
if len(temp4Df.index)>0:
|
277 |
+
data = draw_grid(
|
278 |
+
temp4Df, formatter=formatter, fit_columns=True, selection='none')
|
279 |
+
|
280 |
+
temp4Df = gen1Df[gen1Df["accession"]==myPid]
|
281 |
+
temp4Df = temp4Df[temp4Df["mdfClass"] < 1]
|
282 |
+
temp4Df = temp4Df.sort_values(by='l2fc', ascending=True)
|
283 |
+
|
284 |
+
sidebarList2 = temp4Df["fragId"]
|
285 |
+
|
286 |
+
with col11:
|
287 |
+
st.write(f":orange[not] Hits (fS2 = 0)")
|
288 |
+
data = draw_grid(
|
289 |
+
temp4Df, formatter=formatter, fit_columns=True, selection='none')
|
290 |
+
|
291 |
+
temp4Df = gen1Df[gen1Df["accession"]==myPid]
|
292 |
+
temp4Df = temp4Df.sort_values(by='l2fc', ascending=True)
|
293 |
+
temp4Df = temp4Df.sort_values(by=['mdfClass', 'l2fc'], ascending=[False, True])
|
294 |
+
|
295 |
+
sideBarList = pd.concat([sidebarList1, sidebarList2], sort=False)
|
296 |
+
|
297 |
+
############ Elaborates Side Bar Selection ##########################
|
298 |
+
|
299 |
+
# gen2Id = st.sidebar.selectbox(label = "Select Gen2 Fragment", options = temp4Df["fragId"])
|
300 |
+
gen2Id = st.sidebar.selectbox(label = "Select Gen2 Fragment", options = sideBarList)
|
301 |
+
st.sidebar.image(os.path.join(ROOT, "../assets/fragFiguresSingle/") + gen2Id + ".png")
|
302 |
+
|
303 |
+
############ Elaborates Fragment Centric View ##########################
|
304 |
+
|
305 |
+
st.subheader(f"Proteins competed by **:blue[{gen2Id}]**")
|
306 |
+
|
307 |
+
gen2Df = gen1Df[gen1Df["fragId"]==gen2Id]
|
308 |
+
|
309 |
+
tempDf3 = applyFilters(gen2Df, '< 0.05', '< 0.25', 'Low')
|
310 |
+
tempDf3 = tempDf3.sort_values(by=['ligHits', 'l2fc'], ascending=[True, True])
|
311 |
+
|
312 |
+
[bestProt2, numProtHits2, protRank2, varText3, varText4] = getVarText(tempDf3)
|
313 |
+
|
314 |
+
st.write(f"**:blue[{len(gen2Df.index)}]** proteins were reduced in **:blue[{gen2Id}] competition** experiment (Fc compared to **{fragId}** control). **:blue[{numProtHits2}]** of those proteins are labelled as **hits** by applying **low** filter Set **(:blue[fS2])**. **:blue[{bestProt2}]** {varText4} **hit**. **:blue[{selectedGeneName}]** {varText3} **:blue[{protRank2}]**.")
|
315 |
+
|
316 |
+
col1, col2, col3, colX, colY, colZ = st.columns(6)
|
317 |
+
with col1:
|
318 |
+
pFilterFP = st.selectbox(label = "*P* Value", help = "Select threshold for signifiance", options = ('< 0.05', 'no filter', '< 0.01'), key = 'pFilterFP')
|
319 |
+
with col2:
|
320 |
+
pAdjFilterFP = st.selectbox(label = "adjusted *P* Value", help = "Select threshold for signifiance", options = ('< 0.25', 'no filter', '< 0.1', '< 0.05'), key = 'pAdjFilterFP')
|
321 |
+
with col3:
|
322 |
+
help_input2='''
|
323 |
+
|
324 |
+
**:blue[0]**. no filter\n
|
325 |
+
**:blue[1]**. Low Confidence ('**:blue[hits]**'): Fc < -1, p < 0.05, adj.p < 0.25, Rank < 500\n
|
326 |
+
**:blue[2]**. Medium confidence (also '**:blue[hits]**'): Fc < -1.65, p < 0.05, adj.p < 0.25, Rank < 500\n
|
327 |
+
**:blue[3]**. High Confidence (also '**:blue[hits]**'): Fc < -2.3, p < 0.01, adj.p < 0.1, Rank < 500'''
|
328 |
+
mdfClassFP = st.selectbox(label = "Gen2 Fragment filter Set (**:blue[fS2]**)", help = help_input2, options = ('Low (hits)', 'Medium (hits)', 'no filter', 'High (hits)'), key = 'mdfClassFP')
|
329 |
+
|
330 |
+
if len(tempDf3.index) == 0:
|
331 |
+
st.write("**:red[No]** data to display with selected filters. Applied **:blue[no filter]**")
|
332 |
+
gen2Df2 = applyFilters(gen2Df, 'no filter', 'no filter', 'no filter')
|
333 |
+
|
334 |
+
else:
|
335 |
+
gen2Df2 = applyFilters(gen2Df, pFilterFP, pAdjFilterFP, mdfClassFP)
|
336 |
+
|
337 |
+
gen2Df2 = gen2Df2.sort_values(by=['ligHits', 'l2fc'], ascending=[True, True])
|
338 |
+
|
339 |
+
col8, col9 = st.columns(2)
|
340 |
+
with col8:
|
341 |
+
formatter = {
|
342 |
+
'accession': ('Protein', {**PINLEFT, 'width': 15}),
|
343 |
+
'geneName': ('Gene', {**PINLEFT, 'width': 15}),
|
344 |
+
'l2fc': ('Fc(log2)', {**PRECISION_TWO, 'width': 10}),
|
345 |
+
'l2fcM': ('Fc Median adjusted', {**PRECISION_TWO, 'width': 20}),
|
346 |
+
'ligHits': ('# Gen2 Fragment Hits', {'width': 15}),
|
347 |
+
'mdfClass': ('fS2', {'width': 10})
|
348 |
+
}
|
349 |
+
data = draw_grid(
|
350 |
+
gen2Df2, formatter=formatter, fit_columns=True, selection='none', max_height=340)
|
351 |
+
with col9:
|
352 |
+
st.image(os.path.join(ROOT, "../assets/gen2VolcanoPlots/") + gen2Id + ".png")
|
assets/faq/ddb1.png
ADDED
![]() |
assets/fragFiguresSingle/C001.png
ADDED
![]() |
assets/fragFiguresSingle/C002.png
ADDED
![]() |
assets/fragFiguresSingle/C003.png
ADDED
![]() |
assets/fragFiguresSingle/C004.png
ADDED
![]() |
assets/fragFiguresSingle/C006.png
ADDED
![]() |
assets/fragFiguresSingle/C007.png
ADDED
![]() |
assets/fragFiguresSingle/C008.png
ADDED
![]() |
assets/fragFiguresSingle/C009.png
ADDED
![]() |
assets/fragFiguresSingle/C010.png
ADDED
![]() |
assets/fragFiguresSingle/C011.png
ADDED
![]() |
assets/fragFiguresSingle/C012.png
ADDED
![]() |
assets/fragFiguresSingle/C013.png
ADDED
![]() |
assets/fragFiguresSingle/C014.png
ADDED
![]() |
assets/fragFiguresSingle/C015.png
ADDED
![]() |
assets/fragFiguresSingle/C017.png
ADDED
![]() |
assets/fragFiguresSingle/C018.png
ADDED
![]() |
assets/fragFiguresSingle/C020.png
ADDED
![]() |
assets/fragFiguresSingle/C021.png
ADDED
![]() |
assets/fragFiguresSingle/C022.png
ADDED
![]() |
assets/fragFiguresSingle/C023.png
ADDED
![]() |
assets/fragFiguresSingle/C024.png
ADDED
![]() |
assets/fragFiguresSingle/C025.png
ADDED
![]() |
assets/fragFiguresSingle/C026.png
ADDED
![]() |
assets/fragFiguresSingle/C027-Dipyri.png
ADDED
![]() |
assets/fragFiguresSingle/C027-E1.png
ADDED
![]() |
assets/fragFiguresSingle/C027-E2.png
ADDED
![]() |
assets/fragFiguresSingle/C027-E3.png
ADDED
![]() |
assets/fragFiguresSingle/C027-E4.png
ADDED
![]() |
assets/fragFiguresSingle/C027-E5.png
ADDED
![]() |
assets/fragFiguresSingle/C027-E7.png
ADDED
![]() |
assets/fragFiguresSingle/C027-E8.png
ADDED
![]() |
assets/fragFiguresSingle/C027-E9.png
ADDED
![]() |
assets/fragFiguresSingle/C027-N.png
ADDED
![]() |
assets/fragFiguresSingle/C027-NBMPR.png
ADDED
![]() |
assets/fragFiguresSingle/C027.png
ADDED
![]() |
assets/fragFiguresSingle/C028-E2.png
ADDED
![]() |
assets/fragFiguresSingle/C028-E3.png
ADDED
![]() |
assets/fragFiguresSingle/C028-E4.png
ADDED
![]() |
assets/fragFiguresSingle/C028-E5.png
ADDED
![]() |
assets/fragFiguresSingle/C028-E6.png
ADDED
![]() |
assets/fragFiguresSingle/C028-E7.png
ADDED
![]() |
assets/fragFiguresSingle/C028.png
ADDED
![]() |
assets/fragFiguresSingle/C029.png
ADDED
![]() |
assets/fragFiguresSingle/C030.png
ADDED
![]() |
assets/fragFiguresSingle/C031.png
ADDED
![]() |
assets/fragFiguresSingle/C032.png
ADDED
![]() |
assets/fragFiguresSingle/C033.png
ADDED
![]() |
assets/fragFiguresSingle/C034.png
ADDED
![]() |