You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you for developing this R package! I am currently using version 0.1.0 and encountered an issue while visualizing a MAF file using ggoncoplot.
I noticed the following behavior:
Setting reorder_row = FALSE sorts genes in ascending order of mutation frequency, whereas reorder_row = TRUE sorts them in descending order.
Setting reorder_col = FALSE orders samples by their names, while reorder_col = TRUE sorts them based on mutation status.
However, ggoncoplot does not seem to provide an option for users to manually specify the order of rows (genes) and columns (samples). Additionally, I attempted to check the vignette using vignette("layout-customize"), but it was unavailable.
Could you please advise if there is a way to manually define the row (gene) and column (sample) order in ggoncoplot?
The text was updated successfully, but these errors were encountered:
Thanks for your patience, and apologies for the outdated documentation! I’m currently updating it. The vignette("layout-customize") you mentioned is now available in the online book at https://yunuuuu.github.io/ggalign-book/layout-customize.html. Note that the book reflects the development version of ggalign (0.1.0.9000), but the solution should work with the released version (0.1.0) as well.
For maftools object, ggoncoplot always uses the gene ordering from the maftools::getGeneSummary if you set reorder_row = FALSE, which already reorder the genes by mutation frequency (From bottom to the top). reorder_row = TRUE reorder the genes by mutation frequency from the top to the bottom (which is what the oncoplot expected).
To manually define the row (gene) and column (sample) order in ggoncoplot, you can use the align_order() function or manually specify the genes argument in ggoncoplot for maftools object. Since I don’t have your data, here’s an example with a simple matrix:
library(ggalign)
# Sample datamat<- read.table(
textConnection(
"s1,s2,s3 snv;indel,snv,indel ,snv;indel,snv snv,,indel;snv"
),
row.names=NULL,
header=TRUE,
sep=",",
stringsAsFactors=FALSE
)
rownames(mat) <- c("g1", "g2", "g3")
mat<- as.matrix(mat)
# Example 1: Manually order rows using numeric indices
ggoncoplot(
mat,
map_width= c(snv=0.5),
map_height= c(indel=0.9),
reorder_row=FALSE
) +
scale_fill_brewer(palette="Dark2", na.translate=FALSE) +# Use anno_left() or anno_right() for row ordering; for columns, use anno_top() or anno_bottom()
anno_left() +
align_order(c(2, 3, 1)) # Orders rows as g2, g3, g1
# Example 2: Manually order rows using row names
ggoncoplot(
mat,
map_width= c(snv=0.5),
map_height= c(indel=0.9),
reorder_row=FALSE
) +
scale_fill_brewer(palette="Dark2", na.translate=FALSE) +
anno_left() +
align_order(c("g2", "g1", "g3")) # Orders rows as g2, g1, g3
For row ordering, you can use either numeric indices (e.g., c(2, 3, 1)) or character names (e.g., c("g2", "g1", "g3")) if your matrix has row names. For column ordering, simply replace anno_left() with anno_top() or anno_bottom() and specify the sample order in align_order(). Note the ordering specified is from bottom to the top or from left to the right which following the ggplot2 coordinates.
Let me know if you have more questions or need help adapting this to your data!
Thank you for developing this R package! I am currently using version 0.1.0 and encountered an issue while visualizing a MAF file using ggoncoplot.
I noticed the following behavior:
Setting reorder_row = FALSE sorts genes in ascending order of mutation frequency, whereas reorder_row = TRUE sorts them in descending order.
Setting reorder_col = FALSE orders samples by their names, while reorder_col = TRUE sorts them based on mutation status.
However, ggoncoplot does not seem to provide an option for users to manually specify the order of rows (genes) and columns (samples). Additionally, I attempted to check the vignette using vignette("layout-customize"), but it was unavailable.
Could you please advise if there is a way to manually define the row (gene) and column (sample) order in ggoncoplot?
The text was updated successfully, but these errors were encountered: