Open rkmeade opened 2 years ago
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.
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.
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!