hms-dbmi / UpSetR

An R implementation of the UpSet set visualization technique published by Lex, Gehlenborg, et al..
https://cran.rstudio.com/web/packages/UpSetR
Other
763 stars 156 forks source link

Possible #225

Open callumparr opened 2 years ago

callumparr commented 2 years ago

Is it possible to customize the y-axes limits when using boxplot.summary. I have an attribute that is the read length of some nanopore sequencing where most data lay within 100 ~ 500 bp but some data extends up to 10,000. It's hard to see any differences between the sets with the limits set to the extremes of the length spread.

The example here is the linear scale and then I tried with the conversion of lengths to logarithmic barcode04_end_upSet.pdf barcode04_end_upSet_log10.pdf

Or would it be possible to make my own custom attribute plot with overlaid length histogram (where I can add ggplot xlimits) subset by the upSet-sets?

https://cran.r-project.org/web/packages/UpSetR/vignettes/attribute.plots.html

Closest I can get to what I want to visualize is this:

# Plot density of read lengths using https://cran.r-project.org/web/packages/UpSetR/vignettes/attribute.plots.html 
upset(barcode04_end_context, order.by = "freq", main.bar.color = "black", queries = list(list(query = intersects, 
    params = list("start_adapter", "end_adapter"), active = T), list(query = intersects, 
    params = list("start_adapter", "end_unmap"), active = T, color = "red"), list(query = intersects, 
    params = list("start_adapter", "end_lambda"), color = "orange", active = T)), attribute.plots = list(gridrows = 50, plots = list(list(plot = histogram, x = "length_log2", queries = T))))

another.plot <- function(data, x, y) {
    myplot <- (ggplot(data, aes_string(x = x, colour = "color")) + geom_density(alpha = 0.4) + scale_x_log10() + theme(plot.margin = unit(c(0, 0, 0, 0), "cm"), legend.key.size = unit(0.4, 
        "cm")))
}

upset(barcode04_end_context, order.by = "freq", main.bar.color = "black", queries = list(list(query = intersects, 
    params = list("start_adapter", "end_adapter"), active = T), list(query = intersects, 
    params = list("start_adapter", "end_unmap"), active = T, color = "red"), list(query = intersects, 
    params = list("start_adapter", "end_lambda"), color = "orange", active = T)), attribute.plots = list(gridrows = 50, plots = list(list(plot = another.plot, x = "length", queries = T))))

00010b