gladkia / igvR

An R Bioconductor package providing interactive connections to igv.js (the Integrative Genomics Viewer) in a web browser
MIT License
42 stars 4 forks source link

support multiple colors in annoation tracks #10

Closed malger closed 2 years ago

malger commented 5 years ago

When i load bed annotation tracks into IGV (desktop app) there is support for multiple colors within one annotation track. The color is an optional column within the bed-file called

itemRgb

See the Bed-file specification here: https://www.ensembl.org/info/website/upload/bed.html

When i add a GRangeAnnotationTrack with a color column, this is ignored and the track is colored grey (default coloring).

paul-shannon commented 5 years ago

@malger Thanks for the report and suggestion.

For an immediate solution you may wish to try the following, though this requires that you first transform your GRanges track into a data.frame. This example uses a bed file with all 12 columns, including itemRGB, as in the specification you link to. See simple screenshot below. This code is from inst/unitTests/test_igvR.R, function test_displayDataFrameAnnotationTrack

setGenome(igv, "hg19")
bed.filepath <- system.file(package = "rtracklayer", "tests", "test.bed")
tbl.bed <- read.table(bed.filepath, sep="\t", as.is=TRUE, skip=2)
colnames(tbl.bed) <- c("chrom", "chromStart", "chromEnd", "name", "score", "strand",
                       "thickStart", "thickEnd", "itemRgb", "blockCount", "blockSizes", 
                       "blockStarts")
track.df <- DataFrameAnnotationTrack("bed.12col", tbl.bed)
showGenomicRegion(igv, "chr9:127474000-127478000")
displayTrack(igv, track.df)

In addition, if you will: please attach an absolutely minimal GRanges object which has all the mcols columns you are using - including, I assume, an itemRGB column? image

malger commented 4 years ago

thanks for the help