Skip to content

Commit 6f37754

Browse files
authored
chore: Pin minimum Python version; Upgrade Ruff (#174)
* Add `requires-python` to `pyproject.toml` * Cleanup hatchling build config * Update ruff version * Apply Ruff formatting
1 parent 4ac50f1 commit 6f37754

File tree

7 files changed

+1782
-507
lines changed

7 files changed

+1782
-507
lines changed

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.13

examples/Examples.ipynb

Lines changed: 25 additions & 169 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
{
44
"cell_type": "code",
55
"execution_count": null,
6+
"id": "cfdd679e",
67
"metadata": {},
78
"outputs": [],
89
"source": [
@@ -13,6 +14,7 @@
1314
{
1415
"cell_type": "code",
1516
"execution_count": null,
17+
"id": "37383869",
1618
"metadata": {},
1719
"outputs": [],
1820
"source": [
@@ -21,6 +23,7 @@
2123
},
2224
{
2325
"cell_type": "markdown",
26+
"id": "f5a73851",
2427
"metadata": {},
2528
"source": [
2629
"## Synced heatmaps"
@@ -29,6 +32,7 @@
2932
{
3033
"cell_type": "code",
3134
"execution_count": null,
35+
"id": "ba0c9d3e",
3236
"metadata": {},
3337
"outputs": [],
3438
"source": [
@@ -65,6 +69,7 @@
6569
{
6670
"cell_type": "code",
6771
"execution_count": null,
72+
"id": "4b6c2629",
6873
"metadata": {},
6974
"outputs": [],
7075
"source": [
@@ -75,6 +80,7 @@
7580
{
7681
"cell_type": "code",
7782
"execution_count": null,
83+
"id": "1453f49f",
7884
"metadata": {},
7985
"outputs": [],
8086
"source": [
@@ -85,6 +91,7 @@
8591
{
8692
"cell_type": "code",
8793
"execution_count": null,
94+
"id": "4432d5d1",
8895
"metadata": {},
8996
"outputs": [],
9097
"source": [
@@ -103,6 +110,7 @@
103110
},
104111
{
105112
"cell_type": "markdown",
113+
"id": "637bcad2",
106114
"metadata": {},
107115
"source": [
108116
"## Value scale syncing"
@@ -111,6 +119,7 @@
111119
{
112120
"cell_type": "code",
113121
"execution_count": null,
122+
"id": "e89a03d7",
114123
"metadata": {},
115124
"outputs": [],
116125
"source": [
@@ -122,7 +131,7 @@
122131
"# Creates a hg.RemoteTileset object\n",
123132
"remote_tileset = hg.remote(\n",
124133
" uid=\"CQMd6V_cRw6iCI_-Unl3PQ\",\n",
125-
" server=\"https://higlass.io/api/v1/\", # optional, \"http://higlass.io/api/v1/\" default\n",
134+
" server=\"https://higlass.io/api/v1/\", # optional, \"http://higlass.io/api/v1/\"\n",
126135
" name=\"Rao et al. (2014) GM12878 MboI (allreps) 1kb\",\n",
127136
")\n",
128137
"\n",
@@ -152,6 +161,7 @@
152161
},
153162
{
154163
"cell_type": "markdown",
164+
"id": "ef880b6c",
155165
"metadata": {},
156166
"source": [
157167
"## Remote heatmaps"
@@ -160,6 +170,7 @@
160170
{
161171
"cell_type": "code",
162172
"execution_count": null,
173+
"id": "4579c459",
163174
"metadata": {},
164175
"outputs": [],
165176
"source": [
@@ -196,6 +207,7 @@
196207
},
197208
{
198209
"cell_type": "markdown",
210+
"id": "74b22d9c",
199211
"metadata": {},
200212
"source": [
201213
"## Extract track from another view config"
@@ -204,6 +216,7 @@
204216
{
205217
"cell_type": "code",
206218
"execution_count": null,
219+
"id": "875260a4",
207220
"metadata": {},
208221
"outputs": [],
209222
"source": [
@@ -218,6 +231,7 @@
218231
{
219232
"cell_type": "code",
220233
"execution_count": null,
234+
"id": "f22d06ae",
221235
"metadata": {},
222236
"outputs": [],
223237
"source": [
@@ -230,6 +244,7 @@
230244
{
231245
"cell_type": "code",
232246
"execution_count": null,
247+
"id": "73c925a5",
233248
"metadata": {},
234249
"outputs": [],
235250
"source": [
@@ -242,6 +257,7 @@
242257
},
243258
{
244259
"cell_type": "markdown",
260+
"id": "0a9ad2fc",
245261
"metadata": {},
246262
"source": [
247263
"## Remote bigWig tiles\n",
@@ -251,6 +267,7 @@
251267
{
252268
"cell_type": "code",
253269
"execution_count": null,
270+
"id": "3d664bb6",
254271
"metadata": {},
255272
"outputs": [],
256273
"source": [
@@ -260,6 +277,7 @@
260277
{
261278
"cell_type": "code",
262279
"execution_count": null,
280+
"id": "0e22f81d",
263281
"metadata": {},
264282
"outputs": [],
265283
"source": [
@@ -278,15 +296,16 @@
278296
{
279297
"cell_type": "code",
280298
"execution_count": null,
299+
"id": "4133c1c3",
281300
"metadata": {},
282301
"outputs": [],
283302
"source": [
284303
"import hg\n",
285304
"\n",
286305
"# get mounted path\n",
287306
"bwpath = hg.fuse.path(\n",
288-
" f\"http://hgdownload.cse.ucsc.edu/goldenpath/hg19/encodeDCC/\"\n",
289-
" f\"wgEncodeSydhTfbs/wgEncodeSydhTfbsGm12878InputStdSig.bigWig\"\n",
307+
" \"http://hgdownload.cse.ucsc.edu/goldenpath/hg19/encodeDCC/\"\n",
308+
" \"wgEncodeSydhTfbs/wgEncodeSydhTfbsGm12878InputStdSig.bigWig\"\n",
290309
")\n",
291310
"\n",
292311
"track = hg.bigwig(bwpath).track(\"horizontal-bar\")\n",
@@ -295,9 +314,8 @@
295314
},
296315
{
297316
"cell_type": "markdown",
298-
"metadata": {
299-
"tags": []
300-
},
317+
"id": "5844a303",
318+
"metadata": {},
301319
"source": [
302320
"## Local cooler files\n",
303321
"\n",
@@ -307,175 +325,13 @@
307325
{
308326
"cell_type": "code",
309327
"execution_count": null,
328+
"id": "0439622f",
310329
"metadata": {},
311330
"outputs": [],
312331
"source": [
313332
"tileset = hg.cooler(\"../test/data/Dixon2012-J1-NcoI-R1-filtered.100kb.multires.cool\")\n",
314333
"hg.view(tileset.track(\"heatmap\"))"
315334
]
316-
},
317-
{
318-
"cell_type": "markdown",
319-
"metadata": {},
320-
"source": [
321-
"## Local bigWig files (with chromsizes)\n",
322-
"\n",
323-
"### TODO: inline `chromsizes` tilesets are not yet implemented"
324-
]
325-
},
326-
{
327-
"cell_type": "code",
328-
"execution_count": null,
329-
"metadata": {},
330-
"outputs": [],
331-
"source": [
332-
"chromsizes = [\n",
333-
" (\"chr1\", 249250621),\n",
334-
" (\"chr2\", 243199373),\n",
335-
" (\"chr3\", 198022430),\n",
336-
" (\"chr4\", 191154276),\n",
337-
" (\"chr5\", 180915260),\n",
338-
" (\"chr6\", 171115067),\n",
339-
" (\"chr7\", 159138663),\n",
340-
" (\"chr8\", 146364022),\n",
341-
" (\"chr9\", 141213431),\n",
342-
" (\"chr10\", 135534747),\n",
343-
" (\"chr11\", 135006516),\n",
344-
" (\"chr12\", 133851895),\n",
345-
" (\"chr13\", 115169878),\n",
346-
" (\"chr14\", 107349540),\n",
347-
" (\"chr15\", 102531392),\n",
348-
" (\"chr16\", 90354753),\n",
349-
" (\"chr17\", 81195210),\n",
350-
" (\"chr18\", 78077248),\n",
351-
" (\"chr20\", 63025520),\n",
352-
" (\"chr19\", 59128983),\n",
353-
" (\"chr21\", 48129895),\n",
354-
" (\"chr22\", 51304566),\n",
355-
" (\"chrX\", 155270560),\n",
356-
" (\"chrY\", 59373566),\n",
357-
" (\"chrM\", 16571),\n",
358-
"]\n",
359-
"\n",
360-
"bigwig_fp = (\n",
361-
" \"../test/data/wgEncodeCaltechRnaSeqHuvecR1x75dTh1014IlnaPlusSignalRep2.bigWig\"\n",
362-
")\n",
363-
"ts = hg.bigwig(bigwig_fp, chromsizes=chromsizes)\n",
364-
"cs = hg.ChromSizes(chromsizes)\n",
365-
"\n",
366-
"view1 = View(\n",
367-
" [\n",
368-
" Track(\"top-axis\"),\n",
369-
" Track(\"horizontal-bar\", tileset=ts),\n",
370-
" Track(\"horizontal-chromosome-labels\", position=\"top\", tileset=cs),\n",
371-
" ]\n",
372-
")\n",
373-
"display, server, viewconf = higlass.display([view1])\n",
374-
"\n",
375-
"display"
376-
]
377-
},
378-
{
379-
"cell_type": "markdown",
380-
"metadata": {},
381-
"source": [
382-
"## Local bedlike data\n",
383-
"\n",
384-
"### TODO: inline `bedlike` tilesets are not yet implemented"
385-
]
386-
},
387-
{
388-
"cell_type": "code",
389-
"execution_count": null,
390-
"metadata": {},
391-
"outputs": [],
392-
"source": [
393-
"import hg\n",
394-
"\n",
395-
"bed = [\n",
396-
" [\"chr1\", 1000, 2000, \"item #1\", \".\", \"+\"],\n",
397-
" [\"chr2\", 3000, 3500, \"item #1\", \".\", \"-\"],\n",
398-
"]\n",
399-
"\n",
400-
"chroms = [\n",
401-
" [\"chr1\", 2100],\n",
402-
" [\"chr2\", 4000],\n",
403-
"]\n",
404-
"\n",
405-
"\n",
406-
"data = bedtiles(bed, chroms)\n",
407-
"track = Track(\n",
408-
" track_type=\"bedlike\",\n",
409-
" position=\"top\",\n",
410-
" height=50,\n",
411-
" data=data,\n",
412-
" options={\"minusStrandColor\": \"red\"},\n",
413-
")\n",
414-
"\n",
415-
"\n",
416-
"d, s, v = higlass.display([[track]])\n",
417-
"d"
418-
]
419-
},
420-
{
421-
"cell_type": "markdown",
422-
"metadata": {},
423-
"source": [
424-
"## Custom data"
425-
]
426-
},
427-
{
428-
"cell_type": "code",
429-
"execution_count": null,
430-
"metadata": {},
431-
"outputs": [],
432-
"source": [
433-
"import numpy as np\n",
434-
"\n",
435-
"dim = 2000\n",
436-
"I, J = np.indices((dim, dim))\n",
437-
"data = -(J + 47) * np.sin(np.sqrt(np.abs(I / 2 + (J + 47)))) - I * np.sin(\n",
438-
" np.sqrt(np.abs(I - (J + 47)))\n",
439-
")"
440-
]
441-
},
442-
{
443-
"cell_type": "code",
444-
"execution_count": null,
445-
"metadata": {},
446-
"outputs": [],
447-
"source": [
448-
"import clodius.tiles.npmatrix\n",
449-
"from hg.tilesets import LocalTileset\n",
450-
"\n",
451-
"ts = hg.server.add(\n",
452-
" LocalTileset(\n",
453-
" uid=\"my-custom-tileset\",\n",
454-
" info=lambda: clodius.tiles.npmatrix.tileset_info(data),\n",
455-
" tiles=lambda tids: clodius.tiles.npmatrix.tiles_wrapper(data, tids),\n",
456-
" )\n",
457-
")\n",
458-
"\n",
459-
"hg.view(\n",
460-
" (hg.track(\"top-axis\"), \"top\"),\n",
461-
" (hg.track(\"left-axis\"), \"left\"),\n",
462-
" (ts.track(\"heatmap\", height=250).opts(valueScaleMax=0.5), \"center\"),\n",
463-
")"
464-
]
465-
},
466-
{
467-
"cell_type": "code",
468-
"execution_count": null,
469-
"metadata": {},
470-
"outputs": [],
471-
"source": []
472-
},
473-
{
474-
"cell_type": "code",
475-
"execution_count": null,
476-
"metadata": {},
477-
"outputs": [],
478-
"source": []
479335
}
480336
],
481337
"metadata": {

examples/JupyterServer.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"source": [
2020
"import higlass as hg\n",
2121
"\n",
22-
"ts = hg.cooler(\"./test.mcool\") # local tileset\n",
22+
"ts = hg.cooler(\"./test.mcool\") # local tileset\n",
2323
"hg.view(ts.track(\"heatmap\"), width=6)"
2424
]
2525
},

0 commit comments

Comments
 (0)