This function creates a 'volc3d' object of S4 class for downstream plots
containing the p-values from a three-way group comparison, expression data
sample data and polar coordinates. For RNA-Seq count data, two functions
deseq_polar
or voom_polar
can be used instead.
polar_coords( outcome, data, pvals = NULL, padj = pvals, pcutoff = 0.05, fc_cutoff = NULL, scheme = c("grey60", "red", "gold2", "green3", "cyan", "blue", "purple"), labs = NULL, ... )
outcome | Outcome vector with 3 groups, ideally as a factor. If it is
not a factor, this will be coerced to a factor. This must have exactly 3
levels. NOTE: if |
---|---|
data | Dataframe or matrix with variables in columns |
pvals | Matrix or dataframe with p-values. The first column represents a
test across all 3 categories such as one-way ANOVA or likelihood ratio
test. Columns 2-4 represent pairwise tests comparing groups A vs B, A vs C
and B vs C, where A, B, C represent levels 1, 2, 3 in |
padj | Matrix or dataframe with adjusted p-values. If not supplied,
defaults to use nominal p-values from |
pcutoff | Cut-off for p-value significance |
fc_cutoff | Cut-off for fold change on radial axis |
scheme | Vector of colours starting with non-significant variables |
labs | Optional character vector for labelling groups. Default |
... | Optional arguments passed to |
Returns an S4 'volc3d' object containing:
'df' A list of 2 dataframes. Each dataframe contains both x,y,z
coordinates as well as polar coordinates r, angle. The first dataframe has
coordinates on scaled data. The 2nd dataframe has unscaled data (e.g. log2
fold change for gene expression). The type
argument in
volcano3D
, radial_plotly
and
radial_ggplot
corresponds to these dataframes.
'outcome' The three-group contrast factor used for comparisons
'data' Dataframe or matrix containing the expression data
'pvals' A dataframe containing p-values. First column is the 3-way comparison (LRT or ANOVA). Columns 2-4 are pairwise comparisons between groups A vs B, A vs C and B vs C, where A, B, C are the 3 levels in the outcome factor.
'padj' A dataframe containing p-values adjusted for multiple testing
'pcutoff Numeric value for cut-off for p-value significance
'scheme' Character vector with colour scheme for plotting
'labs' Character vector with labels for colour groups
data(example_data) syn_polar <- polar_coords(outcome = syn_example_meta$Pathotype, data = t(syn_example_rld))