mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-02 15:18:11 +08:00
feat: diffexp returns two genesets (#2230)
* feat: return two lists for diffexp (#2221) * sp * split out derive sort order, tests passing * sp * return diff exp results in two lists * update * copy implementation over to desktop * add tests for two lists * small fixes to complete backend implementation * accept new diffexp response * map diff exp response to genesets * delete ) * name diffexp genesets with population names * take constants out of state and allow width prop to override * shorten mini-histo properly truncate and resize depending on expansion * prepend new genesets * rename data within diffexp action * backend * move diffexp ttest to common code module, update tests * update for unit tests * reference actual var Co-authored-by: Madison Dunitz <madison.dunitz@chanzuckerberg.com> Co-authored-by: Madison Dunitz <dunitzm@gmail.com>
This commit is contained in:
co-authored by
Madison Dunitz
Madison Dunitz
parent
7ed53c0f5b
commit
28b526b3fc
@@ -96,12 +96,17 @@ const GeneSets = (
|
||||
if (state.genesets.has(genesetName))
|
||||
throw new Error("geneset: create -- name already defined.");
|
||||
|
||||
const genesets = new Map(state.genesets); // clone
|
||||
genesets.set(genesetName, {
|
||||
genesetName,
|
||||
genesetDescription,
|
||||
genes: new Map(),
|
||||
});
|
||||
const genesets = new Map([
|
||||
[
|
||||
genesetName,
|
||||
{
|
||||
genesetName,
|
||||
genesetDescription,
|
||||
genes: new Map(),
|
||||
},
|
||||
],
|
||||
...state.genesets,
|
||||
]); // clone and add new geneset to beginning
|
||||
|
||||
return {
|
||||
...state,
|
||||
@@ -357,23 +362,34 @@ const GeneSets = (
|
||||
case "request differential expression success": {
|
||||
const { data } = action;
|
||||
|
||||
const genes = new Map(
|
||||
data.map((diffExpGene) => [
|
||||
diffExpGene[0],
|
||||
const dateString = new Date().toLocaleString();
|
||||
|
||||
const genesetNames = {
|
||||
positive: `Pop1 high (${dateString})`,
|
||||
negative: `Pop2 high (${dateString})`,
|
||||
};
|
||||
|
||||
const diffExpGeneSets = [];
|
||||
for (const polarity of Object.keys(genesetNames)) {
|
||||
const genes = new Map(
|
||||
data[polarity].map((diffExpGene) => [
|
||||
diffExpGene[0],
|
||||
{
|
||||
geneSymbol: diffExpGene[0],
|
||||
},
|
||||
])
|
||||
);
|
||||
diffExpGeneSets.push([
|
||||
genesetNames[polarity],
|
||||
{
|
||||
geneSymbol: diffExpGene[0],
|
||||
genesetName: genesetNames[polarity],
|
||||
genesetDescription: "",
|
||||
genes,
|
||||
},
|
||||
])
|
||||
);
|
||||
]);
|
||||
}
|
||||
|
||||
const genesetName = `DiffExp Set (${new Date().toLocaleString()})`;
|
||||
|
||||
const genesets = new Map(state.genesets); // clone
|
||||
genesets.set(genesetName, {
|
||||
genesetName,
|
||||
genesetDescription: "",
|
||||
genes,
|
||||
});
|
||||
const genesets = new Map([...diffExpGeneSets, ...state.genesets]); // clone
|
||||
|
||||
return {
|
||||
...state,
|
||||
|
||||
Reference in New Issue
Block a user