chromosomix 0.15.0 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
  [![npm](https://img.shields.io/npm/v/chromosomix?logo=npm)](https://www.npmjs.com/package/chromosomix)
7
7
  [![Release](https://img.shields.io/github/v/release/js2264/chromosomix?logo=github)](https://github.com/js2264/chromosomix/releases)
8
8
  [![Validation](https://img.shields.io/badge/validation-vs%20reference%20tools-2ea44f)](https://chromosomix.app/validation/)
9
- [![License: MIT](https://img.shields.io/badge/license-MIT-blue)](LICENSE)
9
+ [![License: GPL-3.0-or-later](https://img.shields.io/badge/license-GPL--3.0--or--later-blue)](LICENSE)
10
10
 
11
11
  **A unified genome browser for multi-dimensional genomic data.** Chromatin contact maps, genome tracks and 3D models, side by side, straight from your files.
12
12
 
@@ -20,8 +20,8 @@ chromosomix launches in about a second and reads your data where it lives, on yo
20
20
 
21
21
  - Support for all genomic data types:
22
22
  - Supports 1D genomic formats: bigWig, bigBed, BED, bedGraph, wig, GTF/GFF3, FASTA (+`.fai`), `.2bit`, BAM, VCF, barChart/bigBarChart, genePred/refFlat/bigGenePred, bedMethyl/bigMethyl, chrom.sizes, ...
23
- - Supports 2D genomic formats: `.*cool`, `.hic`, HiC-Pro, `pairs(.gz)`, ..., at every resolution the file stores. Also supports interaction formats: BEDPE, and UCSC's `interact`/`bigInteract` and `longrange`/longTabix — drawn as arcs over the contact map and as their own lane in the 1D browser.
24
- - Supports 3D genomic formats: WashU's g3d (text or binary), `.3dg`, and `bed3d`, drawn in 3D and synchronized with the maps and tracks view.
23
+ - Supports 2D genomic formats: `.*cool`, `.hic`, HiC-Pro, `pairs(.gz)`, ..., at every resolution the file stores. A `.pairs` is binned on import, and the same pass counts what `pairtools stats` counts — mapped, duplicates, cis and trans, pair types, strand convergence, library size — shown in the General panel and saved as a `.stats` file MultiQC reads. Also supports interaction formats: BEDPE, and UCSC's `interact`/`bigInteract` and `longrange`/longTabix — drawn as arcs over the contact map and as their own lane in the 1D browser.
24
+ - Supports 3D genomic formats: WashU's g3d (text or binary), `.3dg`, and `bed3d`, drawn in 3D and synchronized with the maps and tracks view. Every model also leaves as a PDB for PyMOL, ChimeraX and the other molecular viewers, a chain per chromosome and bonds along the fibre, and reads back here.
25
25
 
26
26
  - Perform analyses directly in the browser:
27
27
  - 1D analysis tasks: peak calling from a coverage track (yapc, with IDR between replicates), motif search, base composition and GC skew, the origin and terminus of replication, metaplots, track correlation, FRiP over a feature set, signal by group, interval overlap with a shuffle null, ...
@@ -30,8 +30,6 @@ chromosomix launches in about a second and reads your data where it lives, on yo
30
30
 
31
31
  - Serverless browser & CLI-based: there is no upload, no required preprocessing step and no backend of any kind — the viewer is static files that read standard genome-wide formats directly. Every analysis can be run **interactively**, in the browser, or **programmatically**, with the `chromosomix` command line in a script or a pipeline: the same tasks, with the same parameters, producing the same results. A bottom Console panel in the browser records every run and reports the `chromosomix` command that repeats it.
32
32
 
33
- - Side by side: contact maps, 1D browsers and 3D models open as the cells of a deck, panned and zoomed together, and several sessions stay open at once, one tab each.
34
-
35
33
  - Dedicated browser panels, four around the picture:
36
34
  - General panel: the file itself — its attributes, its chromosomes (or a metagenome's genomes and contigs), a minimap of the genome and the metadata it stores.
37
35
  - Aesthetics panel: to customize scales, color map, normalization, track layout, grouping, ...
@@ -42,13 +40,17 @@ chromosomix launches in about a second and reads your data where it lives, on yo
42
40
  - Cloud-based file access: Open files directly from any object store that serves byte ranges with CORS (e.g. S3, Cloudflare R2, Google Cloud Storage, or any HTTP server that supports range requests), from Dropbox and Google Drive share links, and private Google Drive folder or Dropbox.
43
41
  - Stores: several pre-configured remote data stores are available — the lab's own figures, IGV's genomes, 4DN open data, ENCODE, DNA Zoo and Roadmap — and so is any UCSC track hub with a `hub.txt` file. The user can also setup their own store by providing a structured JSON file describing the store and its data.
44
42
 
43
+ - Side by side: contact maps, 1D browsers and 3D models open as the cells of a deck, panned and zoomed together, and several sessions stay open at once, one tab each.
44
+
45
45
  ## Philosophy
46
46
 
47
47
  1. **No backend or install of any kind.** No tile server, no specific process on a host, no accounts. The viewer is static files; the data are objects on a bucket, or a file on your disk. This is what makes the app free to run and free to archive.
48
48
 
49
- 1. **Nothing is uploaded.** A local file is handed to an air-gapped worker by reference and read in place through the Emscripten filesystem. Nothing crosses the network, which is why there is no account system, no storage, no hosting cost and nothing to review for GDPR. You can open unpublished patient-derived genomic data on a laptop with the network cable out.
49
+ 2. **Nothing is uploaded.** A local file is handed to an air-gapped worker by reference and read in place through the Emscripten filesystem. Nothing of it crosses the network, which is why there is no account system, no storage and no hosting cost. You can open unpublished patient-derived genomic data on a laptop with the network cable out.
50
+
51
+ The website does send anonymous telemetry about how it is used — which kinds of file are opened, which analyses run, which errors are met — as words from fixed lists, with no cookie and nothing that identifies you: never a file name, an address or a place on the genome. **About → telemetry** turns it off, and a browser sending Global Privacy Control sends nothing. The desktop app, the static HTML file, the npm package and embeds never send any ([SPECS §31](SPECS.md#31-telemetry)).
50
52
 
51
- 1. **No pre-parsing of genomic files is required.** Contact maps and 1D genomic files are read in bounded reads, and the rest is pure canvas transforms with **zero** further I/O. That is the central difference from HiGlass, which needs a tile server, a tile cache and a tile compositor to stream contact maps.
53
+ 3. **No pre-parsing of genomic files is required.** Contact maps and 1D genomic files are read in bounded reads, and the rest is pure canvas transforms with **zero** further I/O. That is the central difference from HiGlass, which needs a tile server, a tile cache and a tile compositor to stream contact maps.
52
54
 
53
55
  ## Using chromosomix
54
56
 
@@ -96,17 +98,57 @@ A minimal version of the viewer can be added to any HTML page as an `<iframe>`.
96
98
 
97
99
  Paste it into a page and it works (not rendered here though because GitHub does not allow `<iframe>`). The `src` URL is the same as the one you would use to open the viewer in a browser, with the addition of `?embed=1` to tell it to hide the header and tab strip.
98
100
 
99
- The text below is a live version of the above `<iframe>` (it will not work on GitHub, but it would work on any HTML page):
101
+ The page holding the frame can drive it too: `postMessage` moves the view, adds tracks beside the map, and is told where the reader has taken it (SPECS §21.4).
100
102
 
101
- <iframe
102
- src="https://chromosomix.app/?embed=1#uri=https://rsglab-data.s3.eu-west-3.amazonaws.com/demo/yeast/Yeast_microC_G2M_1kb.cool&view=region&region=IV:1000000-1400000&transform=log10&balance=true"
103
- width="100%"
104
- height="640"
105
- ></iframe>
103
+ ## In a Jupyter notebook
104
+
105
+ The same viewer is a Jupyter widget: the app itself in a cell, driven from Python and telling Python where the reader has taken it. It works in JupyterLab, Notebook 7, VS Code, Colab and marimo.
106
+
107
+ ```bash
108
+ pip install chromosomix # from a clone: pip install -e widgets/python
109
+ ```
110
+
111
+ ```python
112
+ from chromosomix import Chromosomix
113
+
114
+ view = Chromosomix(
115
+ 'sample.mcool::/resolutions/5000', # a path on the kernel's disk, or any address the app opens
116
+ region='chr2:10000000-14000000',
117
+ tracks=['ATAC.bw', 'genes.gtf.gz'],
118
+ transform='log10',
119
+ )
120
+ view # the map, its tracks, its side panels
121
+
122
+ view.goto('chr2:11000000-12000000') # frame a region (or a locus, in the 1D browser)
123
+ view.navigate(transform='log2', oe=True) # any key the address bar carries
124
+ view.add('model.g3d.gz') # the header's +: a track, a map, a 3D model beside the map
125
+ view.observe(lambda change: print(change['new']['region']), names='state')
126
+ ```
127
+
128
+ Files on the kernel's disk are served to the viewer by byte range from a server on `127.0.0.1`, with their sidecars beside them; nothing is uploaded. [`widgets/python/demo.ipynb`](widgets/python/demo.ipynb) walks through it on the yeast demo, and [`widgets/python/README.md`](widgets/python/README.md) says which viewer build the frame holds and how to pin one.
129
+
130
+ ## In R: R Markdown, Quarto, RStudio and Shiny
131
+
132
+ The same viewer is an htmlwidget, in the R package under [`widgets/r`](widgets/r/README.md):
133
+
134
+ ```r
135
+ install.packages("widgets/r", repos = NULL, type = "source") # from a clone
136
+
137
+ library(chromosomix)
138
+ chromosomix("sample.mcool::/resolutions/5000", region = "chr2:10000000-14000000",
139
+ tracks = c("ATAC.bw", "genes.gtf.gz"), transform = "log10") |>
140
+ chromosomix_goto("chr2:11000000-12000000") |>
141
+ chromosomix_navigate(oe = TRUE) |>
142
+ chromosomix_add("model.g3d.gz")
143
+ ```
144
+
145
+ In Shiny, `chromosomixOutput()`, `renderChromosomix()` and `chromosomixProxy()` drive a view on screen,
146
+ and `input$<id>_state` follows the reader. `system.file("examples", package = "chromosomix")` holds an
147
+ R Markdown page of the yeast demo and a Shiny app driving it.
106
148
 
107
149
  ## Using the chromosomix analysis CLI
108
150
 
109
- Thirty-one analysis tasks can be executed programatically through the CLI, with the same parameters and producing the same results as the Analysis panel interactively. This can be used in a pipeline or a script.
151
+ Over thirty analysis tasks can be executed programatically through the CLI, with the same parameters and producing the same results as the Analysis panel interactively. This can be used in a pipeline or a script.
110
152
 
111
153
  ### Installing the CLI
112
154
 
@@ -165,6 +207,14 @@ chromosomix tasks
165
207
  ## --matrix (default true) draw the square
166
208
  ## --no-balance read the raw counts (balanced by default where the file carries weights)
167
209
  ##
210
+ ## cellqc
211
+ ## Per-cell contact QC
212
+ ## --cells (default "all") cells
213
+ ## --nearFrom (default 23000) near band, from
214
+ ## --nearTo (default 2000000) near band, to
215
+ ## --mitoticTo (default 12000000) mitotic band, to
216
+ ## --no-balance read the raw counts (balanced by default where the file carries weights)
217
+ ##
168
218
  ## expected
169
219
  ## Contact probability P(s)
170
220
  ## --scope (default "contig") scope
@@ -173,10 +223,15 @@ chromosomix tasks
173
223
  ## --factor (default 1.1) log bins per step
174
224
  ## --minSeparation (default 2) minimum separation
175
225
  ## --derivative (default true) log-log slope
176
- ## --stranded (default false) four orientations
177
- ## --pairsUri .pairs file
178
226
  ## --no-balance read the raw counts (balanced by default where the file carries weights)
179
227
  ##
228
+ ## pairsqc
229
+ ## Pairs QC
230
+ ## --pairs .pairs file
231
+ ## --reference reference
232
+ ## --enzyme (default "none") enzyme
233
+ ## --sites (default "") sites
234
+ ##
180
235
  ## scalogram
181
236
  ## Scalogram
182
237
  ## --quantiles (default "standard") quantiles
@@ -251,6 +306,18 @@ chromosomix tasks
251
306
  ## --armWindow (default 50) window along the arms
252
307
  ## --no-balance read the raw counts (balanced by default where the file carries weights)
253
308
  ##
309
+ ## loops
310
+ ## Loop calling
311
+ ## --sequences sequences
312
+ ## --outer (default 5) outer half-width
313
+ ## --inner (default 2) inner half-width
314
+ ## --maxSeparation (default 1000) furthest from the diagonal
315
+ ## --fdr (default 0.1) false discovery rate
316
+ ## --lambdaBins (default 40) λ-chunks
317
+ ## --clusteringRadius (default 2) clustering radius
318
+ ## --filter (default true) enrichment filter
319
+ ## --no-balance read the raw counts (balanced by default where the file carries weights)
320
+ ##
254
321
  ## chromosight
255
322
  ## Pattern detection
256
323
  ## --pattern (default "loops") pattern
@@ -267,6 +334,14 @@ chromosomix tasks
267
334
  ## --maxQvalue (default 1) report down to a q-value of
268
335
  ## --no-balance read the raw counts (balanced by default where the file carries weights)
269
336
  ##
337
+ ## hicrep
338
+ ## Reproducibility
339
+ ## --against <file> The other maps to compare with; repeat per map
340
+ ## --sequences sequences
341
+ ## --maxDistance (default 500) furthest separation compared
342
+ ## --smooth (default 1) smoothing half-width
343
+ ## --no-balance read the raw counts (balanced by default where the file carries weights)
344
+ ##
270
345
  ## apa
271
346
  ## Aggregate peak analysis
272
347
  ## --anchors (default "pairs") anchors
@@ -304,6 +379,7 @@ chromosomix tasks
304
379
  ## --region sequences
305
380
  ## --alpha (default 3) exponent α
306
381
  ## --weights (default "contacts") weight pairs by
382
+ ## --seed (default 0) seed
307
383
  ## --iterations (default 150) refinement steps
308
384
  ## --no-balance read the raw counts (balanced by default where the file carries weights)
309
385
  ##
@@ -329,6 +405,13 @@ chromosomix tasks
329
405
  ## --mismatches (default 0) mismatches
330
406
  ## --limit (default 500000) most sites
331
407
  ##
408
+ ## restriction
409
+ ## Restriction sites
410
+ ## --sequence reference
411
+ ## --sequences sequences
412
+ ## --enzyme (default "none") enzyme
413
+ ## --sites (default "") sites
414
+ ##
332
415
  ## peaks
333
416
  ## Peak calling
334
417
  ## --signal track
@@ -457,8 +540,16 @@ chromosomix tasks
457
540
 
458
541
  Each analysis is held to the package it reproduces — cooltools, coolpuppy, chromosight, deepTools,
459
542
  bedtools and a dozen others — on public data, command for command, in a notebook rendered with every
460
- release: <https://chromosomix.app/validation/>, and how long each command takes beside its
461
- reference, <https://chromosomix.app/timings/>.
543
+ release: <https://chromosomix.app/validation/>, with every number its figures draw in one table beside
544
+ it, <https://chromosomix.app/validation/validation.txt>; and how long each command takes beside its
545
+ reference, <https://chromosomix.app/timings/>. A third notebook holds the app to this command: ten
546
+ tasks run in the app, in a headless browser, then from the line its console wrote for each, and every
547
+ file the two wrote compared, <https://chromosomix.app/parity/>. And what the commands cost on a machine
548
+ like yours — the time and the peak memory of 23 analyses run genome-wide, up to a 1.08-billion-contact
549
+ human map — is <https://chromosomix.app/laptop/>, rendered on a laptop and committed as
550
+ `notebooks/laptop.html`; render `notebooks/laptop.qmd` with Quarto from a clone to measure your own: it
551
+ downloads the data, runs each analysis once and tabulates them. The app lists all four in
552
+ **About → Notebooks**, each with the one line of what it found.
462
553
 
463
554
  Every task writes its results where `--out` points, each named after the file it came from up to
464
555
  its first dot — `sample.coverage.coverage-total.tsv`. Two files of one command that would share a
@@ -471,11 +562,14 @@ value after it: `--stranded` turns it on, `--stranded=false` or `--no-stranded`
471
562
  is none of its values is refused before any file is opened, with exit 2 and the values there are,
472
563
  and so is a number that is not one.
473
564
 
474
- Files are read from disk. A file named by an http or https address — the map, or what `--against`,
475
- `--sequence`, `--tracks`, `--features` or `--pairs` names — is downloaded first, whole, because the
476
- reader's range requests are synchronous, which a browser worker has and Node does not: it goes into
477
- `$TMPDIR`, with its progress on stderr, and is removed when the command ends. For several commands
478
- over one large remote file, download it once yourself and name the copy.
565
+ Files are read from disk or from where they are published. A map named by an http or https address —
566
+ a cooler, an `.mcool` rung, a `.hic`, an `.scool` or a `.pairs`, as the positional or after
567
+ `--against` — and a bigWig, a `.2bit` or an indexed FASTA after `--tracks` or `--sequence` is read
568
+ **by range**, as the app reads it: one rung of a seven-gigabyte `.mcool` costs that rung, and nothing
569
+ is written to disk; a bedGraph or a wig after `--tracks` is read in one request. What is read whole
570
+ from a copy — a `--features` or `--pairs` set, a HiC-Pro matrix, a workspace — and any file whose host
571
+ will not serve a range is downloaded into `$TMPDIR` instead, with its progress on stderr, and removed
572
+ when the command ends.
479
573
 
480
574
  ```bash
481
575
  chromosomix insulation *.mcool --sequences II --out results/
@@ -500,6 +594,13 @@ chromosomix apa sample.cool --features domains.bed --anchors features \
500
594
  chromosomix motif sample.cool --sequence ref.fa.gz --pattern GGTCANNNTGACC --mismatches 1 --out results/
501
595
  chromosomix overlap sample.cool --features peaks.bed --features boundaries.bed --a peaks.bed --b boundaries.bed
502
596
 
597
+ # A library's quality from its contact list: the pairtools counts as figures,
598
+ # the four orientations' P(s), and — with a reference and an enzyme — pair
599
+ # classes, distance to the cut, fragments seen and coverage against sites.
600
+ # Restriction sites alone digests the reference into a lane of cuts.
601
+ chromosomix pairsqc sample.pairs.gz --bin-size 10000 --sequence ref.fa.gz --enzyme DpnII --out qc/
602
+ chromosomix restriction sample.cool --sequence ref.fa.gz --enzyme Arima --out results/
603
+
503
604
  # The tasks that read tracks take them as --tracks: a bigWig, a bedGraph, a
504
605
  # wig, or a FASTA read as GC content. Repeat the flag or separate with commas.
505
606
  chromosomix metaplot sample.cool --tracks ATAC.bw --features peaks.narrowPeak --flank 2000 --out results/
@@ -534,7 +635,8 @@ chromosomix circular ecoli.mcool::/resolutions/5000
534
635
  chromosomix interarm ecoli.mcool::/resolutions/5000 --circular NC_000913.3 \
535
636
  --origin NC_000913.3:3925744 --out results/
536
637
 
537
- # A 3D model built from the map, written as a bed3d the viewer opens beside it.
638
+ # A 3D model built from the map, written as a bed3d the viewer opens beside it,
639
+ # and as a PDB for PyMOL.
538
640
  chromosomix reconstruct3d ecoli.mcool::/resolutions/20000 --out results/
539
641
 
540
642
  # What the session set from the picture, as flags: the score column a
@@ -548,6 +650,10 @@ chromosomix insulation sample.metacool --value balanced_by_depth --circular pCEN
548
650
  chromosomix coverage Hum53.pairs.gz --bin-size 5000 --rungs 4
549
651
 
550
652
  chromosomix replay workspace.chromosomix.json --over data/*.hic
653
+
654
+ # What `pairtools stats` writes for a contact list, counted by the pass the
655
+ # app's import makes, in pairtools' own format — for MultiQC.
656
+ chromosomix stats sample.pairs.gz --out qc/
551
657
  ```
552
658
 
553
659
  ### Recovering the commands you ran
@@ -558,15 +664,25 @@ The log is kept in your own browser for seven days or five hundred lines, whiche
558
664
 
559
665
  ## Licence
560
666
 
561
- chromosomix is released under the MIT licence (`LICENSE`).
667
+ Copyright © 2026 Jacques Serizay.
668
+
669
+ chromosomix is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. It is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License, in [`LICENSE`](LICENSE), for more details.
670
+
671
+ It is under the GPL because its peak calling is ported from yapc (GPL-3.0) and the IDR test it runs across replicates from IDR (GPL-2.0 or later), and a translation of GPL code can only be distributed under the GPL.
672
+
673
+ Every build also carries the work of other projects, each under its own licence, and the app names them in **About → Licences**:
674
+
675
+ - **Libraries compiled into the bundles:** three.js (MIT); echarts (Apache-2.0) with zrender (BSD-3-Clause) and tslib (0BSD); h5wasm (NIST's notice, with the BSD-style licence of the HDF5 library inside it); and `@gmod/bbi` with its dependencies `generic-filehandle2`, `@gmod/abortable-promise-cache` and `@jbrowse/quick-lru` (all MIT).
676
+ - **Code ported from reference implementations**, where an analysis follows its reference function for function so that it gives the same numbers: yapc (GPL-3.0) and IDR (GPL-2.0 or later) for peak calling; cooltools (MIT) for loop calling and insulation's peak prominence; cooler (BSD-3-Clause) for region strings; chromosight (MIT) for pattern detection; SciPy (BSD-3-Clause) with the cephes functions its `xsf` carries for the Poisson tail and `fminbound`; NumPy (BSD-3-Clause, and NCSA or BSD-3-Clause for `numpy.random`) for its pairwise sums and its binomial and hypergeometric samplers; scikit-learn (BSD-3-Clause) for BIRCH; Boost-HiC (MIT); and fdlibm (Sun Microsystems' notice) for the error function.
677
+ - **Material copied into the source by a generator:** Lucide (ISC), Simple Icons (CC0), chromosight's kernels (MIT), matplotlib's colour tables (the Matplotlib licence) and ColorBrewer's schemes (Apache-2.0).
562
678
 
563
- Every build also carries the work of other projects, each under its own licence. The libraries compiled into the bundles are echarts (Apache-2.0), zrender (BSD-3-Clause), three.js (MIT), h5wasm (NIST's notice, with the BSD-style licence of the HDF5 library inside it), and `@gmod/bbi` with its dependencies (MIT). The source also holds material copied from Lucide (ISC), Simple Icons (CC0), chromosight (MIT), matplotlib (the Matplotlib licence) and ColorBrewer (Apache-2.0). Each build lists what it carries and reproduces every one of those licences in full in `THIRD-PARTY-NOTICES.txt`, beside its `index.html`:
679
+ All of them are compatible with version 3 of the GPL. Each build lists what it carries and reproduces every one of those licences in full, after chromosomix's own, in `THIRD-PARTY-NOTICES.txt`, beside its `index.html`:
564
680
 
565
681
  - the web app: <https://chromosomix.app/THIRD-PARTY-NOTICES.txt>;
566
682
  - the npm package: `dist/` for the viewer, `dist-cli/` for the command;
567
- - the desktop app: inside the application;
683
+ - the desktop app: inside the application, beside the licences of Electron and Chromium that every installer ships;
568
684
  - the standalone HTML page: in a comment at the end of the file.
569
685
 
570
- The upstream texts that are not in an npm package are kept under [`licenses/`](licenses/).
686
+ The upstream texts that are not in an npm package are kept under [`licenses/`](licenses/), and so is the MIT licence `generic-filehandle2` declares but does not ship.
571
687
 
572
688
  **Trademarks.** The logos on the data store tiles (IGV, 4DN, ENCODE, DNA Zoo, UCSC and Roadmap Epigenomics) are those projects' own published marks, and the GitHub, Google Drive and Dropbox marks in the interface are their owners' trademarks. Each is shown only to name the store or service it stands for. None of them is covered by chromosomix's licence or by the notices above, and their use implies no endorsement of chromosomix by their owners.