mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-06 13:58:12 +08:00
rename X_approx_distribution to X_approximate_distribution (#2337)
This commit is contained in:
@@ -44,7 +44,7 @@ class DatasetConfig(BaseConfig):
|
||||
self.diffexp__lfc_cutoff = default_config["diffexp"]["lfc_cutoff"]
|
||||
self.diffexp__top_n = default_config["diffexp"]["top_n"]
|
||||
|
||||
self.X_approx_distribution = default_config["X_approx_distribution"]
|
||||
self.X_approximate_distribution = default_config["X_approximate_distribution"]
|
||||
|
||||
except KeyError as e:
|
||||
raise ConfigurationError(f"Unexpected config: {str(e)}")
|
||||
@@ -60,7 +60,7 @@ class DatasetConfig(BaseConfig):
|
||||
self.handle_user_annotations(context)
|
||||
self.handle_embeddings()
|
||||
self.handle_diffexp(context)
|
||||
self.handle_X_approx_distribution()
|
||||
self.handle_X_approximate_distribution()
|
||||
|
||||
def handle_app(self):
|
||||
self.validate_correct_type_of_configuration_attribute("app__scripts", list)
|
||||
@@ -203,9 +203,9 @@ class DatasetConfig(BaseConfig):
|
||||
"running differential expression may take longer or fail."
|
||||
)
|
||||
|
||||
def handle_X_approx_distribution(self):
|
||||
self.validate_correct_type_of_configuration_attribute("X_approx_distribution", str)
|
||||
if self.X_approx_distribution not in ["normal", "count"]:
|
||||
def handle_X_approximate_distribution(self):
|
||||
self.validate_correct_type_of_configuration_attribute("X_approximate_distribution", str)
|
||||
if self.X_approximate_distribution not in ["normal", "count"]:
|
||||
raise ConfigurationError(
|
||||
"X_approx_distribution has unknown value -- must be 'normal' or 'count'."
|
||||
"X_approximate_distribution has unknown value -- must be 'normal' or 'count'."
|
||||
)
|
||||
|
||||
@@ -8,7 +8,7 @@ from scipy import sparse
|
||||
|
||||
import backend.common.compute.diffexp_generic as diffexp_generic
|
||||
from backend.common.colors import convert_anndata_category_colors_to_cxg_category_colors
|
||||
from backend.common.constants import Axis, MAX_LAYOUTS, XApproxDistribution
|
||||
from backend.common.constants import Axis, MAX_LAYOUTS, XApproximateDistribution
|
||||
from backend.czi_hosted.common.corpora import corpora_get_props_from_anndata
|
||||
from backend.common.errors import PrepareError, DatasetAccessError, ConfigurationError
|
||||
from backend.common.utils.type_conversion_utils import get_schema_type_hint_of_array
|
||||
@@ -28,7 +28,7 @@ class AnndataAdaptor(DataAdaptor):
|
||||
def __init__(self, data_locator, app_config=None, dataset_config=None):
|
||||
super().__init__(data_locator, app_config, dataset_config)
|
||||
self.data = None
|
||||
self.X_approx_distribution = None
|
||||
self.X_approximate_distribution = None
|
||||
self._load_data(data_locator)
|
||||
self._validate_and_initialize()
|
||||
|
||||
@@ -191,9 +191,9 @@ class AnndataAdaptor(DataAdaptor):
|
||||
self.gene_count = self.data.shape[1]
|
||||
self._create_schema()
|
||||
|
||||
if self.dataset_config.X_approx_distribution == "auto":
|
||||
raise ConfigurationError("X-approx-distribution 'auto' mode unsupported.")
|
||||
self.X_approx_distribution = self.dataset_config.X_approx_distribution
|
||||
if self.dataset_config.X_approximate_distribution == "auto":
|
||||
raise ConfigurationError("X-approximate-distribution 'auto' mode unsupported.")
|
||||
self.X_approximate_distribution = self.dataset_config.X_approximate_distribution
|
||||
|
||||
# heuristic
|
||||
n_values = self.data.shape[0] * self.data.shape[1]
|
||||
@@ -327,8 +327,8 @@ class AnndataAdaptor(DataAdaptor):
|
||||
X = self.data.X[obs_mask, var_mask]
|
||||
return X
|
||||
|
||||
def get_X_approx_distribution(self) -> XApproxDistribution:
|
||||
return self.X_approx_distribution
|
||||
def get_X_approximate_distribution(self) -> XApproximateDistribution:
|
||||
return self.X_approximate_distribution
|
||||
|
||||
def get_shape(self):
|
||||
return self.data.shape
|
||||
|
||||
@@ -7,7 +7,7 @@ from scipy import sparse
|
||||
from server_timing import Timing as ServerTiming
|
||||
|
||||
from backend.czi_hosted.common.config.app_config import AppConfig
|
||||
from backend.common.constants import Axis, XApproxDistribution
|
||||
from backend.common.constants import Axis, XApproximateDistribution
|
||||
from backend.common.errors import (
|
||||
FilterError,
|
||||
JSONEncodingValueError,
|
||||
@@ -84,7 +84,7 @@ class DataAdaptor(metaclass=ABCMeta):
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def get_X_approx_distribution(self) -> XApproxDistribution:
|
||||
def get_X_approximate_distribution(self) -> XApproximateDistribution:
|
||||
"""return the approximate distribution of the X matrix."""
|
||||
pass
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import pandas as pd
|
||||
import tiledb
|
||||
from server_timing import Timing as ServerTiming
|
||||
|
||||
from backend.common.constants import Axis, XApproxDistribution
|
||||
from backend.common.constants import Axis, XApproximateDistribution
|
||||
from backend.common.errors import DatasetAccessError, ConfigurationError
|
||||
from backend.czi_hosted.common.immutable_kvcache import ImmutableKVCache
|
||||
from backend.common.utils.type_conversion_utils import get_schema_type_hint_from_dtype
|
||||
@@ -37,7 +37,7 @@ class CxgAdaptor(DataAdaptor):
|
||||
self.lsuri_results = ImmutableKVCache(lambda key: self._lsuri(uri=key, tiledb_ctx=self.tiledb_ctx))
|
||||
self.arrays = ImmutableKVCache(lambda key: self._open_array(uri=key, tiledb_ctx=self.tiledb_ctx))
|
||||
self.schema = None
|
||||
self.X_approx_distribution = None
|
||||
self.X_approximate_distribution = None
|
||||
|
||||
self._validate_and_initialize()
|
||||
|
||||
@@ -176,9 +176,9 @@ class CxgAdaptor(DataAdaptor):
|
||||
if cxg_version not in ["0.0", "0.1", "0.2.0"]:
|
||||
raise DatasetAccessError(f"cxg matrix is not valid: {self.url}")
|
||||
|
||||
if self.dataset_config.X_approx_distribution == "auto":
|
||||
raise ConfigurationError("X-approx-distribution 'auto' mode unsupported.")
|
||||
self.X_approx_distribution = self.dataset_config.X_approx_distribution
|
||||
if self.dataset_config.X_approximate_distribution == "auto":
|
||||
raise ConfigurationError("X-approximate-distribution 'auto' mode unsupported.")
|
||||
self.X_approximate_distribution = self.dataset_config.X_approximate_distribution
|
||||
|
||||
self.title = title
|
||||
self.about = about
|
||||
@@ -286,8 +286,8 @@ class CxgAdaptor(DataAdaptor):
|
||||
data = X.multi_index[obs_items, var_items][""]
|
||||
return data
|
||||
|
||||
def get_X_approx_distribution(self) -> XApproxDistribution:
|
||||
return self.X_approx_distribution
|
||||
def get_X_approximate_distribution(self) -> XApproximateDistribution:
|
||||
return self.X_approximate_distribution
|
||||
|
||||
def get_shape(self):
|
||||
X = self.open_array("X")
|
||||
|
||||
@@ -203,7 +203,7 @@ dataset:
|
||||
lfc_cutoff: 0.01
|
||||
top_n: 10
|
||||
|
||||
X_approx_distribution: normal # currently fixed config
|
||||
X_approximate_distribution: normal # currently fixed config
|
||||
|
||||
external:
|
||||
# You can retrieve configuration parameters from this config file, the environment,
|
||||
|
||||
Reference in New Issue
Block a user