gladkia / igvShiny

An htmlwidget version of igv, for RStudio and Shiny apps
https://gladkia.github.io/igvShiny/
Other
36 stars 24 forks source link

igvShiny 1.0.1 does not process read information with function loadBamTrackFromLocalData from local bam files? #82

Closed ChristianRohde closed 1 month ago

ChristianRohde commented 1 month ago

Hi,

I tested the latest version of igvShiny 1.0.1 on R 4.4.0 and R 4.4.1 with Bioconductor version 3.19. Indeed loading a custom genome from local files works now. Unfortunately, this version does not allow me to load reads from local BAM files (BIGWIG works fine) for visualization. Unfortunately, there is no Error from the command line to report beside this screenshot:

Screenshot 2024-08-09 at 14 35 40

Again I changed back to version 0.99.0 on the productive servers which load the reads as expected:

Screenshot 2024-08-09 at 14 45 21

As far as I see there are some but to my understanding no big changes in the loadBamTrackFromLocalData function between version 1.0.1 and 0.99.0. However, my script to load the reads from BAM with GenomicAlignments::readGAlignments() which I then handover to loadBamTrackFromLocalData is the same. Maybe the new get_tracks_dir() function does not work for my data and therefore the data cannot be exported? Do you have an idea how I can I troubleshoot this?

I added a new version of my test script and an example BAM file. Somehow I had trouble to read in and process the tumor.bam from extdata. It assumes that I have uploaded another custom folder to extdata called example_bam_RNAseq which includes my example file.

example_bam_RNAseq.zip igvshiny_custom_genome_2024.zip

Again, I am still downgraded to 0.99.0 at the moment.

Best, Christian

gladkia commented 1 month ago

Hi @ChristianRohde,

I've removed addResourcePath("tracks", "tracks") from your server.R code and the Shiny app started working as expected. Can you check on your side?

The tracks is the name of the static Shiny resource where all genomic files used in igvShiny are stored. Users asked to make this resource linked to the temporary directory to facilitate auto cleanup (https://github.com/gladkia/igvShiny/issues/25). Thus, by default, tracks is linked to the subdirectory of the tempdir(): https://github.com/gladkia/igvShiny/blob/master/R/zzz.R#L7. Here is my session example:

> igvShiny::get_tracks_dir()
[1] "/tmp/RtmpcXH7Zo/tracks"

> list.files(igvShiny::get_tracks_dir())
[1] "file35246a61d8c.bam"                        "file35246a61d8c.bam.bai"                    "Sars_cov_2.ASM985889v3.101.gff3"           
[4] "Sars_cov_2.ASM985889v3.dna.toplevel.fa"     "Sars_cov_2.ASM985889v3.dna.toplevel.fa.fai"

You can change the path to the tracks with TRACKS_DIR env variable, with sth like: Sys.setenv(TRACKS_DIR = "/path/to/temporary/igvShiny/files"). Once you did it you need to restart the session (as tracks Shiny resource is defined during package onload: https://github.com/gladkia/igvShiny/blob/master/R/zzz.R#L7C3-L7C23). Such move might be useful if you want to see the files you've been working with (e.g. fetched from the remote resource).

ChristianRohde commented 1 month ago

Hi @gladkia

this makes a lot of sense. Indeed after removing the old school settings it also works now for me on two different computers. That's a good update since indeed the tracks folder is getting occupied with the time. I need to adapt my script in many Apps containing igvShiny but I will switch the latest version as soon as I find time.

Thank you, Christian