mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-07 04:48:11 +08:00
diff exp component based on cell selections
This commit is contained in:
@@ -4,11 +4,13 @@ import { connect } from "react-redux";
|
|||||||
import * as globals from "../../globals";
|
import * as globals from "../../globals";
|
||||||
import styles from "./expression.css";
|
import styles from "./expression.css";
|
||||||
import SectionHeader from "../framework/sectionHeader"
|
import SectionHeader from "../framework/sectionHeader"
|
||||||
|
import actions from "../../actions";
|
||||||
|
|
||||||
@connect((state) => {
|
@connect((state) => {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
expression: state.expression.data
|
expression: state.expression.data,
|
||||||
|
currentCellSelection: state.controls.currentCellSelection,
|
||||||
|
differential: state.differential
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
class Expression extends React.Component {
|
class Expression extends React.Component {
|
||||||
@@ -26,11 +28,71 @@ class Expression extends React.Component {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
set1() {
|
||||||
|
const set = [];
|
||||||
|
|
||||||
|
_.each(this.props.currentCellSelection, (cell) => {
|
||||||
|
if (cell["__selected__"]) {
|
||||||
|
set.push(cell.CellName)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
this.props.dispatch({
|
||||||
|
type: "store current cell selection as differential set 1",
|
||||||
|
data: set
|
||||||
|
})
|
||||||
|
}
|
||||||
|
set2() {
|
||||||
|
const set = [];
|
||||||
|
|
||||||
|
_.each(this.props.currentCellSelection, (cell) => {
|
||||||
|
if (cell["__selected__"]) {
|
||||||
|
set.push(cell.CellName)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
this.props.dispatch({
|
||||||
|
type: "store current cell selection as differential set 2",
|
||||||
|
data: set
|
||||||
|
})
|
||||||
|
}
|
||||||
|
computeDiffExp() {
|
||||||
|
this.props.dispatch(
|
||||||
|
actions.requestDifferentialExpression(
|
||||||
|
this.props.differential.celllist1,
|
||||||
|
this.props.differential.celllist2
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
render () {
|
render () {
|
||||||
if (!this.props.expression) return null
|
if (!this.props.expression) return null
|
||||||
|
|
||||||
|
console.log('expression render sees', this.props.differential)
|
||||||
return (
|
return (
|
||||||
<div style={{marginTop: 50}}>
|
<div style={{marginTop: 50}}>
|
||||||
<SectionHeader text="Expression"/>
|
<SectionHeader text="Differential Expression"/>
|
||||||
|
<div style={{marginBottom: 20}}>
|
||||||
|
<button onClick={this.set1.bind(this)}>
|
||||||
|
{
|
||||||
|
this.props.differential.celllist1 ?
|
||||||
|
this.props.differential.celllist1.length + " cells selected" :
|
||||||
|
"Store current cell selection as 'set 1'"
|
||||||
|
}
|
||||||
|
</button>
|
||||||
|
<button onClick={this.set2.bind(this)}>
|
||||||
|
{
|
||||||
|
this.props.differential.celllist2 ?
|
||||||
|
this.props.differential.celllist2.length + " cells selected" :
|
||||||
|
"Store current cell selection as 'set 2'"
|
||||||
|
}
|
||||||
|
</button>
|
||||||
|
<button onClick={this.computeDiffExp.bind(this)}>
|
||||||
|
Compute differential expression
|
||||||
|
</button>
|
||||||
|
Gene count:
|
||||||
|
<input placeholder={"Default is 5"}/>
|
||||||
|
</div>
|
||||||
|
<SectionHeader text="Color by expression"/>
|
||||||
{
|
{
|
||||||
_.map(this.props.expression.genes, (gene) => {
|
_.map(this.props.expression.genes, (gene) => {
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user