-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2de86f3
commit 60108b0
Showing
2 changed files
with
367 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,3 +76,6 @@ docs/_build/ | |
*.chain | ||
|
||
Cargo.lock | ||
|
||
# jupyter | ||
.ipynb_checkpoints |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,364 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "e70c802c-9a54-41e2-a928-7ea685017195", | ||
"metadata": {}, | ||
"source": [ | ||
"Don't forget to run `maturin develop --release`!" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"id": "856fbc60-6896-4824-8956-b466e29ddc69", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from pyliftover import LiftOver \n", | ||
"from chainlifter.lifter import ChainLifter" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "63a1308c-e230-43c5-9854-9465eaf2e5d3", | ||
"metadata": {}, | ||
"source": [ | ||
"# hg38 -> hg19" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "ebf17775-e59d-4b29-b7c1-887c5e7bbbf8", | ||
"metadata": {}, | ||
"source": [ | ||
"## Load chainfile" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"id": "58db1fb1-2a74-42cc-b586-c169bd396dee", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"1.33 s ± 161 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"%%timeit\n", | ||
"pyl = LiftOver(\"hg38\", \"hg19\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"id": "2332acf9-c6eb-42ac-8426-fe46eba132a0", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"234 ms ± 7.96 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"%%timeit\n", | ||
"ch = ChainLifter(\"hg38\", \"hg19\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "1ef1f123-9d01-4215-90d9-102a117a3ff3", | ||
"metadata": {}, | ||
"source": [ | ||
"## Load chainfile, run a query" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 4, | ||
"id": "ae47dbbb-c9ad-46b4-9f4d-14823bbf26f2", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"1.2 s ± 27.8 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"%%timeit\n", | ||
"pyl = LiftOver(\"hg38\", \"hg19\")\n", | ||
"pyl.convert_coordinate(\"chr5\", 1404391, \"+\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 5, | ||
"id": "729abc9a-6429-4cb6-aaca-4bac4cd762f8", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"233 ms ± 5.7 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"%%timeit\n", | ||
"ch = ChainLifter(\"hg38\", \"hg19\")\n", | ||
"ch.convert_coordinate(\"chr5\", 1404391, \"+\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "f9beb803-8e66-4fb3-9465-6fa941737665", | ||
"metadata": {}, | ||
"source": [ | ||
"## Run a query" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 6, | ||
"id": "7c51c0cb-e997-4ece-8a68-8e946b9dde3d", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# load beforehand\n", | ||
"pyl = LiftOver(\"hg38\", \"hg19\")\n", | ||
"ch = ChainLifter(\"hg38\", \"hg19\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 7, | ||
"id": "b68a6af6-1a89-414f-b4f1-2378f3c4f50d", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"2.07 µs ± 67.4 ns per loop (mean ± std. dev. of 7 runs, 100,000 loops each)\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"%%timeit\n", | ||
"pyl.convert_coordinate(\"chr5\", 1404391, \"+\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 8, | ||
"id": "e6643c38-f9f5-4ed6-a277-9642e731e6bc", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"1.97 µs ± 12.6 ns per loop (mean ± std. dev. of 7 runs, 1,000,000 loops each)\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"%%timeit\n", | ||
"ch.convert_coordinate(\"chr5\", 1404391, \"+\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "28575012-e1c8-42c0-bea0-1f5cd11926dc", | ||
"metadata": {}, | ||
"source": [ | ||
"# hg19 -> hg38" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "bbda14b1-11d1-48ae-8687-2c6f6bb21877", | ||
"metadata": {}, | ||
"source": [ | ||
"## Load chainfile" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 9, | ||
"id": "181231d8-3f00-407b-86a3-1ae268d4d931", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"335 ms ± 16.9 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"%%timeit\n", | ||
"pyl = LiftOver(\"hg19\", \"hg38\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 10, | ||
"id": "7822b8e7-939d-4b6d-85f6-514999c55602", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"63.2 ms ± 773 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"%%timeit\n", | ||
"ch = ChainLifter(\"hg19\", \"hg38\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "207fe64e-f84f-4f7f-861e-6eb23574c5c1", | ||
"metadata": {}, | ||
"source": [ | ||
"## Load chainfile, run a query" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 11, | ||
"id": "0ab6aeb8-88da-45e8-9efe-8b4a7825bcff", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"321 ms ± 6.01 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"%%timeit\n", | ||
"pyl = LiftOver(\"hg19\", \"hg38\")\n", | ||
"pyl.convert_coordinate(\"chr5\", 1404391, \"+\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 12, | ||
"id": "a014955a-5451-4b10-83bd-4d4843ddc227", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"63.5 ms ± 806 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"%%timeit\n", | ||
"ch = ChainLifter(\"hg19\", \"hg38\")\n", | ||
"ch.convert_coordinate(\"chr5\", 1404391, \"+\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "088055d4-0d09-4e12-8826-b3ea39ab94e5", | ||
"metadata": {}, | ||
"source": [ | ||
"## Run a query" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 13, | ||
"id": "a516e0a8-02b1-4ce5-8e69-3d0badcaffa4", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# load beforehand\n", | ||
"pyl = LiftOver(\"hg19\", \"hg38\")\n", | ||
"ch = ChainLifter(\"hg19\", \"hg38\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 14, | ||
"id": "d433fee3-9c40-4633-be5e-2649b723968e", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"2.02 µs ± 11.6 ns per loop (mean ± std. dev. of 7 runs, 100,000 loops each)\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"%%timeit\n", | ||
"pyl.convert_coordinate(\"chr5\", 1404391, \"+\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 15, | ||
"id": "5bb82164-e123-47ae-a748-7d4c4898fcb2", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"2.02 µs ± 56 ns per loop (mean ± std. dev. of 7 runs, 100,000 loops each)\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"%%timeit\n", | ||
"ch.convert_coordinate(\"chr5\", 1404391, \"+\")" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "liftovertest", | ||
"language": "python", | ||
"name": "liftovertest" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.11.0" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |