gmod / jbrowse-jupyter Goto Github PK
View Code? Open in Web Editor NEWA python package for showing JBrowse views
License: Apache License 2.0
A python package for showing JBrowse views
License: Apache License 2.0
see plotly/dash#1992
I ran into the same issue when installing jupyter-jbrowse.
Its more a dash issue, but just wanted to report here that downgrading to 2.0.3 works
Some examples here https://github.com/scottcain/jbrowse-jupyter-examples from @scottcain
I am not sure it's possible to use the bigwig files at google colab's local directory. RangeRequest feature probably needed to make it work.
I did the following to enable the rangeRequest features as per my understanding of the documentation.
# install and import
!pip install jbrowse-jupyter
from jbrowse_jupyter import launch, create, serve
then created a python script (server.py) to run the server on background
import os
from jbrowse_jupyter import launch, create, serve
def server_run(port=8080):
# Enter a host
HOST = "localhost"
DIRECTORY = os.getcwd()
# Enter the path to your local data
serve(DIRECTORY, port=port, host=HOST)
if __name__ == '__main__':
port = 8082
server_run(port)
than ran using the followings
import subprocess
subprocess.Popen(["python3", "server.py"])
The above code allows one to get a small content from file. I tested it using the following code and it works.
import requests
url="http://127.0.0.1:8082/sample_data/anscombe.json"
headers = {"Range": "bytes=5-10"}
r = requests.get(url, headers=headers)
print(r.text)
But when I am trying to load a bigwig file, it's giving an error.
Before releasing, we need to set up some docs for how to use package and any Python API we write.
Add documentation about using Python Jb Configuration API
Add documentation about contributing, developing, and publishing
Add documentation about how to use
Add examples
Add demos
Resources:
Migrating from former issue found teresam856/jbrowse-jupyter#3
Looking at setup.py
, it looks like it uses requirements.txt
for its install_requires
. However, requirements.txt
includes pytest
, which is needed to run the tests, but isn't a dependency for the package to install. Looking at the guide here, it seems like pytest
should be in tests_require
instead of install_requires
.
It would be awesome to have a way to support a user passing local files to use in the browser.
Example API: config.set_assembly(data="path/to/my/cool.fa")
Possible implementation:
Some mechanics:
Create JBrowseConfig class system.
The purpose of the JBrowseConfig API is to provide and facilitate the creation of configuration state objects for JBrowse embeddable components (currently only supporting the React Linear Genome View).
API provided by jbrowse-jupyter
package to create configuration object for JBrowse Linear Genome View
JBrowseConfig()
set_assembly
: sets the assembly to view in the Linear Genome Viewadd_track
: adds a track to the configurationadd_text_search_adapter
: adds a text search adapter to read from a JBrowse Trix indexset_location
: sets the initial location at which the Linear Genome View should renderset_defaultSession
: current app state such as what tracks are open is stored in a sessionset_theme
: customize various aspects by providing a themeAdditional helper functions provided by jbrowse-jupyter
package.
launch
: launches JupyterDash application with a Dash JBrowse Linear Genome View component given a JBrowseConfig.create_component
: Dash JBrowse Linear Genome View component that can be displayed in any Dash Python Applicationcreate
: creates a JBrowseConfiguration either from a provided genome template (hg19 or hg38) or from a configuration object created by the user.History of this issue:
Request from @ihh
"Is there any way we can control a jbrowse instance remotely after launching it [from Jupyter] - for example by having it listen on a websocket, or do long polls, then eval the responses (this seems like a huge hack but also arguably quick and powerful?)
Just seems annoying
to relaunch the browser every time I want to navigate to a location specified by Python"
There is a general API for alerting Python Dash callbacks that are listening for changes. It involved calling it like this:
onChange={
/*
* Send the new value to the parent component.
* setProps is a prop that is automatically supplied
* by dash's front-end ("dash-renderer").
* In a Dash app, this will update the component's
* props and send the data back to the Python Dash
* app server if a callback uses the modified prop as
* Input or State.
*/
e => setProps({ value: e.target.value })
}
Note: I'm not sure how useful this is, and it probably would only apply to people using it in a Dash app, not a notebook.
I managed to get the colab example running, but it was unclear what purpose is using
!pip install git+https://github.com/GMOD/jbrowse-jupyter.git@main
Can jbrowse-jupyter get re-published to pip and remove this need to modify the colab notebook explicitly
Is there any config setting for CHM13-V2.0 ? I did the following to load the CHM13 genome.
chm13 = create('LGV')
chm13.set_assembly("https://s3-us-west-2.amazonaws.com/human-pangenomics/T2T/CHM13/assemblies/analysis_set/chm13v2.0.fa.gz", aliases=["chm13"])
chm13.set_location("10:100..350")
chm13.set_default_session(['df_track_id'], False)
new_conf = chm13.get_config()
launch(new_conf, port=3013)
but the loading is slow.
Thanks
Arijit
The anywidget platform is created by member of gosling @manzt https://blog.jupyter.org/anywidget-jupyter-widgets-made-easy-164eb2eae102
Would be interesting if jbrowse-jupyter could use...I think I mentioned it to @garrettjstevens and it could even bypass some of the limitations of the dash widget system regarding the iframe maybe...
This would enable e.g. possibly synteny visualization, etc.
test build on test pypi https://test.pypi.org/project/jbrowse-jupyter/0.0.2/
demo https://media.giphy.com/media/mwHyhBpeRqGgG9kSF5/giphy.gif
dash_jbrowse
: dash component that is a wrapper to the React Linear Genome Viewjbrowse_jupyter
: python package that includes API for creating configurations, launching dash components in jupyter cells, indexing in the background(wishlist), local file support, integration with other bioinformatics packagesSome benefits of moving the API to another repo and making this dash component as a dependency to the jupyter jbrowse package include:
pros
cons
Migrating information from previous repository:
Run all ends up failing with
FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.10/dist-packages/Flask-2.2.5.dist-info/METADATA'
screenshot
Binder link generated from the main branch for the browser.ipynb is causing 504 due to errors with jupyterlab builds.
Have removed the link from the read me to avoid having broken links in the docs.
https://mybinder.org/v2/gh/GMOD/jbrowse-jupyter/main?labpath=browser.ipynb
Potential fixes:
Add a postbuild in this repo to add the extension: jupyter-widgets/ipywidgets#2701
https://github.com/binder-examples/requirements
Is it possible (and not too much effort) to adapt this repo so it runs out-of-the-box with Binder? Or is that not feasible/recommended due to technical or other limitations?
See question title. I am curious if this package or dash_jbrowse need to be have a new release to get updated versions of @jbrowse/react-linear-genome-view
Is your feature request related to a problem? Please describe. A clear and
concise description of what the problem is. Ex. I'm always frustrated when [...]
when creating a jbrowse config using paths and the notebook_host setting set to the jupyterhub host, 'http' is added in front of the hostname (hardcoded). i've changed this to a setting in the pull request below
#76
It would be awesome to be able to not only accept local files, but except Python data objects, for example stuff from biopython, i.e. a parsed GFF, or one of the Sequence()
objects.
One way to do this could be to simply save this to a temp local file and also host it to the browser using Flask.
So then, in a Jupyter cell:
# biopython code
import pprint
from BCBio.GFF import GFFExaminer
in_file = "your_file.gff"
examiner = GFFExaminer()
in_handle = open(in_file)
pprint.pprint(examiner.available_limits(in_handle))
# adding it from a variable in memory to our browser
config.add_track(examiner)
Some precedent is the data frame track in JBrowseR, where you pass a variable directly to the browser. But this would be more performant if it didn't rely on the FromConfigAdapter.
We can currently create a config in two ways
We want to be able to create a view from a path to a jb2 config
3) create("jb2config", path="path/to/jb2/config.json")
We would need to complete the converter/parser which would read and format a jb2 config file into the appropriate config to pass to jbrowse react linear genome view.
Add the circular genome view dash component to the package. The dash jbrowse circular genome view was added to to dash jbrowse in the latest release found here:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.