hgmd.visualize¶
-
hgmd.visualize.
make_combined_plots
(tsne, discrete_exp, marker_exp, plot_genes, path)¶ Plots discrete alongside continuous expression to PDF.
For each gene/gene pair listed in plot_genes, make two scatterplots: a plot showing discrete expression, and a plot showing expression on a color spectrum. For gene pairs, make these two plots separately for each gene. Save each gene/gene pair as a PDF page, then save to path.
Parameters: - tsne – A DataFrame with ‘cell’, ‘tSNE_1’, and ‘tSNE_2’ columns.
- discrete_exp – A DataFrame whose rows are cell identifiers, columns are gene identifiers, and values are boolean values representing gene expression.
- marker_exp – A DataFrame whose rows are cell identifiers, columns are gene identifiers, and values are float values representing gene expression.
- plot_genes – A list of 3-tuples, where the first element of each tuple is another 2-tuple containing the two titles to be used.. The other 2 elements are the gene names to be plotted.
- path – The path to which the PDF will be saved.
Returns: Nothing.
-
hgmd.visualize.
make_discrete_plots
(tsne, discrete_exp, plot_genes, path)¶ Plots discrete gene expression of paired genes to PDF.
For each gene pair listed in plot_genes, make three scatterplots. First, a plot showing joint expression. Then, two plots showing singleton expression for each genes. If a single gene is passed, plot only its expression, and make two blank plots. Save each gene/gene pair as a PDF page, then save to path.
Parameters: - tsne – A DataFrame with ‘cell’, ‘tSNE_1’, and ‘tSNE_2’ columns.
- discrete_exp – A DataFrame whose rows are cell identifiers, columns are gene identifiers, and values are boolean values representing gene expression.
- plot_genes – A list of 3-tuples, where the first element of each tuple is another 3-tuple containing the three plot titles to be used. The other 2 elements are the gene names to be plotted.
- path – The path to which the PDF will be saved.
Returns: Nothing.
-
hgmd.visualize.
make_plot
(ax, title, coords, cmap, draw_cbar=False)¶ Make a single graph on ax with given specs. Plots only absolute values.
-
hgmd.visualize.
make_plots
(pair, sing, tsne, discrete_exp, marker_exp, plot_pages, combined_path, sing_combined_path, discrete_path, tptn_path, sing_tptn_path)¶ General function for all visualization generation. Arguments should be self-explanatory. See __main__.
-
hgmd.visualize.
make_title
(gene_1, gene_2, rank, cutoff_val)¶ Makes a plot title for a gene or gene pair.
Formatting: for pairs, ‘rank $rank: $gene_1+$gene_2’, and for singletons, ‘rank $rank: $gene_1 $cutoff_val’. gene_2 should be None for singletons.
Parameters: genes – A DataFrame with columns ‘gene_1’, ‘gene_2’, ‘rank’, ‘cutoff_val’. Returns: A list of strings containing the titles, with indices corresponding to the input DataFrame. Return type: string list
-
hgmd.visualize.
make_tp_tn_plot
(plot_genes, sing_tp_tn, pair_tp_tn, path)¶ Plots TP/TN rates of genes/pairs to PDF.
For each gene/gene pair listed in plot_genes, plot their TP/TN rate on a scatterplot, labeling the point with the gene/gene pair name. When done, output this scatterplot to PDF and save to path.
Parameters: - plot_genes – An array whose elements are tuples representing gene pairs. If the second element is empty, it represents a singleton.
- sing_tp_tn – A DataFrame with ‘’TP’, and ‘TN’ columns, with gene indices
- pair_tp_tn – A DataFrame with ‘gene_1’, ‘gene_2’, ‘TP’, and ‘TN’ columns.
- path – The path to which the PDF will be saved.
Returns: Nothing.