dasmoth / dalliance

Interactive web-based genome browser.
http://www.biodalliance.org/
BSD 2-Clause "Simplified" License
226 stars 68 forks source link

Default search on load #249

Closed kevinyao93 closed 5 years ago

kevinyao93 commented 5 years ago

I've been working with dalliance now for a bit and it's been working well for me, I have however been trying to have a specific gene search loaded in when I create the browser. However right now the only way I've found is a specific chr, start pos, end pos. Is there a way to use a gene name instead? Something either similar to setLocation, or a property in the browser creation that can set the a specific search instead.

Thanks!

dasmoth commented 5 years ago

In principle, you can call search(searchString) on the browser object (which is essentially what the search field in the default UI is doing). However, this doesn't quite do what you want because searches will fail if the relevant data sources haven't finished initializing yet.

What will work is:

    const browser = new Browser({
        // Usual options

        onFirstRender: () => {
            browser.search('Prdm1'); // or whatever you're looking for
       }
   });

Does this help?

kevinyao93 commented 5 years ago

Thank you so much! This fixes the issue.