{"id":22738030,"url":"https://github.com/dvdkouril/chromospyce","last_synced_at":"2025-07-09T01:14:47.483Z","repository":{"id":267157877,"uuid":"767811076","full_name":"dvdkouril/chromospyce","owner":"dvdkouril","description":"chromospace but as a notebook widget","archived":false,"fork":false,"pushed_at":"2024-12-18T20:06:30.000Z","size":2067,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-01T02:04:56.180Z","etag":null,"topics":["hidivelab"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dvdkouril.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-05T23:52:42.000Z","updated_at":"2025-06-24T15:13:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"f7f5700d-e355-497d-80d6-d37c0951f899","html_url":"https://github.com/dvdkouril/chromospyce","commit_stats":null,"previous_names":["dvdkouril/chromospyce"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dvdkouril/chromospyce","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvdkouril%2Fchromospyce","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvdkouril%2Fchromospyce/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvdkouril%2Fchromospyce/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvdkouril%2Fchromospyce/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dvdkouril","download_url":"https://codeload.github.com/dvdkouril/chromospyce/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvdkouril%2Fchromospyce/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264373812,"owners_count":23598083,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hidivelab"],"created_at":"2024-12-10T22:19:52.827Z","updated_at":"2025-07-09T01:14:47.445Z","avatar_url":"https://github.com/dvdkouril.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# chromospyce\n\nThis is an [anywidget](https://github.com/manzt/anywidget)-powered version of\nthe [chromospace](https://github.com/dvdkouril/chromospace) library intended\nfor use in computational notebooks, such as Jupyter Notebook.\n\n![colorful squiggly thick line depicting 3D chromatin running in jupyter notebook](./spyce-teaser.gif)\n\n## Basic usage\nThe available functionality is pretty limited at this moment. We will stabilize the API as we go. At this point, you can display 3D chromatin models.\n\n```python\nimport chromospyce\nimport numpy as np\n\nBINS_NUM = 1000\n\n# Step 1: Generate random structure, returns a 2D numpy array:\ndef make_random_3D_chromatin_structure(n):\n    position = np.array([0.0, 0.0, 0.0])\n    positions = [position.copy()]\n    for _ in range(n):\n        step = np.random.choice([-1.0, 0.0, 1.0], size=3)  # Randomly choose to move left, right, up, down, forward, or backward\n        position += step\n        positions.append(position.copy())\n    return np.array(positions)\n\nrandom_structure = make_random_3D_chromatin_structure(BINS_NUM)\n\n# Step 2: Display the structure in a chromospyce widget\nnumbers = list(range(0, BINS_NUM+1))\nvc = {\n    \"color\": {\n        \"values\": numbers,\n        \"min\": 0,\n        \"max\": BINS_NUM,\n        \"colorScale\": \"Spectral\"\n    }, \n    \"scale\": 0.01, \n    \"links\": True, \n    \"mark\": \"sphere\"\n}\nchromospyce.Widget(random_structure, vc)\n```\n\nThe underlying JS library, **chromospace**, [only supports data in the Apache\nArrow\nformat](https://github.com/dvdkouril/chromospace/tree/main/docs#data-loading).\n\nIn **chromospyce**, on the other hand, you can also visualize structures\ndefined as 2D numpy arrays, or pandas dataframe (with columns named `'x'`,\n`'y'`, `'z'`.\n\nQuickly test out **chromospyce** with [uv](https://docs.astral.sh/uv/):\n1. `uv run --with chromospyce --with numpy --with pyarrow --with jupyterlab\n   jupyter lab`\n2. make a new notebook\n3. copy and paste the code above into an empty cell\n\nOr: [run the example in Google\nColab](https://colab.research.google.com/drive/1EZh9HcGS3cgPF4C6eFyMm5iHGVGS4Cj_?usp=sharing).\n\n## Contributing\nRunning tests:\n`uv run pytest`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdvdkouril%2Fchromospyce","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdvdkouril%2Fchromospyce","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdvdkouril%2Fchromospyce/lists"}