diff exp component based on cell selections

This commit is contained in:
Colin Megill
2017-12-29 00:16:18 -08:00
parent 8f590e5167
commit 8d4728166d
+65 -3
View File
@@ -4,11 +4,13 @@ import { connect } from "react-redux";
import * as globals from "../../globals";
import styles from "./expression.css";
import SectionHeader from "../framework/sectionHeader"
import actions from "../../actions";
@connect((state) => {
return {
expression: state.expression.data
expression: state.expression.data,
currentCellSelection: state.controls.currentCellSelection,
differential: state.differential
}
})
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 () {
if (!this.props.expression) return null
console.log('expression render sees', this.props.differential)
return (
<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) => {
return (