Spaces:
Running
Running
File size: 5,338 Bytes
f67eeb9 774bbad 01c9d3a 29713c0 69b09a6 774bbad 8517f4e 9ce0bc5 2dcba73 9ce0bc5 3a0d682 9ce0bc5 8f33cca f67eeb9 b18f058 8f33cca e26bad9 61ae154 8517f4e 61ae154 8f33cca e6b3eda 3a0d682 9ce0bc5 f4311da 7f96b76 f4311da 272d67c 77d0e61 1807dda 61ae154 a958404 61ae154 29713c0 61ae154 29713c0 8f33cca e26bad9 8059916 01c9d3a f7c7fad 9270882 08df4f6 9270882 f7c7fad 272d67c 860a8d9 272d67c 01c9d3a 8059916 0d2f468 8059916 baca9f0 e1af0c4 baca9f0 e1af0c4 bd90dd4 a958404 bd90dd4 a958404 272d67c 860a8d9 272d67c 8059916 29713c0 12a4145 8059916 29713c0 fab109a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
import datasets
import streamlit as st
from st_aggrid import AgGrid, GridOptionsBuilder, JsCode
st.set_page_config(layout='wide')
# parse out gene_ids from URL query args to it's possible to link to this page
query_params = st.query_params
if "gene_id" in query_params.keys():
gene_id = query_params["gene_id"]
else:
gene_id = "CNAG_04365"
st.markdown("""
# CryptoCEN Top50 co-expressed partners
**CryptoCEN** is a co-expression network for *Cryptococcus neoformans* built on 1,524 RNA-seq runs across 34 studies.
A pair of genes are said to be co-expressed when their expression is correlated across different conditions and
is often a marker for genes to be involved in similar processes.
To Cite:
O'Meara MJ, Rapala JR, Nichols CB, Alexandre C, Billmyre RB, Steenwyk JL, A Alspaugh JA, O'Meara TR
CryptoCEN: A Co-Expression Network for Cryptococcus neoformans reveals novel proteins involved in DNA damage repair.
PLoS Genet 20(2): e1011158. (2024) https://doi.org/10.1371/journal.pgen.1011158
* Code available at https://github.com/maomlab/CalCEN/tree/master/vignettes/CryptoCEN
* Full network and dataset: https://huggingface.co/datasets/maomlab/CryptoCEN
## Look up top-coexpressed partners:
Put in the ``CNAG_#####`` gene_id for a gene and expand the table to get the top 50 co-expressed genes.
``coexp_score`` ranges between ``[0-1]``, where ``1`` is the best and greater than ``0.85`` can be considered significant.
""")
top_coexp_hits = datasets.load_dataset(
path = "maomlab/CryptoCEN",
data_files = {"top_coexp_hits": "top_coexp_hits.tsv"})
top_coexp_hits = top_coexp_hits["top_coexp_hits"].to_pandas()
col1, col2, col3 = st.columns(spec = [0.3, 0.2, 0.5])
with col1:
gene_id = st.text_input(
label = "Gene ID",
value = f"{gene_id}",
max_chars = 10,
help = "CNAG Gene ID e.g. CNAG_04365")
top_coexp_hits = top_coexp_hits[
top_coexp_hits.gene_id_1 == gene_id]
top_coexp_hits = top_coexp_hits[[
'gene_id_1', 'gene_symbol_1', 'description_1',
'gene_id_2', 'gene_symbol_2', 'description_2',
'coexp_score', 'blastp_EValue']]
top_coexp_hits["scatter_link"] = top_coexp_hits.apply(
lambda row: f"https://huggingface.co/spaces/maomlab/CryptoCEN-ExpressionScatter?gene_id_1={row.gene_id_1}&gene_id_2={row.gene_id_2}",
axis = 1)
top_coexp_hits.reset_index()
with col2:
st.text('') # help alignment with input box
st.download_button(
label = "Download data as TSV",
data = top_coexp_hits.to_csv(sep ='\t').encode('utf-8'),
file_name = f"top_coexp_hits_{gene_id}.tsv",
mime = "text/csv")
# third column is padding only
######### Table #########
fungidb_link_renderer = JsCode("""
class UrlCellRenderer {
init(params) {
this.eGui = document.createElement('a');
this.eGui.innerText = params.value;
this.eGui.setAttribute('href', "https://fungidb.org/fungidb/app/record/gene/" + params.value);
this.eGui.setAttribute('style', "text-decoration:none");
this.eGui.setAttribute('target', "_blank");
}
getGui() {
return this.eGui;
}
}
""")
coexp_scatter_link_renderer = JsCode("""
class UrlCellRenderer {
init(params) {
this.eGui = document.createElement('a');
this.eGui.innerText = 'plot';
this.eGui.setAttribute('href', params.value);
this.eGui.setAttribute('style', "text-decoration:none");
this.eGui.setAttribute('target', "_blank");
}
getGui() {
return this.eGui;
}
}
""")
grid_option_builder = GridOptionsBuilder()
grid_option_builder.configure_auto_height()
grid_option_builder.configure_default_column(
filterable=False,
groupable=False,
editable=False,
wrapText=True,
autoHeight=True)
grid_option_builder.configure_column("gene_id_1", header_name="GeneID 1", pinned="left", cellRenderer=fungidb_link_renderer, width=550)
grid_option_builder.configure_column("gene_symbol_1", header_name="Gene 1", pinned="left", width=500)
grid_option_builder.configure_column("description_1", header_name="Description 1", width=1600)
grid_option_builder.configure_column("gene_id_2", header_name="GeneID 2", pinned="left", cellRenderer=fungidb_link_renderer, width=550)
grid_option_builder.configure_column("gene_symbol_2", header_name="Gene 2", pinned="left", width=500)
grid_option_builder.configure_column("description_2", header_name="Description 2", width=1600)
grid_option_builder.configure_column(
"coexp_score",
header_name="Coexp Score",
type=["numericColumn", "customNumericFormat"],
precision=3,
width=600)
grid_option_builder.configure_column(
"blast_EValue",
header_name="Blast E-value",
type=["numericColumn", "customNumericFormat"],
precision=3,
width=600)
grid_option_builder.configure_column(
"scatter_link",
header_name="Expression Scatterplot",
cellRenderer=coexp_scatter_link_renderer,
width=550)
grid_option_builder.configure_selection(selection_mode=False, use_checkbox=False)
AgGrid(
data = top_coexp_hits,
gridOptions = grid_option_builder.build(),
fit_columns_on_grid_load=True,
theme="streamlit",
allow_unsafe_jscode=True)
|