Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Dec 23, 2024
1 parent 17471f9 commit 53b2f18
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 22 deletions.
10 changes: 5 additions & 5 deletions docs/notebooks/Tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"source": [
"# In this case we define the two datasets based on the subgroup category\n",
"simulated_data.obs['Dataset'] = simulated_data.obs.Subgroup.replace(\n",
" {'Group1': 'Dataset 1', 'Group2': 'Dataset 1', \n",
" {'Group1': 'Dataset 1', 'Group2': 'Dataset 1',\n",
" 'Group3': 'Dataset 2', 'Group4': 'Dataset 2'})"
]
},
Expand All @@ -86,8 +86,8 @@
"outputs": [],
"source": [
"simulated_data.obs['Celltypes'] = simulated_data.obs.Group.replace(\n",
" {'Group1': 'Cell type 1', 'Group2': 'Cell type 2', \n",
" 'Group3': 'Cell type 3', 'Group4': 'Cell type 4', \n",
" {'Group1': 'Cell type 1', 'Group2': 'Cell type 2',\n",
" 'Group3': 'Cell type 3', 'Group4': 'Cell type 4',\n",
" 'Group5': 'Cell type 5'})"
]
},
Expand All @@ -107,7 +107,7 @@
"outputs": [],
"source": [
"simulated_data.obs['Gene_programs'] = simulated_data.obs.Subgroup.replace(\n",
" {'Group1': 'Gene program 1a', 'Group2': 'Gene program 2a', \n",
" {'Group1': 'Gene program 1a', 'Group2': 'Gene program 2a',\n",
" 'Group3': 'Gene program 1b', 'Group4': 'Gene program 2b'})"
]
},
Expand Down Expand Up @@ -246,7 +246,7 @@
},
"outputs": [],
"source": [
"plt.plot(spvipes.history['elbo_train']['elbo_train'], label='elbo_train');\n",
"plt.plot(spvipes.history['elbo_train']['elbo_train'], label='elbo_train')\n",
"plt.legend()"
]
},
Expand Down
4 changes: 1 addition & 3 deletions src/spVIPES/data/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,7 @@ def _make_column_categorical(
if np.min(counts) < 3:
category = unique[np.argmin(counts)]
warnings.warn(
"Category {} in adata.obs['{}'] has fewer than 3 cells. Models may not train properly.".format(
category, alternate_column_key
),
f"Category {category} in adata.obs['{alternate_column_key}'] has fewer than 3 cells. Models may not train properly.",
UserWarning,
stacklevel=settings.warnings_stacklevel,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ def __init__(
sampler_cls = (
SequentialSampler
if not shuffle and not weighted
else WeightedRandomSampler
if shuffle and weighted
else RandomSampler
if shuffle and not weighted
else None
else (
WeightedRandomSampler
if shuffle and weighted
else RandomSampler if shuffle and not weighted else None
)
)
if sampler_cls != WeightedRandomSampler:
sampler = BatchSampler(
Expand Down
10 changes: 5 additions & 5 deletions src/spVIPES/dataloaders/_ann_dataloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ def __init__(
sampler_cls = (
SequentialSampler
if not shuffle and not weighted
else WeightedRandomSampler
if shuffle and weighted
else RandomSampler
if shuffle and not weighted
else None
else (
WeightedRandomSampler
if shuffle and weighted
else RandomSampler if shuffle and not weighted else None
)
)
if sampler_cls != WeightedRandomSampler:
sampler = BatchSampler(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
https://docs.scvi-tools.org/en/0.9.0/user_guide/notebooks/model_user_guide.html#Mixing-in-pre-coded-features
"""


from typing import List, Optional, Union

import numpy as np
Expand Down
1 change: 0 additions & 1 deletion src/spVIPES/model/base/training_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
https://docs.scvi-tools.org/en/0.9.0/user_guide/notebooks/model_user_guide.html#Mixing-in-pre-coded-features
"""


from typing import Optional, Union

import numpy as np
Expand Down
4 changes: 2 additions & 2 deletions src/spVIPES/model/spvipes.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ def __init__(
)

self._model_summary_string = (
"spVIPES Model with the following params: \nn_hidden: {}, n_dimensions_shared: {}, n_dimensions_private: {}, dropout_rate: {}"
).format(n_hidden, n_dimensions_shared, n_dimensions_private, dropout_rate)
f"spVIPES Model with the following params: \nn_hidden: {n_hidden}, n_dimensions_shared: {n_dimensions_shared}, n_dimensions_private: {n_dimensions_private}, dropout_rate: {dropout_rate}"
)
# necessary line to get params that will be used for saving/loading
self.init_params_ = self._get_init_params(locals())

Expand Down
1 change: 1 addition & 0 deletions src/spVIPES/module/spVIPESmodule.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Main module."""

from typing import Literal

import numpy as np
Expand Down

0 comments on commit 53b2f18

Please sign in to comment.