Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -155,7 +155,7 @@ if query:
|
|
155 |
'+AND+english%5Bla%5D+AND+hasabstract+AND+1990:2022%5Bdp%5D+AND+' + c for c in short_table.index]
|
156 |
df['href2'] = [f'https://en.wikipedia.org/wiki/' + c for c in short_table.index]
|
157 |
|
158 |
-
df['database'] = database_name
|
159 |
|
160 |
|
161 |
# print(sizes)
|
@@ -188,7 +188,7 @@ if query:
|
|
188 |
mime='text/csv')
|
189 |
except:
|
190 |
st.warning(
|
191 |
-
f"This selection exceeds the number of similar words related to {query} within the {database_name} corpus")
|
192 |
|
193 |
st.markdown("---")
|
194 |
# st.write(short_table)
|
@@ -196,10 +196,10 @@ if query:
|
|
196 |
|
197 |
# print()
|
198 |
# print("Human genes similar to " + str(query))
|
199 |
-
df1 = table
|
200 |
df2 = pd.read_csv('Human_Genes.csv')
|
201 |
m = df1.Word.isin(df2.symbol)
|
202 |
-
df1 = df1[m]
|
203 |
df1.rename(columns={'Word': 'Human Gene'}, inplace=True)
|
204 |
df1["Human Gene"] = df1["Human Gene"].str.upper()
|
205 |
# print(df1.head(50))
|
@@ -224,7 +224,7 @@ if query:
|
|
224 |
f"<span style='color:red; font-style: italic;'>{query}:</span> Click on the squares to expand and the Pubmed and NCBI links for more gene information</span></p></b>",
|
225 |
unsafe_allow_html=True)
|
226 |
|
227 |
-
df10 = df1.head(value_gene)
|
228 |
df10.index = (1 / df10.index)*10000
|
229 |
sizes = df10.index.tolist()
|
230 |
df10.set_index('Human Gene', inplace=True)
|
@@ -250,8 +250,8 @@ if query:
|
|
250 |
df10['href2'] = [f'https://www.ncbi.nlm.nih.gov/gene/?term=' + c for c in df10['text']]
|
251 |
|
252 |
df10['name'] = [c for c in result['Approved name']]
|
253 |
-
|
254 |
-
df10['database'] = database_name
|
255 |
|
256 |
# print(df['name'])
|
257 |
|
@@ -288,7 +288,7 @@ if query:
|
|
288 |
|
289 |
except:
|
290 |
st.warning(
|
291 |
-
f"This selection exceeds the number of similar genes related to {query} within the {database_name} corpus")
|
292 |
st.markdown("---")
|
293 |
|
294 |
# st.write(short_table)
|
@@ -296,7 +296,7 @@ if query:
|
|
296 |
|
297 |
# print()
|
298 |
# print("Human genes similar to " + str(query))
|
299 |
-
df1 = table
|
300 |
df2 = pd.read_csv('protein.csv')
|
301 |
m = df1.Word.isin(df2.protein)
|
302 |
df1 = df1[m]
|
@@ -328,8 +328,7 @@ if query:
|
|
328 |
f"<span style='color:red; font-style: italic;'>{query}:</span> Click on the squares to expand and the Pubmed and Wikipedia links for more protein information</span></p></b>",
|
329 |
unsafe_allow_html=True)
|
330 |
|
331 |
-
df11 = df1.head(value_protein)
|
332 |
-
print(df11)
|
333 |
|
334 |
df11.index = (1 / df11.index) * 10000
|
335 |
sizes = df11.index.tolist()
|
@@ -353,7 +352,7 @@ if query:
|
|
353 |
df11['href'] = [f'https://pubmed.ncbi.nlm.nih.gov/?term={database_name}%5Bmh%5D+NOT+review%5Bpt%5D' \
|
354 |
'+AND+english%5Bla%5D+AND+hasabstract+AND+1990:2022%5Bdp%5D+AND+' + c for c in df11['text']]
|
355 |
df11['href2'] = [f'https://en.wikipedia.org/wiki/' + c for c in df11['text']]
|
356 |
-
|
357 |
df11['database'] = database_name
|
358 |
|
359 |
# df11['name'] = [c for c in result['Approved name']]
|
@@ -387,7 +386,7 @@ if query:
|
|
387 |
|
388 |
|
389 |
else:
|
390 |
-
st.warning(f"This selection exceeds the number of similar proteins related to {query} within the {database_name} corpus")
|
391 |
st.markdown("---")
|
392 |
|
393 |
|
|
|
155 |
'+AND+english%5Bla%5D+AND+hasabstract+AND+1990:2022%5Bdp%5D+AND+' + c for c in short_table.index]
|
156 |
df['href2'] = [f'https://en.wikipedia.org/wiki/' + c for c in short_table.index]
|
157 |
|
158 |
+
df.loc[:,'database'] = database_name
|
159 |
|
160 |
|
161 |
# print(sizes)
|
|
|
188 |
mime='text/csv')
|
189 |
except:
|
190 |
st.warning(
|
191 |
+
f"This selection exceeds the number of similar words related to {query} within the {database_name} corpus, please choose a lower number")
|
192 |
|
193 |
st.markdown("---")
|
194 |
# st.write(short_table)
|
|
|
196 |
|
197 |
# print()
|
198 |
# print("Human genes similar to " + str(query))
|
199 |
+
df1 = table.copy()
|
200 |
df2 = pd.read_csv('Human_Genes.csv')
|
201 |
m = df1.Word.isin(df2.symbol)
|
202 |
+
df1 = df1[m].loc[:,:]
|
203 |
df1.rename(columns={'Word': 'Human Gene'}, inplace=True)
|
204 |
df1["Human Gene"] = df1["Human Gene"].str.upper()
|
205 |
# print(df1.head(50))
|
|
|
224 |
f"<span style='color:red; font-style: italic;'>{query}:</span> Click on the squares to expand and the Pubmed and NCBI links for more gene information</span></p></b>",
|
225 |
unsafe_allow_html=True)
|
226 |
|
227 |
+
df10 = df1.head(value_gene).copy()
|
228 |
df10.index = (1 / df10.index)*10000
|
229 |
sizes = df10.index.tolist()
|
230 |
df10.set_index('Human Gene', inplace=True)
|
|
|
250 |
df10['href2'] = [f'https://www.ncbi.nlm.nih.gov/gene/?term=' + c for c in df10['text']]
|
251 |
|
252 |
df10['name'] = [c for c in result['Approved name']]
|
253 |
+
assert isinstance(df10, object)
|
254 |
+
df10.loc[:,'database'] = database_name
|
255 |
|
256 |
# print(df['name'])
|
257 |
|
|
|
288 |
|
289 |
except:
|
290 |
st.warning(
|
291 |
+
f"This selection exceeds the number of similar genes related to {query} within the {database_name} corpus, please choose a lower number")
|
292 |
st.markdown("---")
|
293 |
|
294 |
# st.write(short_table)
|
|
|
296 |
|
297 |
# print()
|
298 |
# print("Human genes similar to " + str(query))
|
299 |
+
df1 = table.copy()
|
300 |
df2 = pd.read_csv('protein.csv')
|
301 |
m = df1.Word.isin(df2.protein)
|
302 |
df1 = df1[m]
|
|
|
328 |
f"<span style='color:red; font-style: italic;'>{query}:</span> Click on the squares to expand and the Pubmed and Wikipedia links for more protein information</span></p></b>",
|
329 |
unsafe_allow_html=True)
|
330 |
|
331 |
+
df11 = df1.head(value_protein).copy()
|
|
|
332 |
|
333 |
df11.index = (1 / df11.index) * 10000
|
334 |
sizes = df11.index.tolist()
|
|
|
352 |
df11['href'] = [f'https://pubmed.ncbi.nlm.nih.gov/?term={database_name}%5Bmh%5D+NOT+review%5Bpt%5D' \
|
353 |
'+AND+english%5Bla%5D+AND+hasabstract+AND+1990:2022%5Bdp%5D+AND+' + c for c in df11['text']]
|
354 |
df11['href2'] = [f'https://en.wikipedia.org/wiki/' + c for c in df11['text']]
|
355 |
+
assert isinstance(df11, object)
|
356 |
df11['database'] = database_name
|
357 |
|
358 |
# df11['name'] = [c for c in result['Approved name']]
|
|
|
386 |
|
387 |
|
388 |
else:
|
389 |
+
st.warning(f"This selection exceeds the number of similar proteins related to {query} within the {database_name} corpus, please choose a lower number")
|
390 |
st.markdown("---")
|
391 |
|
392 |
|