mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-08 20:18:11 +08:00
add genesets as an argument
This commit is contained in:
@@ -44,6 +44,7 @@ const LABEL_WIDTH_ANNO = LABEL_WIDTH - ANNO_BUTTON_WIDTH;
|
|||||||
schema,
|
schema,
|
||||||
crossfilter: state.obsCrossfilter,
|
crossfilter: state.obsCrossfilter,
|
||||||
isUserAnno,
|
isUserAnno,
|
||||||
|
genesets: state.genesets.genesets,
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
class Category extends React.PureComponent {
|
class Category extends React.PureComponent {
|
||||||
@@ -142,9 +143,15 @@ class Category extends React.PureComponent {
|
|||||||
*/
|
*/
|
||||||
const { schema } = annoMatrix;
|
const { schema } = annoMatrix;
|
||||||
const { colorAccessor, colorMode } = colors;
|
const { colorAccessor, colorMode } = colors;
|
||||||
|
const { genesets } = this.props;
|
||||||
let colorDataPromise = Promise.resolve(null);
|
let colorDataPromise = Promise.resolve(null);
|
||||||
if (colorAccessor) {
|
if (colorAccessor) {
|
||||||
const query = createColorQuery(colorMode, colorAccessor, schema);
|
const query = createColorQuery(
|
||||||
|
colorMode,
|
||||||
|
colorAccessor,
|
||||||
|
schema,
|
||||||
|
genesets
|
||||||
|
);
|
||||||
if (query) colorDataPromise = annoMatrix.fetch(...query);
|
if (query) colorDataPromise = annoMatrix.fetch(...query);
|
||||||
}
|
}
|
||||||
const [categoryData, colorData] = await Promise.all([
|
const [categoryData, colorData] = await Promise.all([
|
||||||
|
|||||||
@@ -106,16 +106,23 @@ const continuous = (selectorId, colorScale, colorAccessor) => {
|
|||||||
@connect((state) => ({
|
@connect((state) => ({
|
||||||
annoMatrix: state.annoMatrix,
|
annoMatrix: state.annoMatrix,
|
||||||
colors: state.colors,
|
colors: state.colors,
|
||||||
|
genesets: state.genesets.genesets,
|
||||||
}))
|
}))
|
||||||
class ContinuousLegend extends React.Component {
|
class ContinuousLegend extends React.Component {
|
||||||
async componentDidUpdate(prevProps) {
|
async componentDidUpdate(prevProps) {
|
||||||
const { annoMatrix, colors } = this.props;
|
const { annoMatrix, colors, genesets } = this.props;
|
||||||
if (!colors || !annoMatrix) return;
|
if (!colors || !annoMatrix) return;
|
||||||
|
|
||||||
if (colors !== prevProps?.colors || annoMatrix !== prevProps?.annoMatrix) {
|
if (colors !== prevProps?.colors || annoMatrix !== prevProps?.annoMatrix) {
|
||||||
const { schema } = annoMatrix;
|
const { schema } = annoMatrix;
|
||||||
const { colorMode, colorAccessor, userColors } = colors;
|
const { colorMode, colorAccessor, userColors } = colors;
|
||||||
const colorQuery = createColorQuery(colorMode, colorAccessor, schema);
|
const colorQuery = createColorQuery(
|
||||||
|
colorMode,
|
||||||
|
colorAccessor,
|
||||||
|
schema,
|
||||||
|
genesets
|
||||||
|
);
|
||||||
|
|
||||||
const colorDf = colorQuery ? await annoMatrix.fetch(...colorQuery) : null;
|
const colorDf = colorQuery ? await annoMatrix.fetch(...colorQuery) : null;
|
||||||
const colorTable = createColorTable(
|
const colorTable = createColorTable(
|
||||||
colorMode,
|
colorMode,
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ export default
|
|||||||
dilatedValue: state.pointDilation.categoryField,
|
dilatedValue: state.pointDilation.categoryField,
|
||||||
categoricalSelection: state.categoricalSelection,
|
categoricalSelection: state.categoricalSelection,
|
||||||
showLabels: state.centroidLabels?.showLabels,
|
showLabels: state.centroidLabels?.showLabels,
|
||||||
|
genesets: state.genesets.genesets,
|
||||||
}))
|
}))
|
||||||
class CentroidLabels extends PureComponent {
|
class CentroidLabels extends PureComponent {
|
||||||
static watchAsync(props, prevProps) {
|
static watchAsync(props, prevProps) {
|
||||||
@@ -74,10 +75,10 @@ class CentroidLabels extends PureComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
colorByQuery() {
|
colorByQuery() {
|
||||||
const { annoMatrix, colors } = this.props;
|
const { annoMatrix, colors, genesets } = this.props;
|
||||||
const { schema } = annoMatrix;
|
const { schema } = annoMatrix;
|
||||||
const { colorMode, colorAccessor } = colors;
|
const { colorMode, colorAccessor } = colors;
|
||||||
return createColorQuery(colorMode, colorAccessor, schema);
|
return createColorQuery(colorMode, colorAccessor, schema, genesets);
|
||||||
}
|
}
|
||||||
|
|
||||||
async fetchData() {
|
async fetchData() {
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ const getYScale = memoize(getScale);
|
|||||||
|
|
||||||
differential: state.differential,
|
differential: state.differential,
|
||||||
crossfilter,
|
crossfilter,
|
||||||
|
genesets: state.genesets.genesets,
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
class Scatterplot extends React.PureComponent {
|
class Scatterplot extends React.PureComponent {
|
||||||
@@ -313,10 +314,10 @@ class Scatterplot extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
createColorByQuery(colors) {
|
createColorByQuery(colors) {
|
||||||
const { annoMatrix } = this.props;
|
const { annoMatrix, genesets } = this.props;
|
||||||
const { schema } = annoMatrix;
|
const { schema } = annoMatrix;
|
||||||
const { colorMode, colorAccessor } = colors;
|
const { colorMode, colorAccessor } = colors;
|
||||||
return createColorQuery(colorMode, colorAccessor, schema);
|
return createColorQuery(colorMode, colorAccessor, schema, genesets);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateColorTable(colors, colorDf) {
|
updateColorTable(colors, colorDf) {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ given a color mode & accessor, generate an annoMatrix query that will
|
|||||||
fulfill it
|
fulfill it
|
||||||
*/
|
*/
|
||||||
export function createColorQuery(colorMode, colorByAccessor, schema, genesets) {
|
export function createColorQuery(colorMode, colorByAccessor, schema, genesets) {
|
||||||
if (!colorMode || !colorByAccessor || !schema) return null;
|
if (!colorMode || !colorByAccessor || !schema || !genesets) return null;
|
||||||
switch (colorMode) {
|
switch (colorMode) {
|
||||||
case "color by categorical metadata":
|
case "color by categorical metadata":
|
||||||
case "color by continuous metadata": {
|
case "color by continuous metadata": {
|
||||||
|
|||||||
Reference in New Issue
Block a user