-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
21 changed files
with
3,409 additions
and
5 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,9 +1,12 @@ | ||
[build-system] | ||
requires = ["maturin>=1.0,<2.0", "polars>=1.3.0"] | ||
requires = ["poetry-core>=1.0.0", "maturin>=1.0,<2.0", "polars>=1.3.0"] | ||
build-backend = "maturin" | ||
|
||
[project] | ||
name = "polars-bio" | ||
version = "0.1.0" | ||
description = "Blazing fast genomic operations on large Python dataframes" | ||
authors = [] | ||
requires-python = ">=3.8" | ||
classifiers = [ | ||
"Programming Language :: Rust", | ||
|
@@ -17,3 +20,26 @@ module-name = "polars_bio" | |
[[tool.mypy.overrides]] | ||
module = "polars.utils.udfs" | ||
ignore_missing_imports = true | ||
|
||
[tool.poetry] | ||
name = "polars-bio" | ||
version = "0.1.0" | ||
description = "" | ||
authors = ["Marek Wiewiórka <[email protected]>"] | ||
readme = "README.md" | ||
|
||
[tool.poetry.dependencies] | ||
python = ">=3.9,<3.13" | ||
polars = "^1.16.0" | ||
pandas = "^2.2.3" | ||
|
||
|
||
[tool.poetry.dev-dependencies] | ||
pytest = "^8.3.3" | ||
pytest-cov = "^6.0.0" | ||
pre-commit = "^4.0.1" | ||
jupyter = "^1.1.0" | ||
ruff = "^0.8.2" | ||
maturin = "^1.7.5" | ||
bioframe = "^0.7.2" | ||
mdpd = "^0.2.1" |
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,42 @@ | ||
import mdpd | ||
from pathlib import Path | ||
|
||
import pandas as pd | ||
|
||
TEST_DIR = Path(__file__).parent | ||
DATA_DIR = TEST_DIR / "data" | ||
EXPECTED_OVERLAP = """ | ||
"+--------+-----------+---------+--------+-----------+---------+", | ||
"| contig_1 | pos_start_1 | pos_end_1 | contig_2 | pos_start_2 | pos_end_2 |", | ||
"+--------+-----------+---------+--------+-----------+---------+", | ||
"| chr1 | 150 | 250 | chr1 | 100 | 190 |", | ||
"| chr1 | 150 | 250 | chr1 | 200 | 290 |", | ||
"| chr1 | 190 | 300 | chr1 | 100 | 190 |", | ||
"| chr1 | 190 | 300 | chr1 | 200 | 290 |", | ||
"| chr1 | 300 | 501 | chr1 | 400 | 600 |", | ||
"| chr1 | 500 | 700 | chr1 | 400 | 600 |", | ||
"| chr1 | 15000 | 15000 | chr1 | 10000 | 20000 |", | ||
"| chr1 | 22000 | 22300 | chr1 | 22100 | 22100 |", | ||
"| chr2 | 150 | 250 | chr2 | 100 | 190 |", | ||
"| chr2 | 150 | 250 | chr2 | 200 | 290 |", | ||
"| chr2 | 190 | 300 | chr2 | 100 | 190 |", | ||
"| chr2 | 190 | 300 | chr2 | 200 | 290 |", | ||
"| chr2 | 300 | 500 | chr2 | 400 | 600 |", | ||
"| chr2 | 500 | 700 | chr2 | 400 | 600 |", | ||
"| chr2 | 15000 | 15000 | chr2 | 10000 | 20000 |", | ||
"| chr2 | 22000 | 22300 | chr2 | 22100 | 22100 |", | ||
"+--------+-----------+---------+--------+-----------+---------+", | ||
""" | ||
|
||
DF_OVERLAP = (mdpd.from_md(EXPECTED_OVERLAP) | ||
.astype({'pos_start_1': 'int64'}) | ||
.astype({'pos_end_1': 'int64'}) | ||
.astype({'pos_start_2': 'int64'}) | ||
.astype({'pos_end_2': 'int64'})) | ||
|
||
DF_OVERLAP = DF_OVERLAP.sort_values(by=list(DF_OVERLAP.columns)).reset_index(drop=True) | ||
|
||
|
||
|
||
DF1 = pd.read_csv(f"{DATA_DIR}/reads.csv") | ||
DF2 = pd.read_csv(f"{DATA_DIR}/targets.csv") |
Binary file not shown.
Binary file added
BIN
+19.1 KB
tests/data/exons/.part-00000-47fafbb5-1cab-410c-9461-d10effacf760-c000.snappy.parquet.crc
Binary file not shown.
Binary file added
BIN
+7.89 KB
tests/data/exons/.part-00001-47fafbb5-1cab-410c-9461-d10effacf760-c000.snappy.parquet.crc
Binary file not shown.
Empty file.
Binary file added
BIN
+2.39 MB
tests/data/exons/part-00000-47fafbb5-1cab-410c-9461-d10effacf760-c000.snappy.parquet
Binary file not shown.
Binary file added
BIN
+1010 KB
tests/data/exons/part-00001-47fafbb5-1cab-410c-9461-d10effacf760-c000.snappy.parquet
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+11.4 KB
...a/fBrain-DS14718/.part-00000-a0d75244-2d87-41eb-a3eb-a18847c7cb87-c000.snappy.parquet.crc
Binary file not shown.
Binary file added
BIN
+748 Bytes
...a/fBrain-DS14718/.part-00001-a0d75244-2d87-41eb-a3eb-a18847c7cb87-c000.snappy.parquet.crc
Binary file not shown.
Empty file.
Binary file added
BIN
+1.43 MB
...s/data/fBrain-DS14718/part-00000-a0d75244-2d87-41eb-a3eb-a18847c7cb87-c000.snappy.parquet
Binary file not shown.
Binary file added
BIN
+92.3 KB
...s/data/fBrain-DS14718/part-00001-a0d75244-2d87-41eb-a3eb-a18847c7cb87-c000.snappy.parquet
Binary file not shown.
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,13 @@ | ||
contig,pos_start,pos_end | ||
chr1,150,250 | ||
chr1,190,300 | ||
chr1,300,501 | ||
chr1,500,700 | ||
chr1,22000,22300 | ||
chr1,15000,15000 | ||
chr2,150,250 | ||
chr2,190,300 | ||
chr2,300,500 | ||
chr2,500,700 | ||
chr2,22000,22300 | ||
chr2,15000,15000 |
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,11 @@ | ||
contig,pos_start,pos_end | ||
chr1,100,190 | ||
chr1,200,290 | ||
chr1,400,600 | ||
chr1,10000,20000 | ||
chr1,22100,22100 | ||
chr2,100,190 | ||
chr2,200,290 | ||
chr2,400,600 | ||
chr2,10000,20000 | ||
chr2,22100,22100 |
Empty file.
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,23 @@ | ||
import pandas as pd | ||
|
||
import polars_bio as pb | ||
from _expected import DF_OVERLAP, DF1, DF2 | ||
|
||
|
||
|
||
|
||
|
||
|
||
class TestOverlapPandas: | ||
def test_overlap_count(self): | ||
assert len(pb.overlap(DF1, DF2, output_type="pandas.DataFrame")) == 16 | ||
|
||
def test_overlap_schema_rows(self): | ||
result = pb.overlap(DF1, DF2, output_type="pandas.DataFrame") | ||
result = result.sort_values(by=list(result.columns)).reset_index(drop=True) | ||
expected = DF_OVERLAP | ||
pd.testing.assert_frame_equal(result, expected) | ||
|
||
|
||
|
||
|
This file was deleted.
Oops, something went wrong.
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,4 @@ | ||
import pandas as pd | ||
import polars_bio.overlap as overlap | ||
|
||
|