Skip to content

Commit

Permalink
[c++, python] Apply latest reviews for re-indexer
Browse files Browse the repository at this point in the history
  • Loading branch information
beroy committed Jan 19, 2024
1 parent f4c16e1 commit c8e1b51
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 23 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/r-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ jobs:
- name: Bootstrap
run: cd apis/r && tools/r-ci.sh bootstrap

- name: Install tiledb
run: cd apis/r && Rscript -e 'remotes::install_version("tiledb", "0.22.0")'

- name: Install BioConductor package SingleCellExperiment
run: cd apis/r && tools/r-ci.sh install_bioc SingleCellExperiment

Expand Down
1 change: 1 addition & 0 deletions apis/python/src/tiledbsoma/_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class Experiment( # type: ignore[misc] # __eq__ false positive
A collection of named measurements.
Example:
>>> import tiledbsoma
>>> with tiledbsoma.open("/path/to/experiment") as exp:
... # While users can interact directly with an Experiment's fields:
... obs_df = exp.obs
Expand Down
2 changes: 1 addition & 1 deletion libtiledbsoma/src/reindexer/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def main():
with cellxgene_census.open_soma(**census_s3) as census:
with census["census_data"]["homo_sapiens"].axis_query(
measurement_name="RNA",
obs_query=soma.AxisQuery(value_filter="""tissue_general == 'eye'"""),
obs_query=soma.AxisQuery(value_filter="tissue_general == 'eye'"),
) as query:
query.to_anndata(X_name="raw")
t2 = perf_counter()
Expand Down
13 changes: 3 additions & 10 deletions libtiledbsoma/src/reindexer/reindexer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* The MIT License
*
* @copyright Copyright (c) 2022 TileDB, Inc.
* @copyright Copyright (c) 2024 TileDB, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -76,11 +76,7 @@ void IntIndexer::map_locations(const int64_t* keys, int size, int threads) {
int64_t counter = 0;
// Hash map construction
for (int i = 0; i < size; i++) {
k = kh_put(
m64,
hash_,
keys[i],
&ret); // hash_wrapper<IntType>::put(hash_, key, &ret);
k = kh_put(m64, hash_, keys[i], &ret);
assert(k != kh_end(hash_));
kh_val(hash_, k) = counter;
counter++;
Expand All @@ -100,10 +96,7 @@ void IntIndexer::lookup(const int64_t* keys, int64_t* results, int size) {
size));
if (tiledb_thread_pool_->concurrency_level() == 1) {
for (int i = 0; i < size; i++) {
auto k = kh_get(
m64,
hash_,
keys[i]); // hash_wrapper<IntType>::get(hash_, keys[i]);
auto k = kh_get(m64, hash_, keys[i]);
if (k == kh_end(hash_)) {
// According to pandas behavior
results[i] = -1;
Expand Down
8 changes: 6 additions & 2 deletions libtiledbsoma/src/reindexer/reindexer.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* The MIT License
*
* @copyright Copyright (c) 2022 TileDB, Inc.
* @copyright Copyright (c) 2024 TileDB, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -30,7 +30,9 @@
* This file defines the a pybind11 api into SOMA C++ library.
*/

#pragma once
#ifndef TILEDBSOMA_REINDEXER_H
#define TILEDBSOMA_REINDEXER_H

#include <assert.h>
#include <unistd.h>
#include <memory>
Expand Down Expand Up @@ -97,3 +99,5 @@ class IntIndexer {
};

} // namespace tiledbsoma

#endif // TILEDBSOMA_REINDEXER_H
4 changes: 2 additions & 2 deletions libtiledbsoma/test/test_indexer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* The MIT License
*
* @copyright Copyright (c) 2022 TileDB, Inc.
* @copyright Copyright (c) 2024 TileDB, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -27,7 +27,7 @@
*
* @section DESCRIPTION
*
* This file manages unit tests for column buffers
* This file manages unit tests for re-indexer
*/

#include <reindexer/reindexer.h>
Expand Down
6 changes: 1 addition & 5 deletions libtiledbsoma/test/test_indexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,6 @@ def indexer_test_pass(keys: np.array, lookups: np.array):
]


def main():
def test_indexer():
for data in test_data:
indexer_test(data["keys"], data["lookups"], not data["pass"])


if __name__ == "__main__":
main()

0 comments on commit c8e1b51

Please sign in to comment.