Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plotPairsArches, archHeight, Y-axis #95

Open
Elliott77 opened this issue Aug 16, 2023 · 4 comments
Open

plotPairsArches, archHeight, Y-axis #95

Elliott77 opened this issue Aug 16, 2023 · 4 comments

Comments

@Elliott77
Copy link

Hi! I am using the function plotPairsArches() to plot HiChIP contacts and providing it with values for the arch height. It's not clear to me now to draw an accompanying y-axis that will be in the same units as archHeight. I'm using annoYaxis() for the y-axis, it just gives me an axis with height of 2. Thanks!

@nekramer
Copy link
Member

Hi there! Thanks for checking out plotgardener! We have designed the archHeight functionality of plotPairsArches to be flexible to scale to any numeric range of data supplied, regardless of the unit of that feature. For example, maybe your pairs have information about contact frequency, and these contact frequencies are counts ranging from 0 to 120. plotgardener will then use this values to scale the heights of the arches relative to the plotting space, while maintaining the original scaling of the data. This would make the y-axis made with annoYaxis an axis with range 0 to 120 contacts (and you can label the title of the axis as such). In the case of your data, it seems that whatever values you are supplying as archHeight span from 0 to 2 of whatever kind of unit that particular feature is.

I hope this helps clarify the functionality, and I'd be happy to answer any more questions you have!

Best,
Nicole

@Elliott77
Copy link
Author

Thanks Nicole! And thanks again for working on plotgardener!
The archHeight numbers I am supplying to plotPairsArches range from 2 to 12 (the numbers are observed / expected reads ). This is not reflected in the axis drawn with annoYaxis which still just gives me a range of ~0-2. Let me know if there is something obvious I am missing in the code below. Also, can I set a max height with plotPairsArches to be higher than the arches I am plotting? i.e. is there something similar to ymax = c(0,20)?

Thanks again,

Elliott


quartz("this11", 7.5, 8)
pageCreate(width = 7.5, height = 6.5, default.units = "inches", params = params, showGuides = F)

bedpe.df  <- data.frame(V1 = "chr8" , V2 = 91620000, V3 = 91630000, V4 = "chr8", V5 = 91710000 , V6 = 91720000, V7 = "String",  V8 = 12, V9= "+", V10 = "-") 

params <- pgParams(
  chrom = chrom00,
  chromstart = 91156101, chromend = 92636101,
  assembly = "mm10",
  width = 7)

archPlotmm <- plotPairsArches(
  data = bedpe.df, params = params, 
                fill = "firebrick3",
                linecolor = NA,
                archHeight = "V8", alpha = alpha00,
                x = 0.25, y = 0.25, height = 2.5, width = 7,
                just = c("left", "top"),
                default.units = "inches", assembly = "mm10",draw = T
  )
  
  annoYaxis(
    plot = archPlotmm, 
    fontsize = 10,
    label = T, axisLine = T
  )

@Elliott77
Copy link
Author

chrom00 <- "chr8"

@nekramer
Copy link
Member

What version of plotgardener are you using? Also is it possible that the region for your particular data does not include any data with observed/expected reads > 2? When I run the example you gave me, annoYaxis() produces a y-axis with range(0, 12) since that arch falls in the region and is the maximum height (here I've only slightly adjusted the dimensions of the page and plot):

library(plotgardener)
#> 
#> Attaching package: 'plotgardener'
#> The following object is masked from 'package:base':
#> 
#>     c
pageCreate(width = 5, height = 2, default.units = "inches", showGuides = FALSE)

bedpe.df  <- data.frame(V1 = "chr8" , V2 = 91620000, V3 = 91630000, V4 = "chr8", V5 = 91710000 , V6 = 91720000, V7 = "String",  V8 = 12, V9= "+", V10 = "-") 

params <- pgParams(
    chrom = "chr8",
    chromstart = 91156101, chromend = 92636101,
    assembly = "mm10",
    width = 7)

archPlotmm <- plotPairsArches(
    data = bedpe.df, params = params, 
    fill = "firebrick3",
    linecolor = NA,
    archHeight = "V8",
    x = 0.5, y = 0.25, height = 2, width = 4.5,
    just = c("left", "top"),
    default.units = "inches", assembly = "mm10",draw = T
)
#> arches[arches1]

annoYaxis(
    plot = archPlotmm, 
    fontsize = 10,
    label = T, axisLine = T
)
#> yaxis[yaxis1]

Created on 2023-08-18 with reprex v2.0.2

Unfortunately, we do not have a way to set the maximum height to be higher than the arches you're plotting, but this is something we can work on incorporating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants