Merge branch '20_volcano_points_cw-7277' into 'dev'
Use all point for volcano and tables [CW-7277] See merge request epi2melabs/workflows/wf-transcriptomes!300
This commit is contained in:
commit
abf467e528
@ -4,6 +4,7 @@ import json
|
|||||||
import math
|
import math
|
||||||
import os
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
import warnings
|
||||||
|
|
||||||
from bokeh.resources import INLINE as BOKEH_INLINE
|
from bokeh.resources import INLINE as BOKEH_INLINE
|
||||||
from dominate.tags import (
|
from dominate.tags import (
|
||||||
@ -18,12 +19,19 @@ from ezcharts.layout.resource import Resource as EZC_Resource
|
|||||||
from ezcharts.layout.snippets import Tabs
|
from ezcharts.layout.snippets import Tabs
|
||||||
from ezcharts.layout.snippets.table import DataTable
|
from ezcharts.layout.snippets.table import DataTable
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
|
||||||
from .hierarchical_clustering import hierarchical, clustering_info # noqa: ABS101
|
from .hierarchical_clustering import hierarchical, clustering_info # noqa: ABS101
|
||||||
from .util import get_named_logger, wf_parser # noqa: ABS101
|
from .util import get_named_logger, wf_parser # noqa: ABS101
|
||||||
from .volcano import volcano # noqa: ABS101
|
from .volcano import volcano # noqa: ABS101
|
||||||
|
|
||||||
|
|
||||||
|
# Suppress asyncio deprecation warning triggered by dominate on Python 3.10+.
|
||||||
|
# dominate calls asyncio.get_event_loop() outside a running async context.
|
||||||
|
warnings.filterwarnings(
|
||||||
|
"ignore",
|
||||||
|
message="There is no current event loop",
|
||||||
|
category=DeprecationWarning,
|
||||||
|
)
|
||||||
|
|
||||||
classification_categories = {
|
classification_categories = {
|
||||||
"Full splice match": (
|
"Full splice match": (
|
||||||
"Reference and query isoforms have the same number of exons and "
|
"Reference and query isoforms have the same number of exons and "
|
||||||
@ -207,7 +215,9 @@ def _contrast_results(de_dir, filename, n=None):
|
|||||||
data = table
|
data = table
|
||||||
if n is not None:
|
if n is not None:
|
||||||
data = data.head(n)
|
data = data.head(n)
|
||||||
|
data.sort_values("padj", ascending=True, inplace=True)
|
||||||
tables[contrast_dir.name] = data
|
tables[contrast_dir.name] = data
|
||||||
|
|
||||||
return tables
|
return tables
|
||||||
|
|
||||||
|
|
||||||
@ -1074,7 +1084,7 @@ def main(args):
|
|||||||
clustering_info('gene')
|
clustering_info('gene')
|
||||||
tabs = Tabs()
|
tabs = Tabs()
|
||||||
for contrast, table in _contrast_results(
|
for contrast, table in _contrast_results(
|
||||||
args.de_dir, "results_dge.tsv", n=20
|
args.de_dir, "results_dge.tsv"
|
||||||
).items():
|
).items():
|
||||||
with tabs.add_tab(contrast):
|
with tabs.add_tab(contrast):
|
||||||
# Check for contrast-specific warnings
|
# Check for contrast-specific warnings
|
||||||
@ -1103,7 +1113,14 @@ 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.head(args.de_table_size), use_index=False
|
||||||
|
)
|
||||||
|
with div(cls="clustering-info"):
|
||||||
|
raw(
|
||||||
|
f"Table showing the top {args.de_table_size} genes sorted "
|
||||||
|
"by adjusted p-value. <br><br><br>"
|
||||||
|
)
|
||||||
|
|
||||||
h3("Gene expression volcano Plot")
|
h3("Gene expression volcano Plot")
|
||||||
gn_vol, gn_class_table, gn_selected_table = volcano(table)
|
gn_vol, gn_class_table, gn_selected_table = volcano(table)
|
||||||
@ -1139,7 +1156,7 @@ def main(args):
|
|||||||
|
|
||||||
tabs = Tabs()
|
tabs = Tabs()
|
||||||
dtu_tables = _contrast_results(
|
dtu_tables = _contrast_results(
|
||||||
args.de_dir, "results_dtu_transcript.tsv", n=20)
|
args.de_dir, "results_dtu_transcript.tsv")
|
||||||
|
|
||||||
for contrast in sorted(Path(args.de_dir).iterdir()):
|
for contrast in sorted(Path(args.de_dir).iterdir()):
|
||||||
if not contrast.is_dir():
|
if not contrast.is_dir():
|
||||||
@ -1173,7 +1190,14 @@ def main(args):
|
|||||||
|
|
||||||
if contrast_name in dtu_tables:
|
if contrast_name in dtu_tables:
|
||||||
dtu_table = dtu_tables[contrast_name]
|
dtu_table = dtu_tables[contrast_name]
|
||||||
DataTable.from_pandas(dtu_table, use_index=False)
|
DataTable.from_pandas(
|
||||||
|
dtu_table.head(args.de_table_size), use_index=False
|
||||||
|
)
|
||||||
|
with div(cls="clustering-info"):
|
||||||
|
raw(
|
||||||
|
f"Table showing the top {args.de_table_size} "
|
||||||
|
"transcripts sorted by adjusted p-value. <br><br><br>"
|
||||||
|
)
|
||||||
|
|
||||||
h3("Transcript expression volcano Plot")
|
h3("Transcript expression volcano Plot")
|
||||||
tr_vol, tr_class_table, tr_selected_table = volcano(dtu_table)
|
tr_vol, tr_class_table, tr_selected_table = volcano(dtu_table)
|
||||||
@ -1224,6 +1248,12 @@ def argparser():
|
|||||||
default=None,
|
default=None,
|
||||||
help="Annotation reference summary TSV.",
|
help="Annotation reference summary TSV.",
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--de_table_size",
|
||||||
|
default=500,
|
||||||
|
type=int,
|
||||||
|
help="Number of rows to show in DE/DTU result tables.",
|
||||||
|
)
|
||||||
parser.add_argument("--versions", required=True, help="Versions directory.")
|
parser.add_argument("--versions", required=True, help="Versions directory.")
|
||||||
parser.add_argument("--params", required=True, help="Workflow params JSON.")
|
parser.add_argument("--params", required=True, help="Workflow params JSON.")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user