Report glow up 2 [CW-7207]
This commit is contained in:
parent
8c6196ddc1
commit
f45056c438
@ -213,6 +213,27 @@ def _create_warning_banner(message, level="warning"):
|
|||||||
raw(message)
|
raw(message)
|
||||||
|
|
||||||
|
|
||||||
|
def _volcano_style():
|
||||||
|
return raw("""
|
||||||
|
<style>
|
||||||
|
.volcano-table-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||||
|
gap: 20px 10px;
|
||||||
|
align-items: start;
|
||||||
|
}
|
||||||
|
.volcano-table-grid > * {
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
@media screen and (max-width: 1000px) {
|
||||||
|
.volcano-table-grid {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
""")
|
||||||
|
|
||||||
|
|
||||||
def _as_string_list(value):
|
def _as_string_list(value):
|
||||||
"""Normalize optional values to a compact list of strings."""
|
"""Normalize optional values to a compact list of strings."""
|
||||||
if value is None or value == "none":
|
if value is None or value == "none":
|
||||||
@ -906,11 +927,7 @@ def main(args):
|
|||||||
)
|
)
|
||||||
|
|
||||||
warnings_df = pd.DataFrame(warnings_data)
|
warnings_df = pd.DataFrame(warnings_data)
|
||||||
DataTable.from_pandas(
|
DataTable.from_pandas(warnings_df, paging=False, use_index=False)
|
||||||
warnings_df,
|
|
||||||
paging=False,
|
|
||||||
use_index=False,
|
|
||||||
)
|
|
||||||
|
|
||||||
with report.add_section("Differential gene expression", "DGE"):
|
with report.add_section("Differential gene expression", "DGE"):
|
||||||
tabs = Tabs()
|
tabs = Tabs()
|
||||||
@ -944,33 +961,15 @@ def main(args):
|
|||||||
with p():
|
with p():
|
||||||
strong("Note: ")
|
strong("Note: ")
|
||||||
raw(contrast_data["dtu_power_warning"])
|
raw(contrast_data["dtu_power_warning"])
|
||||||
|
|
||||||
DataTable.from_pandas(table, use_index=False)
|
DataTable.from_pandas(table, use_index=False)
|
||||||
|
|
||||||
h3("Gene expression volcano Plot")
|
h3("Gene expression volcano Plot")
|
||||||
vol, class_table, selected_table = volcano(table)
|
gn_vol, gn_class_table, gn_selected_table = volcano(table)
|
||||||
EZChart(vol, width="100%", height="550")
|
EZChart(gn_vol, width="100%", height="550")
|
||||||
raw("""
|
with div(style=_volcano_style()):
|
||||||
<style>
|
|
||||||
.volcano-table-grid {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
||||||
gap: 20px 10px;
|
|
||||||
align-items: start;
|
|
||||||
}
|
|
||||||
.volcano-table-grid > * {
|
|
||||||
min-width: 0;
|
|
||||||
}
|
|
||||||
@media screen and (max-width: 1000px) {
|
|
||||||
.volcano-table-grid {
|
|
||||||
grid-template-columns: 1fr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
""")
|
|
||||||
with div(_class="volcano-table-grid"):
|
with div(_class="volcano-table-grid"):
|
||||||
EZChart(class_table, width="100%", height="auto")
|
EZChart(gn_class_table, width="100%", height="auto")
|
||||||
EZChart(selected_table, width="100%", height="auto")
|
EZChart(gn_selected_table, width="100%", height="auto")
|
||||||
|
|
||||||
with report.add_section("Differential transcript usage", "DTU"):
|
with report.add_section("Differential transcript usage", "DTU"):
|
||||||
tabs = Tabs()
|
tabs = Tabs()
|
||||||
@ -1007,15 +1006,17 @@ def main(args):
|
|||||||
level="warning",
|
level="warning",
|
||||||
)
|
)
|
||||||
|
|
||||||
# Show table if available
|
|
||||||
if contrast_name in dtu_tables:
|
if contrast_name in dtu_tables:
|
||||||
DataTable.from_pandas(
|
dtu_table = dtu_tables[contrast_name]
|
||||||
dtu_tables[contrast_name],
|
DataTable.from_pandas(dtu_table, use_index=False)
|
||||||
use_index=False,
|
|
||||||
)
|
|
||||||
h3("Transcript expression volcano Plot")
|
|
||||||
# EZChart(volcano(dtu_tables[contrast_name]))
|
|
||||||
|
|
||||||
|
h3("Transcript expression volcano Plot")
|
||||||
|
tr_vol, tr_class_table, tr_selected_table = volcano(dtu_table)
|
||||||
|
EZChart(tr_vol, width="100%", height="550")
|
||||||
|
with div(style=_volcano_style()):
|
||||||
|
with div(_class="volcano-table-grid"):
|
||||||
|
EZChart(tr_class_table, width="100%", height="auto")
|
||||||
|
EZChart(tr_selected_table, width="100%", height="auto")
|
||||||
else:
|
else:
|
||||||
p("No DTU results available for this contrast.")
|
p("No DTU results available for this contrast.")
|
||||||
|
|
||||||
|
|||||||
@ -768,8 +768,9 @@ def volcano(data, fold_threshold=1, p_threshold=0.05):
|
|||||||
}
|
}
|
||||||
selected.forEach(function(index) {
|
selected.forEach(function(index) {
|
||||||
if (view_toggle.active) {
|
if (view_toggle.active) {
|
||||||
selectedLabel[index] = \
|
selectedLabel[index] = identifier_col === "TXNAME"
|
||||||
data.gene_name[index] || data[identifier_col][index];
|
? data.TXNAME[index]
|
||||||
|
: (data.gene_name[index] || data[identifier_col][index]);
|
||||||
}
|
}
|
||||||
selectedData.source_index.push(index);
|
selectedData.source_index.push(index);
|
||||||
selectedData.owner_id.push(selected_source.id);
|
selectedData.owner_id.push(selected_source.id);
|
||||||
@ -900,8 +901,10 @@ def volcano(data, fold_threshold=1, p_threshold=0.05):
|
|||||||
gene_name: [],
|
gene_name: [],
|
||||||
};
|
};
|
||||||
selection_state.data.indices[0].forEach(function(index) {
|
selection_state.data.indices[0].forEach(function(index) {
|
||||||
selectedLabel[index] = \
|
selectedLabel[index] = identifier_col === "TXNAME"
|
||||||
source.data.gene_name[index] || source.data[identifier_col][index];
|
? source.data.TXNAME[index]
|
||||||
|
: (source.data.gene_name[index] || \
|
||||||
|
source.data[identifier_col][index]);
|
||||||
highlightData.log2FoldChange.push(source.data.log2FoldChange[index]);
|
highlightData.log2FoldChange.push(source.data.log2FoldChange[index]);
|
||||||
highlightData.neg_log10_padj.push(source.data.neg_log10_padj[index]);
|
highlightData.neg_log10_padj.push(source.data.neg_log10_padj[index]);
|
||||||
highlightData.mean_expression.push(source.data.mean_expression[index]);
|
highlightData.mean_expression.push(source.data.mean_expression[index]);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user