Git Product home page Git Product logo

jbrowse-jupyter's People

Contributors

carolinebridge avatar cmdcolin avatar garrettjstevens avatar scottcain avatar teresam856 avatar vdejager avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jbrowse-jupyter's Issues

Firefox/Mozilla bug with Google Colab

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.
image

Add documentation

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:

  • Sphinx for generating docs, especially from any docstrings
  • Hosting could be readthedocs or Github Pages maybe
  • Obviously some tutorials too
    • For high level, like the embedded
    • Python API

Migrating from former issue found teresam856/jbrowse-jupyter#3

Move pytest to tests_require in setup.py

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.

Local file support

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:

  • Check data, if it's not a URL, start Flask (silently under the hood)
  • Use Flask to serve the data as a local URL

Some mechanics:

GMOD/dash_jbrowse#5

JBrowseConfig class system and additional utility functions

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).

More Architecture:

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 View
  • add_track: adds a track to the configuration
  • add_text_search_adapter: adds a text search adapter to read from a JBrowse Trix index
  • set_location: sets the initial location at which the Linear Genome View should render
  • set_defaultSession: current app state such as what tracks are open is stored in a session
  • set_theme: customize various aspects by providing a theme

Additional helper functions provided by jbrowse-jupyter package.

  • launch: launches JupyterDash application with a Dash JBrowse Linear Genome View component given a JBrowseConfig.
    This method makes it easy to embed a Dash JBrowse Linear Genome View component in a cell in any Jupyter notebook.
  • create_component: Dash JBrowse Linear Genome View component that can be displayed in any Dash Python Application
  • create: 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:

  1. Created here: GMOD/dash_jbrowse#4
    • Decided to move JBrowseConfig API to jbrowse-jupyter based on this discussion thread
  2. Taken care of here: teresam856/jbrowse-jupyter#4

Programmatic control of the instance after launch

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"

Support callback functions

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.

GMOD/dash_jbrowse#7

Colab example, reason for using github for pip install?

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

CHM13 genome configuration

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

Architecture, builds and publishing setup

  • Create linting step in github actions workflow. Uses flake8.
  • Creates setup.py

test build on test pypi https://test.pypi.org/project/jbrowse-jupyter/0.0.2/
demo https://media.giphy.com/media/mwHyhBpeRqGgG9kSF5/giphy.gif

Architecture discussion

  • dash_jbrowse: dash component that is a wrapper to the React Linear Genome View
  • jbrowse_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 packages
    (Note: dash_jbrowse is a dependency of the jbrowse_jupyter package)

Some benefits of moving the API to another repo and making this dash component as a dependency to the jupyter jbrowse package include:
pros

  • dash_jbrowse can be reused in other libraries
  • reduces the size of dash_jbrowse for those who are not interested in the jupyter functionality
  • easier to make updates to either package
  • jbrowse jupyter users will only need to download one package to get all the functionality to create jbrowse components and launch them into jupyter cells
  • dash_jbrowse was also created from the cookie cutter repo, so trying to differentiate the python jupyter package with the React dash_jbrowse package can be a little confusing for contributors and maintainers.

cons

  • more packages/repos to maintain

Migrating information from previous repository:

Binder support

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?

make the uri scheme a setting

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

Integration with other bioinformatics libraries

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.

GMOD/dash_jbrowse#6

Add ability to use JBrowse 2 config file

We can currently create a config in two ways

  1. create('view', genome='hg38')
  2. create("config") or create("config", conf={bulk config})

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.