Skip to content

Commit

Permalink
Updated for latest anndata. Updated pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
joshua-gould committed Sep 17, 2024
1 parent 2c00357 commit ddbc98a
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 35 deletions.
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.6.0
hooks:
# - id: double-quote-string-fixer # for single quotes: uncomment and add black config “skip-string-normalization”
- id: trailing-whitespace
Expand All @@ -11,19 +11,19 @@ repos:
- id: docformatter
args: ["--in-place", "--wrap-summaries=100", "--wrap-descriptions=100", "--config=./pyproject.toml"]
- repo: https://github.com/psf/black
rev: 23.9.1
rev: 24.8.0
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
- repo: https://github.com/csachs/pyproject-flake8
rev: v6.1.0
rev: v7.0.0
hooks:
- id: pyproject-flake8
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.3
rev: v4.0.0-alpha.8
hooks:
- id: prettier
types_or: [css, javascript]
8 changes: 5 additions & 3 deletions cirrocumulus/concat.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,11 @@ def concat_spatial(paths: list[str], output_path: str, ncols: int = 2):

def create_parser(description=False):
parser = argparse.ArgumentParser(
description="Concatenate datasets in a grid layout. If all the datasets are spatial datasets, then tissue images are concatenated."
if description
else None
description=(
"Concatenate datasets in a grid layout. If all the datasets are spatial datasets, then tissue images are concatenated."
if description
else None
)
)
parser.add_argument(
"dataset",
Expand Down
16 changes: 10 additions & 6 deletions cirrocumulus/diff_exp.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,15 @@ def __init__(
scores=scores,
pvals=pvals,
logfoldchanges=foldchanges,
frac_expressed1=frac_expressed_df.loc[group_one].values
if frac_expressed_df is not None
else None,
frac_expressed2=frac_expressed_df.loc[group_two].values
if frac_expressed_df is not None
else None,
frac_expressed1=(
frac_expressed_df.loc[group_one].values
if frac_expressed_df is not None
else None
),
frac_expressed2=(
frac_expressed_df.loc[group_two].values
if frac_expressed_df is not None
else None
),
)
self.pair2results = pair2results
6 changes: 4 additions & 2 deletions cirrocumulus/local_db_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ def __init__(self, paths: list[str]):
if url.lower().endswith(".json.gz") or url.lower().endswith(".json"):
import gzip

with gzip.open(fs.open(url)) if url.lower().endswith(".json.gz") else fs.open(
url
with (
gzip.open(fs.open(url))
if url.lower().endswith(".json.gz")
else fs.open(url)
) as f:
d = json.load(f)
if "id" in d:
Expand Down
4 changes: 1 addition & 3 deletions cirrocumulus/sparse_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import numpy as np
import scipy.sparse as ss
from anndata._core.index import _subset
from scipy.sparse import _sparsetools


Expand All @@ -22,9 +23,6 @@
except ImportError:
_cs_matrix = ss.spmatrix

from anndata._core.index import _subset


Index1D = Union[slice, int, str, np.int64, np.ndarray]
Index = Union[Index1D, Tuple[Index1D, Index1D], ss.spmatrix]

Expand Down
4 changes: 4 additions & 0 deletions docs/release_notes.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Release Notes
-------------

- 1.1.58 `September 17, 2024`
* Sort categories using natural sort order
* Compatibility with anndata 0.10.9

- 1.1.57 `September 29, 2023`
* Ensure group order is persisted when performing differential expression between two groups
* Fixed drop-down arrow click for gene sets
Expand Down
4 changes: 2 additions & 2 deletions src/AutocompleteVirtualized.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,8 @@ export default function AutocompleteVirtualized(props) {
result.text != null
? result.text
: result.id != null
? result.id
: result;
? result.id
: result;
textToOption.delete(text.toLowerCase());
});
tokens.forEach((token) => {
Expand Down
4 changes: 2 additions & 2 deletions src/actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2425,8 +2425,8 @@ function getNewEmbeddingData(state, features) {
embedding.spatial != null
? embedding.spatial.type
: embedding.type
? embedding.type
: TRACE_TYPE_SCATTER;
? embedding.type
: TRACE_TYPE_SCATTER;
let coordinates =
traceType !== TRACE_TYPE_META_IMAGE ? cachedData[embeddingKey] : null;
if (coordinates == null && embedding.mode != null) {
Expand Down
24 changes: 12 additions & 12 deletions src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -680,10 +680,10 @@ export function rankdata(values) {
return a.value < b.value
? -1
: a.value === b.value
? a.position < b.position
? -1
: 1
: 1;
? a.position < b.position
? -1
: 1
: 1;
});

// Walk the sorted array, filling output array using sorted positions,
Expand Down Expand Up @@ -722,20 +722,20 @@ function indexSortPairs(ranks, ascending) {
return a.value < b.value
? -1
: a.value === b.value
? a.position < b.position
? -1
: 1
: 1;
? a.position < b.position
? -1
: 1
: 1;
});
} else {
ranks.sort(function (a, b) {
return a.value < b.value
? 1
: a.value === b.value
? a.position < b.position
? 1
: -1
: -1;
? a.position < b.position
? 1
: -1
: -1;
});
}

Expand Down

0 comments on commit ddbc98a

Please sign in to comment.