Skip to content

Commit

Permalink
merged
Browse files Browse the repository at this point in the history
  • Loading branch information
andreassteffen committed Jan 27, 2023
2 parents 8a59344 + 1b97a12 commit 45e61fe
Show file tree
Hide file tree
Showing 18 changed files with 2,020 additions and 267 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
/.idea
**/.pybiomart.sqlite
**/__pycache__/
/.DS_Store
/.DS_Store
**/.$*
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ for CellO:
mkdir scratch/cello_resources
curl https://deweylab.biostat.wisc.edu/cell_type_classification/resources_v2.0.0.tar.gz >scratch/cello_resources/resources_v2.0.0.tar.gz
tar -C scratch/cello_resources -zxf scratch/cello_resources/resources_v2.0.0.tar.gz
````
```


```bash
Expand Down
1 change: 1 addition & 0 deletions cellenium_architecture.drawio
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<mxfile host="Electron" modified="2023-01-26T09:30:07.634Z" agent="5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/20.7.4 Chrome/106.0.5249.199 Electron/21.3.3 Safari/537.36" version="20.7.4" etag="ZFWJRapDufXhwsbdNX54" type="device"><diagram id="5oOviqtw5uLLyDU2DDvS" name="Page-1">5Vrbcts2EP0azaQP1pCgeHu0JbtJJ+6osTtpnjoQCYmISYIBQUvK13eXF4kgqVhxLXvUPglcLpYgzsHBYqmRNU02v0qaRbciZPGIGOFmZM1GhJjEtuEHLdvGYtWWleRhZTP2hjv+ndWOjbXgIctrW2VSQsSKZ7oxEGnKAqXZqJRirbstRRxqhoyumDYMNNwFNGY9t888VFFl9Yi7t79nfBU1TzYdv7qT0Ma5DpxHNBTrlsm6HllTKYSqWslmymKcPX1ebg7c3Q1MslQd08Gg9vZr9m3jU+NGuO+/r+efyUUd5ZHGRf3CN1KkiqXhiDgjYgEM1lWreb/NYHYkz1TL+In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O3stZ/ZPE/lzZbGG2NiHy3zvtuWeXNsmO4by7x1FjJv6RS1TX/cSRCOFXrHMfVQpBPogNADS+i25ZahQ354yL7dOU24pLMsqogvuos0ZcPWwuG1Zhn1aY0PHQqqAykumBKrJQMeBdgOS+F7y8yI6InRE6vlBReGd+TCsN5yYeyOnruF0ZHkY5fFrk5bB5p0D1Inzn/Mfil2LTmm5QZNU6Ga4sO0T16Qe4mHrnL3rQg74PXn7eW8KoD09ojxePxiHLdsT9sbfM87luk/RXQMcsJdwT0H8vueXiVwredx3zQsPRDpBDo198mBdOcEucqRqcoFnkBN/Ujq2E9x8sSpyrGk/L+nKi/Gy349vKxuvx0tDZ2ROiHN12ckOQeZdEiHRs+UScfV47yySPYLsO/v7+dvwMYX5M+Bg/nr8IK4+mdXYvrPI4bVOerscsnXoka/ptt8dzPK4m6ZGk5H+28jkDBeZK1aff1FLtx94DP2xyYJoXIlqSrr8vWn2Fv6wJblZ9gO/RTbKJ1w0Fc8sCmcvVCAUpFi/Qf6xh3TkwWfhIdhWTwa+v6i03oJh727elBNcvGvPo0Z3Tr+pI7RLhG5AyWiiX+YlgdKRCP8E0bzt5CKI/t/11jX/wA=</diagram></mxfile>
Binary file added cellenium_architecture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 19 additions & 2 deletions client/src/atoms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import {
AllGenesDocument,
AllGenesQuery,
AllGenesQueryVariables,
CellOAnnotationGroupIdDocument,
CellOAnnotationGroupIdQuery,
CellOAnnotationGroupIdQueryVariables,
OmicsGeneFragment,
StudyBasicsDocument,
StudyBasicsFragment,
Expand Down Expand Up @@ -35,12 +38,12 @@ export const userGenesState = atom<Omics[]>({
default: []
})

export const celltypeDiscoveryGenesState = atom<(Omics|null)[]>({
export const celltypeDiscoveryGenesState = atom<(Omics | null)[]>({
key: "celltypeDiscoveryGenesState",
default: [null, null]
})

export const celltypeDiscoveryCoexpressionSamplesState = atom<(number[]|null)[]>({
export const celltypeDiscoveryCoexpressionSamplesState = atom<(number[] | null)[]>({
key: "celltypeDiscoveryCoexpressionSamplesState",
default: [null]
})
Expand Down Expand Up @@ -191,3 +194,17 @@ export const allGenesState = selector<Map<number, OmicsGeneFragment> | undefined
}
}
});


export const cellOAnnotationGroupIdState = selector<number | undefined>({
key: "cellOAnnotationGroupIdState",
get: async ({get}) => {
const annotationGroupIdData = await apolloClient.query<CellOAnnotationGroupIdQuery, CellOAnnotationGroupIdQueryVariables>({
query: CellOAnnotationGroupIdDocument,
fetchPolicy: 'no-cache'
});
if (annotationGroupIdData?.data) {
return annotationGroupIdData.data.annotationGroupsList[0].annotationGroupId;
}
}
});
68 changes: 68 additions & 0 deletions client/src/components/ExpressionDotPlot/ExpressionDotPlot.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import React, {useEffect, useMemo, useState} from 'react';
import {VegaLite, View, VisualizationSpec} from "react-vega";
import {DotPlotElementFragment} from "../../generated/types";
import {ScenegraphEvent} from "vega";


function createSpec(annotationTitle: string, xAxis: "studyName" | "displaySymbol") {
return {
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"data": {"name": "table"},
"mark": {"type": "point", "filled": true},
"encoding": {
"y": {
"field": "annotationDisplayValue",
"type": "ordinal",
"title": annotationTitle
},
"x": xAxis === "studyName" ? {
"field": "studyName", "type": "nominal", "title": "Study",
} : {
"field": "displaySymbol", "type": "nominal", "title": "Gene",
},
"size": {
"field": "exprCellsFraction",
"type": "quantitative",
"title": "Expr. fraction"
},
"color": {
"field": "q3",
"type": "quantitative",
"scale": {"scheme": "viridis", reverse: true}
}

}
} as VisualizationSpec;
}

export function ExpressionDotPlot({
data,
annotationTitle,
xAxis,
onClick
}:
{
data: DotPlotElementFragment[],
annotationTitle: string,
xAxis: "studyName" | "displaySymbol",
onClick?: (dotPlotElement: DotPlotElementFragment, event: ScenegraphEvent) => void
}) {
const spec = useMemo(() => createSpec(annotationTitle, xAxis), [annotationTitle, xAxis]);

const setUpSelectionListener = (view: View) => {
view.addEventListener("click", (event, item) => {
if (item && onClick) {
const dotPlotElement = item.datum as DotPlotElementFragment;
onClick(dotPlotElement, event);
}
});
};

return <VegaLite
spec={spec}
onNewView={(view) => setUpSelectionListener(view)}
data={{
"table": data
}}/>
}

Loading

0 comments on commit 45e61fe

Please sign in to comment.