eweitz / ideogram

Chromosome visualization for the web
https://eweitz.github.io/ideogram
Other
288 stars 72 forks source link

Display annotation track from a BED file #310

Closed LuisGFdez closed 2 years ago

LuisGFdez commented 2 years ago

Hi Eric,

I'm trying to display an annotation track on GCRh38 human assembly

This is my R code, and the problem is that when I run it, it is not displaying the annotations from my bedfile.

app <- Dash$new()

app$layout( htmlDiv( list( htmlLabel("Click a chromosome for a closer look; double-click to return to the overview:"),

                  "GCH38",
  dashbioIdeogram(
    id='my-dashbio-ideogram',
    orientation = "vertical",
    annotationsPath="Documentos/Identical repeats project/Inverted_repeats/after_collapsing_bedfiles/WG_InvertedRepeats_hg38_all_collapsed.bed",
    annotationsLayout = "histogram",
    assembly = "GRCh38",
    chrHeight=250
  )

),
style = list("text-align" = "center")

) )
app$run_server()

eweitz commented 2 years ago

Greetings, Luis! Thanks for using Ideogram.

Are any error messages displayed? I imagine you're running this in a browser, and you'd see such errors in Chrome DevTools Console. (You can open DevTools by clicking the Chrome menu bar, "More Tools", "Developer Tools".)

Also, could you give me a copy of your BED file? It'd be ideal if you could attach a copy of your BED file in a comment here. Less ideally, you can email it to me using the address in my GitHub profile.

LuisGFdez commented 2 years ago

for sure, here it is my bed file WG_InvertedRepeats_hg38_all.zip

LuisGFdez commented 2 years ago

It looks like this is the problem. I'm using firefox as my main browser

Captura de pantalla de 2022-08-10 23-06-43

And this is the message that i get in the R console

request: 127.0.0.1 - ID_127.0.0.1 [10/ago/2022:23:19:32 -0500] "GET /_reload-hash HTTP/1.1" 200 217 "http://127.0.0.1:8050/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:90.0) Gecko/20100101 Firefox/90.0"

Captura de pantalla de 2022-08-10 23-32-42

LuisGFdez commented 2 years ago

Hi Eric,

I just realized that there was a similar problem as mine here https://github.com/eweitz/ideogram/issues/170.

Could you tell me what it is the solution that you gave them?

Captura de pantalla de 2022-08-19 16-30-09

How should I debug

eweitz commented 2 years ago

Hi Luis, your screenshot of the Console panel in Chrome DevTools is helpful! It indicates an error related to cross-origin resource sharing (CORS).

It seems your problematic URL is: https://github.com/LuisGFdez/inverted_repeats/blob/22ae06451ca902fe823998c14086834ee77a0113/chr3.bed

The problem is caused by your file's URL using at a different origin (https://github.com) than the web page you're trying to load it into / share it with (https://eweitz.github.io). The file lacks special HTTP response headers that allow such CORS content.

Try this URL: https://raw.githubusercontent.com/LuisGFdez/inverted_repeats/22ae06451ca902fe823998c14086834ee77a0113/chr3.bed

Files served from https://raw.githubusercontent.com have those special CORS headers, so they can be fetched by web pages on different origins.

You can see it live here: https://eweitz.github.io/ideogram/annotations-file-url?asm=GRCh38&annotsUrl=https://raw.githubusercontent.com/LuisGFdez/inverted_repeats/22ae06451ca902fe823998c14086834ee77a0113/chr3.bed

There, you'll see the BED file display successfully (albeit extremely densely) along chromosome 3.

Let me know if more would help!

LuisGFdez commented 2 years ago

Thank u so much. One more question, is it possible to display a bed file stored with Git LFS as this one: https://github.com/LuisGFdez/inverted_repeats/blob/main/WG_InvertedRepeats_hg38_all_collapsed.bed

And is it already the T2T ideogram available?

eweitz commented 2 years ago

is it possible to display a bed file stored with Git LFS

Not directly like non-LFS files, it seems.

Instead of returning file content, https://raw.githubusercontent.com/LuisGFdez/inverted_repeats/3ea36ee81fb892bc1b6c274f0062fcb0bcf02091/WG_InvertedRepeats_hg38_all_collapsed.bed returns:

version https://git-lfs.github.com/spec/v1 oid sha256:247e20d9c183fb4ffad15c1c8cce8aa418f38949ad58a16df8de575e37c860a3 size 93870154

That said, it might be nice to add support for gzip-compressed BED files. This might let you decrease file size enough to not trigger "large file storage" limits, letting you host genomic data via GitHub in a CORS-friendly way.

If that sounds useful to you, please open a new issue like "Support gzipped BED files".

And is it already the T2T ideogram available?

Not yet, but that seems straightforward in theory. Please open an issue like "Support T2T human genome" if you'd like it!

eweitz commented 2 years ago

Thanks for opening those separate issues! For convenient reference, these are #314 and #315.