View source: R/make_miami_labels.R
make_miami_labels | R Documentation |
Make label data.frame for miami plot
make_miami_labels( data, hits_label_col, hits_label = NULL, top_n_hits = 5, logged_p = "logged_p", rel_pos = "rel_pos" )
data |
A data.frame object. Required. |
hits_label_col |
Either the name of the column(s), max = 2, to use for
automatically labeling n hits, determined using |
hits_label |
A user-specified character vector of probes/genes/SNPs to label. Defaults to NULL. |
top_n_hits |
How many of the top hits do you want to label? Defaults to 5. Set to NULL to turn off this filtering, but this is not recommended because the plot can get cluttered easily. |
logged_p |
The name of the column containing your logged p-value
information. Defaults to "logged_p," assuming data preparation with
|
rel_pos |
The name of the column containing the positon of each
SNP/probe relative to all other SNPs/probes in the genome. Defaults to
"rel_pos," assuming data preparation with |
A data.frame with three columns: relative position, logged p-value, and the label to add to the miami plot. Designed to be used with ggrepel.
Julie White
https://github.com/juliedwhite/miamiplot
## Not run: # If you have already run prep_miami_data and want to label the top 5 hits # with SNP and gene name: upper_top5_labels <- make_miami_labels(data = plot_data$upper, hits_label_col = c("SNP", "Gene")) # If you have already run prep_miami_data and want to label the top 10 hits # from the AHRR, TBX15, and RARA genes: upper_top10_labels <- make_miami_labels(data = plot_data$upper, hits_label_col = "Gene", hits_label = c("AHRR", "TBX15", "RARA"), top_n_hits = 10) # When labeling, the items in hits_label must all come from a single column. # Specifying multiple columns will return an error. ggmiami(data = gwas_results, split_by = "study", split_at = "A", hits_label_col = c("chr", Gene"), hits_label = c("1", AHRR", "2", "TBX15", "RARA"), top_n_hits = 10) # If you have not run prep_miami_data: labels <- make_miami_labels(datat = df, hits_label_col = c("SNP", "pos"), logged_p = "logp", rel_pos = "relative_SNP_position") ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.