Plot the output of cTWAS at a single locus

ctwas_locus_plot(
  ctwas_res,
  region_tag,
  outputdir,
  outname,
  focus = NULL,
  xlim = NULL,
  ymax_twas = NULL,
  twas_sig_thresh = NULL,
  alt_names = NULL,
  label_panel = c("both", "cTWAS", "TWAS"),
  label_genes = NULL,
  label_pos = NULL,
  plot_eqtl = NULL,
  legend_panel = c("cTWAS", "TWAS"),
  legend_side = c("right", "left"),
  rerun_ctwas = F,
  rerun_load_only = F,
  return_table = F,
  show_correlations = T,
  z_snp = NULL,
  z_gene = NULL,
  empty_gene_track = F
)

Arguments

ctwas_res

the main output of ctwas_rss as a data frame, with z-scores included

region_tag

a character with format "regiontag1_regiontag2" indicating the reigon to plot; e.g. "16_1"

outputdir

a string, the directory where ctwas output is stored

outname

a string, the output name

focus

the focal gene; points are colored by correlations with this gene. The lead TWAS gene by default

xlim

a vector with the start and end positions to plot, in megabases

ymax_twas

the ymax parameter of the TWAS panel

twas_sig_thresh

the significance threshold for TWAS as a p-value

alt_names

the name of the column that contains alternative gene names in ctwas_res; null by default

label_panel

the panel(s) to plot gene gene names; both cTWAS and TWAS panels by default

label_genes

the gene names to label; all by default

label_pos

a vector of the same length as label_genes indicating the position of the gene labels; 1=below, 2=left, 3=above, 4=right. Above by default.

plot_eqtl

the genes to plot eQTL tracks for; the gene specified by focus by default

legend_panel

the panel to plot the legend in

legend_side

the side to plot the legend on

rerun_ctwas

if TRUE, cTWAS will be re-run at this locus with thin=1 to ensure all variants are plotted

rerun_load_only

if TRUE, the function will look for results generated by rerun_ctwas=T without running cTWAS again

return_table

if TRUE, return the table that underlies the plot

show_correlations

if TRUE, genes and variants are colored by their correlations with focus

z_snp

the z_snp argument supplied to ctwas_rss; required if rerun_ctwas=T

z_gene

the z_gene argument supplied to ctwas_rss; required if rerun_ctwas=T

empty_gene_track

if TRUE, leave space below the plot for the gene track generated by the ctwas_locus_plot_genetrack function