Skip to content

Commit

Permalink
Fix tracks
Browse files Browse the repository at this point in the history
  • Loading branch information
jpfisher72 committed Apr 26, 2024
1 parent 599f6ec commit 1d8f847
Show file tree
Hide file tree
Showing 8 changed files with 233 additions and 185 deletions.
6 changes: 3 additions & 3 deletions immuscreen/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "screen2.0",
"name": "igscreen",
"version": "0.1.0",
"private": true,
"scripts": {
Expand Down Expand Up @@ -68,7 +68,7 @@
"eslint": "8.47.0",
"eslint-config-next": "13.4.19",
"graphql": "^16.7.1",
"jubilant-carnival": "^0.2.8",
"jubilant-carnival": "^0.6.0",
"logojs-react": "^2.1.1",
"next": "14.1.0",
"normalize.css": "^8.0.1",
Expand All @@ -84,7 +84,7 @@
"tailwindcss": "3.3.3",
"typescript": "5.1.6",
"umap-js": "^1.3.3",
"umms-gb": "^3.9.13",
"umms-gb": "^3.10.0",
"uuid": "^9.0.1"
},
"devDependencies": {
Expand Down
5 changes: 5 additions & 0 deletions immuscreen/src/app/celllineage/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { cellTypeStaticInfo } from "../../common/consts";
import { CellDisplayName, CellLineageTreeState, CellName, CellQueryValue, CellTypeStaticInfo } from "./types";


/**
*
* @todo these functions should be moved out of the celllineage directory and into common probably
*/
export const getCellColor = (cell: CellName | CellQueryValue | CellDisplayName): string => {
return Object.values(cellTypeStaticInfo).find((x: CellTypeStaticInfo) => x.id === cell || x.displayName === cell || extractQueryValues(x, "B").includes(cell as CellQueryValue))?.color ?? "#000000"
}
Expand Down
1 change: 0 additions & 1 deletion immuscreen/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ const Home = () => {
<Select
id="portal-select"
value={selectedPortal}
// defaultValue={10}
onChange={handleChange}
>
<MenuItem value={"Genes"}>Genes</MenuItem>
Expand Down
4 changes: 2 additions & 2 deletions immuscreen/src/common/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @todo the cell info in this file and in celllineage/utils.ts need to be combined
*/

import { CellName, CellTypeStaticInfo } from "../app/celllineage/types"
import { CellDisplayName, CellName, CellTypeStaticInfo } from "../app/celllineage/types"

export const cellTypeStaticInfo: { [key in CellName]: CellTypeStaticInfo } = {
Monocytes: {
Expand Down Expand Up @@ -529,7 +529,7 @@ export const experimentInfo: { [key: string]: {order: number, description: strin
'1020-CD34_Cord_Blood-SRX1427814': { order: 1, description: 'CD34+ Cord Blood in donor 1020', displayName: 'CD34+ Cord Blood', group: 'Progenitors', study: 'Corces et al', pmid: '27526324' },
'7291-CD34_Bone_Marrow-SRX1427812': { order: 2, description: 'CD34+ Bone Marrow in donor 7291', displayName: 'CD34+ Bone Marrow', group: 'Progenitors', study: 'Corces et al', pmid: '27526324' },
'7292-CD34_Bone_Marrow-SRX1427813': { order: 3, description: 'CD34+ Bone Marrow in donor 7292', displayName: 'CD34+ Bone Marrow', group: 'Progenitors', study: 'Corces et al', pmid: '27526324' },
'2596-HSC-SRX1427829': { order: 4, description: 'Hematopoetic Stem Cells in donor 2596', displayName: 'Hematopoetic Stem Cells', group: 'Progenitors', study: 'Corces et al', pmid: '27526324' },
'2596-HSC-SRX1427829': { order: 4, description: 'Hematopoetic Stem Cells in donor 2596', displayName: 'Hematopoetic stem ells', group: 'Progenitors', study: 'Corces et al', pmid: '27526324' },
'2596-HSC-SRX1427830': { order: 5, description: 'Hematopoetic Stem Cells in donor 2596', displayName: 'Hematopoetic Stem Cells', group: 'Progenitors', study: 'Corces et al', pmid: '27526324' },
'4983-HSC-SRX1427789': { order: 6, description: 'Hematopoetic Stem Cells in donor 4983', displayName: 'Hematopoetic Stem Cells', group: 'Progenitors', study: 'Corces et al', pmid: '27526324' },
'6792-HSC-SRX1427800': { order: 7, description: 'Hematopoetic Stem Cells in donor 6792', displayName: 'Hematopoetic Stem Cells', group: 'Progenitors', study: 'Corces et al', pmid: '27526324' },
Expand Down
15 changes: 12 additions & 3 deletions immuscreen/src/common/gbview/bulkatactracks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { client } from "../utils"
import BulkAtacTrackModal from "./bulkatacmodal";
import { BulkAtacCelltypeTrack, CalderonCellTypesMetadata } from "./consts";
import { CellQueryValue } from "../../app/celllineage/types";
import { getCellDisplayName } from "../../app/celllineage/utils";
import { getCellColor, getCellDisplayName } from "../../app/celllineage/utils";

export const DEFAULT_TRACKS = (
assembly: string
Expand Down Expand Up @@ -162,6 +162,7 @@ export const TitledTrack: React.FC<{
//tooltipContent={(rect) => <CCRETooltip {...rect} assembly="grch38" />}
/>
) : (
// This is the bulk atac
<FullBigWig
transform="translate(0,40)"
width={1400}
Expand All @@ -179,10 +180,15 @@ export const TitledTrack: React.FC<{

const BulkAtacTracks: React.FC<BulkAtacTrackProps> = (props: BulkAtacTrackProps) => {

const defaultTracks: [string, string][] = props.defaultcelltypes?.map((cell: CellQueryValue) => [getCellDisplayName(cell, true, true), `https://downloads.wenglab.org/${cell}.bigWig`]) || []
const bulkAtacColors: {[key:string]: string} = {}

const defaultTracks: [string, string][] = props.defaultcelltypes?.map((cell: CellQueryValue) => {
bulkAtacColors[getCellDisplayName(cell, true, true)] = getCellColor(cell)
return [getCellDisplayName(cell, true, true), `https://downloads.wenglab.org/${cell}.bigWig`]
}) || []

defaultTracks.sort()
defaultTracks.unshift(["All Immune Cells (Aggregate Signal)", "https://downloads.wenglab.org/all_immune.bigWig"])
console.log(defaultTracks)

//Why is this this not working when you have a lot of tracks? Why did my changes matter?
const [cTracks, setTracks] = useState<[string, string][]>(defaultTracks);
Expand Down Expand Up @@ -213,6 +219,7 @@ export const TitledTrack: React.FC<{
<EmptyTrack width={1400} height={40} transform="" id="" text="Loading..." />
) : (
<>
{/* Need to add all cell types to this */}
<BulkAtacTrackModal
open={settingsModalShown}
onCancel={() => setSettingsModalShown(false)}
Expand All @@ -235,6 +242,8 @@ export const TitledTrack: React.FC<{
svgRef={props.svgRef}
data={data.data}
transform={`translate(0,${i * 70})`}
//Need to add the color here
color={bulkAtacColors[cTracks[i][0]]}
/>
))}
<g className="tf-motifs">
Expand Down
Loading

0 comments on commit 1d8f847

Please sign in to comment.