Skip to content

Commit

Permalink
fix tests [wheel]
Browse files Browse the repository at this point in the history
  • Loading branch information
kaizhang committed Dec 13, 2024
1 parent 1f870ac commit 908524a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
7 changes: 7 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Release Notes

## Nightly (unreleased)

### Features:

- Support python 3.13.
- Add Zarr backend support for AnnData.

## Release 2.8.0 (released December 13, 2024)

### Features:
Expand Down
6 changes: 3 additions & 3 deletions snapatac2-core/src/utils/similarity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ where
}
}).collect::<Vec<_>>()
}).collect();
ArrayBase::from_vec(cor).into_shape((n1, n2)).unwrap()
ArrayBase::from_vec(cor).into_shape_with_order((n1, n2)).unwrap()
}

pub fn spearman2<T1, T2>(
Expand All @@ -381,7 +381,7 @@ where
let vec: Vec<_> = mat.rows().into_iter().flat_map(|row|
Data::new(row.into_iter().map(|x| x.to_f64().unwrap()).collect::<Vec<_>>()).ranks(RankTieBreaker::Average)
).collect();
ArrayBase::from_vec(vec).into_shape((mat.shape()[0], mat.shape()[1])).unwrap()
ArrayBase::from_vec(vec).into_shape_with_order((mat.shape()[0], mat.shape()[1])).unwrap()
}
let mat1_ = rank(mat1);
let mat2_ = rank(mat2);
Expand All @@ -406,5 +406,5 @@ where
let n2 = mat_y.nrows();
let dists = (0..n1).cartesian_product(0..n2).collect::<Vec<_>>().into_par_iter()
.map(|(i, j)| dist_fn(mat_x.get_row(i).unwrap(), mat_y.get_row(j).unwrap())).collect();
ArrayBase::from_vec(dists).into_shape((n1, n2)).unwrap()
ArrayBase::from_vec(dists).into_shape_with_order((n1, n2)).unwrap()
}
8 changes: 4 additions & 4 deletions snapatac2-python/tests/test_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ def h5ad(dir=Path("./")):
def test_exclude():
fragment_file = snap.datasets.pbmc500(downsample=True)

data1 = snap.pp.import_data(
data1 = snap.pp.import_fragments(
fragment_file,
chrom_sizes={chr: size for chr, size in snap.genome.hg38.chrom_sizes.items() if chr not in ["chr1", "chr10"]},
sorted_by_barcode=False,
min_num_fragments=0,
)
snap.pp.add_tile_matrix(data1, exclude_chroms=None)

data2 = snap.pp.import_data(
data2 = snap.pp.import_fragments(
fragment_file,
chrom_sizes=snap.genome.hg38,
sorted_by_barcode=False,
Expand Down Expand Up @@ -57,7 +57,7 @@ def pipeline(data):
def test_backed(tmp_path):
fragment_file = snap.datasets.pbmc500(downsample=True)

data = snap.pp.import_data(
data = snap.pp.import_fragments(
fragment_file,
chrom_sizes=snap.genome.hg38,
file=h5ad(tmp_path),
Expand All @@ -68,7 +68,7 @@ def test_backed(tmp_path):
def test_in_memory():
fragment_file = snap.datasets.pbmc500(downsample=True)

data = snap.pp.import_data(
data = snap.pp.import_fragments(
fragment_file,
chrom_sizes=snap.genome.hg38,
sorted_by_barcode=False,
Expand Down
4 changes: 2 additions & 2 deletions snapatac2-python/tests/test_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def test_import(datadir):
test_files = [snap.datasets.pbmc500(downsample=True), str(datadir.join('test_clean.tsv.gz'))]

for fl in test_files:
data = snap.pp.import_data(
data = snap.pp.import_fragments(
fl,
chrom_sizes=snap.genome.hg38,
min_num_fragments=0,
Expand All @@ -150,7 +150,7 @@ def total_count(adata, bin_size):
counting_strategy='insertion',
).X.sum()

data = snap.pp.import_data(
data = snap.pp.import_fragments(
snap.datasets.pbmc500(downsample=True),
chrom_sizes=snap.genome.hg38,
min_num_fragments=0,
Expand Down

0 comments on commit 908524a

Please sign in to comment.