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

CNV Track Colors #20

Open
rkmeade opened this issue Jan 28, 2022 · 2 comments
Open

CNV Track Colors #20

rkmeade opened this issue Jan 28, 2022 · 2 comments

Comments

@rkmeade
Copy link

rkmeade commented Jan 28, 2022

This is more of a request, but I am trying to use the CNV track for visualizing genome-wide QTL.

The issue I'm having is that it accepts only one color instead of a vector of colors, so all radial segments are monochromatic. Would it be possible to modify this track to either accept a single color or a vector of colors?

Thank you for this awesome package!

@rchapple2
Copy link

This would be very helpful. I tried passing a vector of colors, and it correctly assigns each CNV to the appropriate color in the tracks[[1]][[2]]$CNVColor slot. However, it still renders every CNV one color.

@koalive
Copy link
Contributor

koalive commented Oct 20, 2022

It would indeed be a nice addition. As a workaround, it is already possible to define one track per segment. This is doable also when you have a vector of colors (one per segment, or a few colors that should be cycled through).
Adapting the example from the vignette, that would look like that:

library(BioCircos)

# Arcs coordinates
snvChr = rep(4:9, 3)
snvStart = c(rep(1,6), rep(40000000,6), rep(100000000,6))
snvEnd = c(rep(39999999,6), rep(99999999,6), 
  191154276, 180915260, 171115067, 159138663, 146364022, 141213431)
# Values associated with each point, used as radial coordinate 
#   on a scale going to minRadius for the lowest value to maxRadius for the highest value
snvValues = (1:18%%5)+1
# Alternate between colors for each SNV track
snvColors = c("#CC0000", "#00CC00", "#0000CC")
# Loop over each segment and define it as a track
tracks = mapply(
    function(v,w,x,y,z) BioCircosCNVTrack('cnv_track', v, w, x, y, color = z, range = c(0,6)),
    as.character(snvChr), snvStart, snvEnd, snvValues, snvColors
)
tracks = BioCircosTracklist() + unname(tracks)


# Add background
tracks = tracks + BioCircosBackgroundTrack("arcs_background", colors = "#2222EE")

BioCircos(tracks, genomeFillColor = "YlOrBr", genomeTicksDisplay = F, genomeLabelDy = 0)

Hope that helps.

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

No branches or pull requests

3 participants