Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

loadBedGraphTrackFromURL rewrites the config vars including url #35

Open
malcook opened this issue Oct 7, 2022 · 4 comments
Open

loadBedGraphTrackFromURL rewrites the config vars including url #35

malcook opened this issue Oct 7, 2022 · 4 comments
Assignees

Comments

@malcook
Copy link

malcook commented Oct 7, 2022

There appears to be some debugging/testing code left in Shiny.addCustomMessageHandler("fubar", which is responsible for rewriting the url to a hardcoded value, as can be seen in the javascript console:

(text version copied below)
image

Perhaps I should not be working off master?

FWIW: I am trying to suss out how to load a bigbed file by URL and could use some guidance...

=== loadBedGraphTrackFromURL
igvShiny.js:7 
{elementID: 'igvShiny_0', trackName: 'meme.ame.all.shuffle', url: 'http://webfs/Sci/SCI-003911-GPFGRIZ/sequenceanalysis/run8/PRLT/meme/ame/shuffle/all.shuffle.bb', color: 'gray', trackHeight: 30, …}
igvShiny.js:521 --- loading bedGraphTrackFromURL
igvShiny.js:522 
{url: 'https://www.encodeproject.org/files/ENCFF000ASF/@@download/ENCFF000ASF.bigWig', name: 'GM12878 H3K4me3', color: 'rgb(200,0,0)', autoscaleGroup: '1'}
autoscaleGroup
: 
"1"
color
: 
"rgb(200,0,0)"
format
: 
"bigwig"
name
: 
"GM12878 H3K4me3"
type
: 
"wig"
url
: 
"https://www.encodeproject.org/files/ENCFF000ASF/@@download/ENCFF000ASF.bigWig"
[[Prototype]]
: 
Object
@paul-shannon
Copy link
Collaborator

paul-shannon commented Oct 7, 2022 via email

@malcook
Copy link
Author

malcook commented Oct 7, 2022

Paul,

I have placed a smallish bigbed at https://research.stowers.org/mec/A.distal.all.bb

Bigbeds are already compressed so I sill not gzip it.

I can load into IGV desktop using "File > Load From URL"

But, there is no hurry at all since I have figured out how to define my own generic loadTrack function which formats ... as JSON payload to config any igv.js compatible track.

Like this:

loadTrack<-function (session, id, trackName,
                     deleteTracksOfSameName = TRUE, quiet = TRUE,...)
{
    if (!quiet) {
        log("--- igvShiny::loadTrack")
    }
    if (deleteTracksOfSameName) {
        removeTracksByName(session, id, trackName)
    }
    configJSON<-rjson::toJSON(rlang::dots_list(...))
    state[["userAddedTracks"]] <- unique(c(state[["userAddedTracks"]],         trackName))
    msg.to.igv <- list(elementID = id, trackName=trackName,configJSON=configJSON)
    session$sendCustomMessage("loadTrack", msg.to.igv )
}

Here is the corresponding javascript message handler:

Shiny.addCustomMessageHandler("loadTrack",
   function(message){
       igvshiny_log("=== loadTrack");
       igvshiny_log(message);
       var elementID = message.elementID;
       var configJSON = message.configJSON
       var igvBrowser = document.getElementById(elementID).igvBrowser;
      igvBrowser.loadTrack(configJSON);
      }
);

I am in this way able to load my bigBed files with success as:

    loadTrack(session, id="igvShiny_0"
              ,trackName='meme.ame.all.shuffle'
              ,url='https://research.stowers.org/mec/A.distal.all.bb'
              ,type='annotation'
              ,displayMode="expanded"
              ,height=300
              ,visibilityWindow=1000000)

but only after disabling CORS security in my browser by running it as

chrome.exe --user-data-dir="C://Chrome dev session" --disable-web-security

since that webserver enforces CORS.

I rather like this approach and may use it across the board. You may like to consider adding it to igvShiny, possibly after renaming it, perhaps to loadIGVTrack or something.

So, again, no hurry on this issue.

However, if you can address #34 I would be much obliged.

Enjoy your travels.

@gladkia
Copy link
Owner

gladkia commented Jan 13, 2024

Hi @malcook,

What's the status of this issue? Is it still valid? Thanks for your help.

@malcook
Copy link
Author

malcook commented Jan 14, 2024

Hi -

The issue still holds, namely that "There appears to be some debugging/testing code left in Shiny.addCustomMessageHandler("fubar", which is responsible for rewriting the url to a hardcoded value"

Also, I have been using my proposed addition and still think this project should consider adopting it. What do you think?

@gladkia gladkia self-assigned this Mar 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

3 participants