Skip to content

Commit

Permalink
feat(summarize): save gene ranking table to csv
Browse files Browse the repository at this point in the history
Signed-off-by: Cameron Smith <cameron.ray.smith@gmail.com>
  • Loading branch information
cameronraysmith committed Aug 5, 2024
1 parent 5ca26ff commit 98f5bd6
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/pyrovelocity/tasks/summarize.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import matplotlib.pyplot as plt
import scvelo as scv
from beartype import beartype
from pandas import DataFrame

from pyrovelocity.analysis.analyze import pareto_frontier_genes
from pyrovelocity.io import CompressedPickle
Expand Down Expand Up @@ -200,7 +201,7 @@ def summarize_dataset(
# ##################

save_anndata_counts_to_dataframe(adata, dataframe_path)
gene_parameter_posteriors_path = (
gene_parameter_posteriors_path: Path = (
data_model_reports_path / "gene_parameter_posteriors.csv"
)
save_parameter_posterior_mean_dataframe(
Expand All @@ -209,6 +210,10 @@ def summarize_dataset(
gene_parameter_posteriors_path,
)

gene_ranking_path: Path = data_model_reports_path / "gene_ranking.csv"
volcano_data: DataFrame = posterior_samples["gene_ranking"]
volcano_data.to_csv(gene_ranking_path)

##################
# generate figures
##################
Expand Down Expand Up @@ -239,13 +244,13 @@ def summarize_dataset(
shared_time_plot=shared_time_plot,
)

volcano_data = posterior_samples["gene_ranking"]
number_of_marker_genes = min(
max(int(len(volcano_data) * 0.1), 4), 20, len(volcano_data)
)
logger.info(f"Searching for {number_of_marker_genes} marker genes")
putative_marker_genes = pareto_frontier_genes(
volcano_data, number_of_marker_genes
volcano_data=volcano_data,
num_genes=number_of_marker_genes,
)

# phase portraint predictive plots
Expand Down

0 comments on commit 98f5bd6

Please sign in to comment.