mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-09-24 14:58:12 +08:00
lodash cleanup (#747)
* add own range() function * lodash cleanup * remove redundant fill range implementations * remove use of _.get * sync test babel config with build * update tests to match new range implementation
This commit is contained in:
committed by
Colin Megill
parent
c12cb2424a
commit
846b8d15bd
@@ -1,6 +1,5 @@
|
||||
// jshint esversion: 6
|
||||
import React from "react";
|
||||
import _ from "lodash";
|
||||
import { connect } from "react-redux";
|
||||
import * as d3 from "d3";
|
||||
|
||||
@@ -17,9 +16,7 @@ class Occupancy extends React.Component {
|
||||
const width = 100;
|
||||
const height = 11;
|
||||
|
||||
const categories = _.filter(schema.annotations.obs, {
|
||||
name: colorAccessor
|
||||
})[0].categories;
|
||||
const categories = schema.annotations.obsByName[colorAccessor]?.categories;
|
||||
|
||||
const x = d3
|
||||
.scaleLinear()
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
// return sorted index
|
||||
|
||||
import isNumber from "is-number";
|
||||
import _ from "lodash";
|
||||
|
||||
const sortedCategoryValues = values => {
|
||||
/* this sort could be memoized for perf */
|
||||
@@ -13,7 +12,7 @@ const sortedCategoryValues = values => {
|
||||
const strings = [];
|
||||
const ints = [];
|
||||
|
||||
_.forEach(values, v => {
|
||||
values.forEach(v => {
|
||||
if (isNumber(v[0])) {
|
||||
ints.push(v);
|
||||
} else {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// jshint esversion: 6
|
||||
import { connect } from "react-redux";
|
||||
import React from "react";
|
||||
import _ from "lodash";
|
||||
import Occupancy from "./occupancy";
|
||||
import { countCategoryValues2D } from "../../util/stateManager/worldUtil";
|
||||
import * as globals from "../../globals";
|
||||
@@ -10,7 +9,7 @@ import * as globals from "../../globals";
|
||||
categoricalSelection: state.categoricalSelection,
|
||||
colorScale: state.colors.scale,
|
||||
colorAccessor: state.colors.colorAccessor,
|
||||
schema: _.get(state.world, "schema", null),
|
||||
schema: state.world?.schema,
|
||||
world: state.world
|
||||
}))
|
||||
class CategoryValue extends React.Component {
|
||||
@@ -60,9 +59,7 @@ class CategoryValue extends React.Component {
|
||||
let occupancy = null;
|
||||
|
||||
if (isColorBy && schema) {
|
||||
categories = _.filter(schema.annotations.obs, {
|
||||
name: colorAccessor
|
||||
})[0].categories;
|
||||
categories = schema.annotations.obsByName[colorAccessor]?.categories;
|
||||
}
|
||||
|
||||
if (colorAccessor && !isColorBy && categoricalSelection[colorAccessor]) {
|
||||
|
||||
@@ -9,10 +9,10 @@ import * as globals from "../../globals";
|
||||
import HistogramBrush from "../brushableHistogram";
|
||||
|
||||
@connect(state => ({
|
||||
obsAnnotations: _.get(state.world, "obsAnnotations", null),
|
||||
obsAnnotations: state.world?.obsAnnotations,
|
||||
colorAccessor: state.colors.colorAccessor,
|
||||
colorScale: state.colors.scale,
|
||||
schema: _.get(state.world, "schema", null)
|
||||
schema: state.world?.schema
|
||||
}))
|
||||
class Continuous extends React.Component {
|
||||
constructor(props) {
|
||||
|
||||
@@ -57,7 +57,7 @@ const filterGenes = (query, genes) =>
|
||||
|
||||
@connect(state => {
|
||||
return {
|
||||
obsAnnotations: _.get(state.world, "obsAnnotations", null),
|
||||
obsAnnotations: state.world?.obsAnnotations,
|
||||
userDefinedGenes: state.controls.userDefinedGenes,
|
||||
userDefinedGenesLoading: state.controls.userDefinedGenesLoading,
|
||||
world: state.world,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// jshint esversion: 6
|
||||
import _ from "lodash";
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import Categorical from "./categorical/categorical";
|
||||
@@ -10,7 +9,7 @@ import DynamicScatterplot from "./scatterplot/scatterplot";
|
||||
|
||||
@connect(state => ({
|
||||
responsive: state.responsive,
|
||||
datasetTitle: _.get(state.config, "displayNames.dataset"),
|
||||
datasetTitle: state.config?.displayNames?.dataset,
|
||||
scatterplotXXaccessor: state.controls.scatterplotXXaccessor,
|
||||
scatterplotYYaccessor: state.controls.scatterplotYYaccessor
|
||||
}))
|
||||
|
||||
Reference in New Issue
Block a user