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

Add RemoteAlignmentTrack method #15

Closed sklas closed 3 years ago

sklas commented 3 years ago

The RemoteAlignmentTrack method can visualize bam files served by a web-server like it is done with genomes in the "setCustomGenome" method. The method is very simple and builds an alignment track based on a bamURL and bamIndex.

paul-shannon commented 3 years ago

@sklas - thanks for the PR. Could you add a demo? Into the (inappropriately named! inst/unitTests directory)?

sklas commented 3 years ago

Hi Paul, sure. In order to test the demo, I stumbled over missing indexing in the "displayAlignmentTrackFromUrl" JS function. Thats also fixed and I hope it doesn't break anything.

paul-shannon commented 3 years ago

@sklas - Steffen, thanks for the new track, and the demo. It works nicely.

One question for you. If you look at the VariantTrack class, instances can be created with either a VCF object or a url.

  vcf.sub <- readVcf(f, "hg19", param=roi)
   track <- VariantTrack("chr22-tiny", vcf.sub)

or

data.url <- sprintf("%s/%s", "https://s3.amazonaws.com/1000genomes/release/20130502",
                                 "ALL.wgs.phase3_shapeit2_mvncall_integrated_v5b.20130502.sites.vcf.gz")
index.url <- sprintf("%s.tbi", data.url)
url <- list(data=data.url, index=index.url)
track <- VariantTrack("1kg", url)

What do you think about using the same approach for the AlignmentTrack? One constructor, supporting different data types?