mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-04 12:58:13 +08:00
10 day cache (down from 1000)
I can expect a scientist to leave this running over the weekend on their laptop and still expect fast results. If someone leaves it running for a few years the data can probably be safely recalculated.
This commit is contained in:
@@ -71,7 +71,7 @@ class ScanpyEngine(CXGDriver):
|
|||||||
cell_idx = np.logical_and(cell_idx, key_idx)
|
cell_idx = np.logical_and(cell_idx, key_idx)
|
||||||
return self.data[cell_idx, :]
|
return self.data[cell_idx, :]
|
||||||
|
|
||||||
@cache.memoize(86400000)
|
@cache.memoize(864000)
|
||||||
def metadata_ranges(self, df=None):
|
def metadata_ranges(self, df=None):
|
||||||
metadata_ranges = {}
|
metadata_ranges = {}
|
||||||
if not df:
|
if not df:
|
||||||
@@ -91,7 +91,7 @@ class ScanpyEngine(CXGDriver):
|
|||||||
}
|
}
|
||||||
return metadata_ranges
|
return metadata_ranges
|
||||||
|
|
||||||
@cache.memoize(86400000)
|
@cache.memoize(864000)
|
||||||
def metadata(self, df, fields=None):
|
def metadata(self, df, fields=None):
|
||||||
"""
|
"""
|
||||||
Gets metadata key:value for each cells
|
Gets metadata key:value for each cells
|
||||||
@@ -105,7 +105,7 @@ class ScanpyEngine(CXGDriver):
|
|||||||
metadata[idx]["CellName"] = metadata[idx].pop("cell_name", None)
|
metadata[idx]["CellName"] = metadata[idx].pop("cell_name", None)
|
||||||
return metadata
|
return metadata
|
||||||
|
|
||||||
@cache.memoize(86400000)
|
@cache.memoize(864000)
|
||||||
def create_graph(self, df):
|
def create_graph(self, df):
|
||||||
"""
|
"""
|
||||||
Computes a n-d layout for cells through dimensionality reduction.
|
Computes a n-d layout for cells through dimensionality reduction.
|
||||||
@@ -117,7 +117,7 @@ class ScanpyEngine(CXGDriver):
|
|||||||
normalized_graph = (graph - graph.min()) / (graph.max() - graph.min())
|
normalized_graph = (graph - graph.min()) / (graph.max() - graph.min())
|
||||||
return np.hstack((df.obs["cell_name"].values.reshape(len(df.obs.index), 1), normalized_graph)).tolist()
|
return np.hstack((df.obs["cell_name"].values.reshape(len(df.obs.index), 1), normalized_graph)).tolist()
|
||||||
|
|
||||||
@cache.memoize(86400000)
|
@cache.memoize(864000)
|
||||||
def diffexp(self, cell_list_1, cell_list_2, pval, num_genes):
|
def diffexp(self, cell_list_1, cell_list_2, pval, num_genes):
|
||||||
"""
|
"""
|
||||||
Computes the top differentially expressed genes between two clusters
|
Computes the top differentially expressed genes between two clusters
|
||||||
@@ -164,7 +164,7 @@ class ScanpyEngine(CXGDriver):
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@cache.memoize(86400000)
|
@cache.memoize(864000)
|
||||||
def expression(self, cells=None, genes=None):
|
def expression(self, cells=None, genes=None):
|
||||||
"""
|
"""
|
||||||
Retrieves expression for each gene for cells in data frame
|
Retrieves expression for each gene for cells in data frame
|
||||||
|
|||||||
Reference in New Issue
Block a user