view_clustered_myHeatmap: Create a heatmap of analysis results.

View source: R/view_clustered_myHeatmap.R

view_clustered_myHeatmapR Documentation

Create a heatmap of analysis results.

Description

Produces a heatmap of scaled values by row and then makes an unscaled average value column to the right of it.

Usage

view_clustered_myHeatmap(
  my_pack = NULL,
  sample_names = NULL,
  groups = NULL,
  input_df = NULL,
  base_title = NULL,
  base_file_name = NULL,
  output_dir = NULL,
  pdf_metadata = NULL,
  models_argument_list = NULL,
  imported_annotation = NULL,
  t.colors = NA,
  fileName = "cluster.cdt",
  linkage = "complete",
  distance = "pearson",
  contrast = 2,
  returnSampleClust = F,
  rowNames = NA,
  rightMar = 7,
  bottomMar = 1
)

Arguments

my_pack

A named list for analysis modules to send parameters to the view function in a more compact fashion:

  • sample_names

  • groups

  • input_df

  • base_file_name

  • base_title

  • output_dir

  • pdf_metadata

  • argument_list

  • my_model

  • annotation

  • FDR_pValue

  • pValue

  • fold_change

These list items may be overridden by specifying them individually. They are described in more detail below.

sample_names

Overrides my_pack$sample_names. Should be the sample names you want to have for the scaled values. They should be in the order you want them displayed. They should correspond to the rows of input_df. They should have the same order as thier groups.

groups

Overrides my_pack$groups A factored vector indicating what groups the samples belong to. Should be the same length as sample_names. Their order should match sample_names. They should be factored with the order matching the order in which they should be displayed. They should be formatted how you would like them displayed.

input_df

Overrides my_pack$input_df A data frame with one row per sample. Column names should correspond to the features along the y axis of the heatmap. Row order should correspond to the samples/groups should be in the order in which you would like them displayed.

base_title

Overrides my_pack$base_title. String to specify the title of the graph.

base_file_name

Overrides my_pack$base_file_name. String to specify the file name.

output_dir

Overrides my_pack$output_dir. Path to folder where the heatmap output should go. Analysis modules will determine this automatically.

pdf_metadata

Overrides my_pack$pdf_metadata. Contains data from the arguments list that should be put in the metadata of the pdf.

models_argument_list

Overrides my_pack$argument_list. Lists all of the arguments sent to the analysis module.

imported_annotation

Overrides my_pack$annotation. Annotations describe the steps taken during the analysis module and previous steps. This function will also add annotation steps to provide a full description of how the graph was generated.

my_model

Overrides my_pack$my_model. Links to all graphs are logged on a d3.js table. This variable will specify what model name was used to generate the graph on that table.

FDR_pValue

Overrides my_pack$FDR_pValue. Numeric vector with length equal to ncol(input_df). If FDR_threshhold is not NULL then only features with an FDR_pValue less than the FDR_threshhold will be included.

pValue

Overrides my_pack$pValue. Numeric vector with length equal to ncol(input_df). If pValue_threshhold is not NULL then only features with a pValue less than the pValue_threshhold will be included.

fold_change

Overrides my_pack$fold_change. Numeric vector with length equal to ncol(input_df). If order_by_fold_change == TRUE then features will be ordered according to this value from high to low, where 'higher' fold change indicates group2 was higher than group1.

order_by_fold_change

Logical indicating whether the features should be ordered by fold change. See fold_change argument.

base_for_log_transform

Integer indicating the base to transform the data, which will be shown in the averages. NULL will results in no transformation.

sample_panel_spacing

unit() used to set the spacing between individual sample panels.

average_panel_spacing

unit() used to set the spacing between average sample panels, usually 0.

show_sample_names

Boolean indicating whether individual sample names should be listed along the x axis. This axis can get cluttered quickly if there are a lot of samples.

append_classifier_to_sample_name

Boolean indicating whether the sample group should be added to the end of the sample names. This option isn't really needed after having added facet titles.

panel_label_switch

'x' switches the x axis label to the bottom. NULL leaves the labels where they are.

panel.strip.background

For specifying the element_rect of the panel strip background (eg. element_rect(fill = 'gray95')).

panel.strip.text.x

For specifying the element_rect of the panel strip (eg. element_text(size=18, angle = 0, hjust = 0.5, vjust = 0).

FDR_threshhold

If not NULL, features with an FDR_pValue above this value will not be shown.

pValue_threshhold

If not NULL, features with an pValue above this value will not be shown.

display_all_names

Boolean indicating whether the feature names should be displayed along the y axis.

graph_rel_widths

Numeric vector of length 2 (eg. c(8, 2.5)) whose ratio determines the size of the individual sample panel vs the averages.

axis.text.x

element_text() object to define the x axis for the sample and average plots

axis.text.y.size

Number indicating the size of the text for the feature names along the y axis.

pdf_width

Sets the width (inches) of the pdf output

pdf_height

Sets the height (inches) of the pdf output

log_completion

Binary indicting whether the graph should be added to the table of completed analyses.

primary_title_options

List of options to modify primary title. Title content should be set with base_title. eg: list(x=0.5,y=0.965,size=8)

secondary_title

List of options to modify and set secondary title. eg: list(x=1,y=0.99,size=3,label="FDR < 0.05 shown")

plot_scale

numeric to change how much of the page the plots take up

legend_title

element_text() object to modify the disply of the legend titles

legend_text

element_text() object to modify the disply of the legend text

legend_key_width

unit() for the width of both legends

legend_key_height

unit() for the height of both legends

ave_legend_margin

margin(t, r, b, l, "pt")

zscore_legend_margin

margin(t, r, b, l, "pt")

ave_plot_margin

unit(t, r, b, l, "pt")

zscore_plot_margin

unit(t, r, b, l, "pt")

left_legend_pos

string for position of zscore plot

right_legend_pos

string for position of average plot

axis_title_x

element_text() or element_blank() for axis of zscore plot

axis_title_y

element_text() or element_blank() for axis of zscore plot

axis_title_x_lab

string for axis of zscore plot, usually blank

axis_title_y_lab

string for aixs of zscore plot, usually blank

zscore_colors

vector of colors for z scale, overrides average colors if average_scaled_vlaues == T

average_colors

vecotr of colors

average_scaled_values

boolean indicating whether the average should be done on the raw gene expression or scaled values

axis_text_y_remove_strings

Strings in this character vector will be removed from the y axis text.

axis_text_y_nchar

Integer to specify the number of characters that will be displayed in the y axis text before clipping

pdf_bookmark_title

String indicating the name of the bookmark that will be used when concatentaing the pdf's into a report

annotate_pdf

Boolean indicating whether the pdf metadata should be chnaged. Is pdftk present?

output_subfolder

Path to the output sub directory folder. Multiple views of the same analysis should have unique names lest they overwrite one another. XX indicates this folder will be dropped from the TOC and bookmarks

tile_width_factor

Changes the size of the tiles to get rid of gaps or create them. Goes into geom_tile width parameter.

tile_height_factor

Changes the size of the tiles to get rid of gaps or create them. Goes into geom_tile height parameter.

Details

view_clustered_myHeatmap was created to make heatmaps of gene expression data, although it could be used to display the distribution of any numeric features. It's important to not scale data prior to heatmap to not disrupt average values.

Value

Several outputs are produced: 1) Heatmaps; 2) Heatmaps pdf; 3) An annotation file describing the steps taken on the data from start to finish; 4) A matrix file containing the sample z-scores for each sample and the average values displayed in the heatmap; 5) If log_completion == TRUE, a link is made to the pdf on the d3.js html indexing table using add_to_completed_analyses.

Limitations

  • ...

Future changes

  • ...


Benjamin-Vincent-Lab/binfotron documentation built on Oct. 1, 2024, 8:33 p.m.