Skip to content

Commit 62f6d8d

Browse files
committed
Merge branch 'Bug-Fixes' of https://github.com/weng-lab/SCREEN2.0 into Bug-Fixes
2 parents 17e1624 + 620a62d commit 62f6d8d

13 files changed

+5802
-8091
lines changed

screen2.0/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
},
3737
"dependencies": {
3838
"@apollo/client": "alpha",
39+
"bpnet-ui": "^0.2.9",
3940
"@apollo/experimental-nextjs-app-support": "^0.4.3",
4041
"@emotion/react": "^11.11.1",
4142
"@emotion/styled": "^11.11.0",
@@ -64,8 +65,9 @@
6465
"sharp": "^0.32.4",
6566
"tailwindcss": "3.3.5",
6667
"typescript": "5.2.2",
67-
"umms-gb": "^3.9.13",
68-
"uuid": "^9.0.0"
68+
"umms-gb": "^3.10.0",
69+
"uuid": "^9.0.0",
70+
"logots-react": "latest"
6971
},
7072
"devDependencies": {
7173
"file-loader": "^6.2.0",

screen2.0/src/app/search/ccredetails/ccredetails.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { TfIntersection } from "./tfintersection"
1010
import { FunctionData } from "./functionaldata"
1111
import Rampage from "./rampage"
1212
import { GeneExpression } from "./gene-expression"
13+
import { TfSequenceFeatures} from "../gbview/tfsequencefeatures"
1314

1415
//Passing these props through this file could be done with context to reduce prop drilling
1516
type CcreDetailsProps = {
@@ -22,6 +23,7 @@ type CcreDetailsProps = {
2223
}
2324

2425
export const CcreDetails: React.FC<CcreDetailsProps> = ({ accession, region, globals, assembly, genes, page }) => {
26+
console.log("region", region)
2527
return (
2628
<>
2729
<Stack direction="row" justifyContent={"space-between"} alignItems={"baseline"}>
@@ -52,10 +54,11 @@ export const CcreDetails: React.FC<CcreDetailsProps> = ({ accession, region, glo
5254
}}
5355
/>
5456
)}
55-
{page === 5 && <Ortholog accession={accession} assembly={assembly} />}
56-
{page === 6 && <Rampage gene={genes.distancePC[0].name} />}
57-
{page === 7 && <GeneExpression assembly={assembly} genes={genes} />}
58-
{page === 8 && <FunctionData accession={accession} coordinates={{ chromosome: region.chrom, start: +region.start.toString().replace(/\D/g, ""), end: +region.end.toString().replace(/\D/g, "") }} assembly={assembly} />}
57+
{page === 4 && <Ortholog accession={accession} assembly={assembly} />}
58+
{page === 5 && <GeneExpression assembly={assembly} genes={genes} />}
59+
{page === 6 && <FunctionData accession={accession} coordinates={{ chromosome: region.chrom, start: +region.start.toString().replace(/\D/g, ""), end: +region.end.toString().replace(/\D/g, "") }} assembly={assembly} />}
60+
{assembly!=="mm10" && page === 7 && <TfSequenceFeatures assembly={assembly} coordinates = {{ chromosome: region.chrom, start: +(region.start.replace(/\D/g, "")), end: +(region.end.replace(/\D/g, "")) }} />}
61+
{assembly!=="mm10" && page === 8 && <Rampage gene={genes.distancePC[0].name} />}
5962
</>
6063
)
6164
}

screen2.0/src/app/search/ccredetails/gene-expression.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { client } from "./client"
1212
import { HUMAN_GENE_EXP, MOUSE_GENE_EXP } from "../../applets/gene-expression/const"
1313
import { LinkedGenesData } from "../types"
1414
import { GENE_EXP_QUERY, GENE_QUERY } from "../../applets/gene-expression/queries"
15-
import { Download } from "@mui/icons-material"
15+
1616

1717
//Replace this when Gene Autocomplete extracted into componenet
1818
import GeneAutoComplete from "../../applets/gene-expression/gene-autocomplete"

screen2.0/src/app/search/ccredetails/linkedgenes.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { client } from "./client"
44
import { useQuery } from "@apollo/client"
55
import { LINKED_GENES, GENE_NAME } from "./queries"
66
import Grid2 from "@mui/material/Unstable_Grid2/Grid2"
7-
import { CircularProgress } from "@mui/material"
87
import { DataTable } from "@weng-lab/psychscreen-ui-components"
98
import { LoadingMessage, createLink } from "../../../common/lib/utility"
109

screen2.0/src/app/search/ccredetails/nearbygenomicfeatures.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { client } from "./client"
44
import { useQuery } from "@apollo/client"
55
import { NEARBY_GENOMIC_FEATURES_QUERY, NEARBY_GENOMIC_FEATURES_NOSNPS_QUERY } from "./queries"
66
import Grid2 from "@mui/material/Unstable_Grid2/Grid2"
7-
import { CircularProgress, Typography } from "@mui/material"
7+
import { Typography } from "@mui/material"
88
import { DataTable } from "@weng-lab/psychscreen-ui-components"
99
import { LoadingMessage, createLink } from "../../../common/lib/utility"
1010
import { usePathname, useRouter, useSearchParams } from "next/navigation"

screen2.0/src/app/search/ccredetails/rampage.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use client"
22
import React, { useState, useEffect } from "react"
33
import Grid2 from "@mui/material/Unstable_Grid2/Grid2"
4-
import { LoadingMessage, ErrorMessage } from "../../../common/lib/utility"
4+
import { LoadingMessage } from "../../../common/lib/utility"
55
import {
66
AppBar,
77
Box,
@@ -18,7 +18,6 @@ import {
1818
Typography,
1919
} from "@mui/material"
2020
import Config from "../../../config.json"
21-
import { Range2D } from "jubilant-carnival"
2221
import { PlotActivityProfiles } from "./utils"
2322
import Image from "next/image"
2423
import { defaultTheme } from "../../../common/lib/themes"

screen2.0/src/app/search/ccredetails/tfintersection.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { client } from "./client"
55
import { useQuery } from "@apollo/client"
66
import { TF_INTERSECTION_QUERY, CRE_TF_DCC_QUERY } from "./queries"
77
import Grid2 from "@mui/material/Unstable_Grid2/Grid2"
8-
import { CircularProgress } from "@mui/material"
98
import { DataTable } from "@weng-lab/psychscreen-ui-components"
109
import { LoadingMessage } from "../../../common/lib/utility"
1110

@@ -116,7 +115,7 @@ export const TfIntersection: React.FC<{ assembly: string; coordinates: { chromos
116115
setFactor(row.name)
117116
setFactorHighlight(row)
118117
}}
119-
sortColumn={0}
118+
sortColumn={1}
120119
itemsPerPage={5}
121120
highlighted={factorHighlight}
122121
/>

screen2.0/src/app/search/ccredetails/utils.tsx

Lines changed: 34 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,20 @@
11
"use client"
22
import React, { useState } from "react"
3-
import { Accordion, AccordionDetails, AccordionSummary } from "@mui/material"
43
import {
54
Box,
6-
Button,
75
FormControl,
8-
FormControlLabel,
96
InputLabel,
107
MenuItem,
118
Select,
12-
SelectChangeEvent,
13-
Switch,
14-
Typography,
9+
SelectChangeEvent
1510
} from "@mui/material"
1611
import { Point2D, Range2D, linearTransform2D } from "jubilant-carnival"
1712
import { Fragment } from "react"
18-
import ExpandMoreIcon from "@mui/icons-material/ExpandMore"
1913
import Grid2 from "@mui/material/Unstable_Grid2/Grid2"
2014
import { GeneExpEntry } from "../../applets/gene-expression/types"
2115
import { tissueColors } from "../../../common/lib/colors"
2216
import { RampagePeak } from "./rampage"
17+
import { Stack } from "@mui/material"
2318

2419
export const stringToColour = (str: string) => {
2520
let hash = 0;
@@ -47,9 +42,6 @@ export function PlotActivityProfiles(props: {
4742
peakID: string
4843
}) {
4944
const [sort, setSort] = useState<string>("byValue")
50-
const [zeros, setZeros] = useState<boolean>(false)
51-
const [collapse, setCollapse] = useState<{ [id: string]: boolean }>({})
52-
5345
let tissues: { [id: string]: { sum: number; values: GeneExpEntry[] } } = {} // dict of ftissues
5446
let byValueTissues: { [id: string]: { sum: number; values: GeneExpEntry[] } } = {} // dict of ftissues
5547
let byTissueMaxTissues: { [id: string]: { sum: number; values: GeneExpEntry[] } } = {} // dict of ftissues
@@ -59,7 +51,7 @@ export function PlotActivityProfiles(props: {
5951

6052

6153
Object.values(props.data).map((biosample) => {
62-
if (!zeros && biosample["value"] === 0) return
54+
if (biosample["value"] === 0) return
6355
else if (biosample["peakId"] === props.peakID) {
6456
if (!tissues[biosample["tissue"]]) tissues[biosample["tissue"]] = { sum: 0, values: [] }
6557
tissues[biosample["tissue"]].sum += biosample["value"]
@@ -91,30 +83,49 @@ export function PlotActivityProfiles(props: {
9183
return (
9284
<Fragment key={i}>
9385
<rect
94-
x={90}
95-
width={p1.x + 90}
86+
x={150}
87+
width={p1.x + 150}
9688
y={y + i * 20}
9789
height={18}
9890
fill={item.color}
9991
onMouseOver={() => {
10092
{
101-
;<rect x={90} width={p1.x + 90} y={y + i * 20} height={18} fill="white" />
93+
;<rect x={150} width={p1.x + 150} y={y + i * 20} height={18} fill="white" />
10294
}
10395
}}
10496
>
10597
<title>
106-
<rect x={90} width={p1.x + 90} y={y + i * 20} height={18} fill="white" />
98+
<rect x={150} width={p1.x + 150} y={y + i * 20} height={18} fill="white" />
10799
{item.value.toFixed(2)} {" " + item.biosample_term}
108100
{" (" + item.strand + ")"}
109101
</title>
110102
</rect>
111-
<text x={p1.x + 40 + 150} y={y + i * 20 + 12.5} style={{ fontSize: 12 }}>
103+
<text x={p1.x + 40 + 270} y={y + i * 20 + 12.5} style={{ fontSize: 12 }}>
112104
{Number(item.value.toFixed(2)) + " "}
113105
<a href={"https://www.encodeproject.org/experiments/" + item.expID}>{item.expID}</a>
114106
{" " + item.biosample_term}
115107
{" (" + item.strand + ")"}
116108
</text>
117-
<line x1={90} x2={90} y1={y + i * 20} y2={y + (i * 20 + 18)} stroke="black" />
109+
{(sort === 'byValue' || sort === 'byTissueMax') &&
110+
<text
111+
text-anchor="end"
112+
x={140}
113+
y={y + (i * 20 + 15)}
114+
>
115+
{entry[0].split("-")[0]}
116+
</text>
117+
}
118+
{sort=== 'byTissue' && i === Math.floor(Object.values(info.values).length / 2) &&
119+
<text
120+
text-anchor="end"
121+
x={140}
122+
// If the tissue has an even number of values, bump up a little
123+
y={y + (i * 20 + 15) - (((Object.values(info.values).length % 2) !== 0) ? 0 : 12)}
124+
>
125+
{entry[0].split("-")[0]}
126+
</text>
127+
}
128+
<line x1={150} x2={150} y1={y + i * 20} y2={y + (i * 20 + 18)} stroke="black" />
118129
</Fragment>
119130
)
120131
})
@@ -169,91 +180,25 @@ const tissueValues = sort==="byValue" ? byValueTissues: sort==="byTissueMax" ? b
169180
</FormControl>
170181
</Box>
171182
</Grid2>
172-
<Grid2 xs={3} sx={{ alignItems: "right", justifyContent: "right", display: "flex", ml: 0, mr: 0, mt: 2 }}>
173-
<Button
174-
onClick={() => {
175-
let c: { [id: string]: boolean } = {}
176-
let uncollapse: boolean = true
177-
if (Object.keys(collapse).length !== 0) {
178-
Object.keys(collapse).map((b: string) => {
179-
if (collapse[b]) uncollapse = false
180-
c[b] = false
181-
})
182-
183-
if (uncollapse) {
184-
Object.keys(collapse).map((b: string) => {
185-
c[b] = true
186-
})
187-
}
188-
} else
189-
Object.keys(tissueValues).map((b: string) => {
190-
c[b] = false
191-
})
192-
setCollapse(c)
193-
}}
194-
>
195-
Collapse All
196-
</Button>
197-
<Box ml={5}>
198-
<FormControl key={sort}>
199-
<FormControlLabel
200-
control={
201-
<Switch
202-
checked={zeros}
203-
onChange={() => {
204-
if (zeros) setZeros(false)
205-
else setZeros(true)
206-
}}
207-
/>
208-
}
209-
label="display 0's"
210-
/>
211-
</FormControl>
212-
</Box>
213-
</Grid2>
214183
{/* rampage plot */}
215184
<Grid2 xs={12}>
216185
<Box>
186+
{Object.keys(tissueValues).length === 0 ? <span>{'No Data Available'}</span> :
187+
<Stack>
217188
{Object.entries(tissueValues).map((entry, index: number) => {
218189
let info = entry[1]
219190
y += info.values.length * 20 + 20 + 25
220-
let view: string = "0 0 1200 " + (info.values.length * 20 + 20)
191+
let view: string = "0 0 1200 " + (info.values.length * 20 +10)
221192
return (
222-
<Accordion
223-
key={index}
224-
expanded={Object.keys(collapse).length !== 0 ? collapse[entry[0]] : true}
225-
disableGutters={true}
226-
sx={{ padding: 0, mr: 0 }}
227-
>
228-
<AccordionSummary
229-
expandIcon={<ExpandMoreIcon />}
230-
sx={{ padding: 0, margin: 0 }}
231-
onClick={() => {
232-
let tmp: { [id: string]: boolean } = {}
233-
Object.entries(tissueValues).map((x) => {
234-
if (x[0] === entry[0]) {
235-
if (collapse[entry[0]] === undefined || collapse[entry[0]]) tmp[entry[0]] = false
236-
else tmp[entry[0]] = true
237-
} else {
238-
tmp[x[0]] = collapse[x[0]] !== undefined ? collapse[x[0]] : true
239-
}
240-
})
241-
setCollapse(tmp)
242-
}}
243-
>
244-
<Typography variant="h5">{entry[0].split("-")[0]}</Typography>
245-
</AccordionSummary>
246-
<AccordionDetails sx={{ padding: 0 }}>
247-
<svg className="graph" aria-labelledby="title desc" role="img" viewBox={view}>
193+
<svg className="graph" aria-labelledby="title desc" role="img" viewBox={view} key={index}>
248194
<g className="data" data-setname="gene expression plot">
249-
<line x1={0} x2={900} y1={1} y2={1} stroke="black" />
195+
250196
{plotGeneExp(entry, 5)}
251197
</g>
252198
</svg>
253-
</AccordionDetails>
254-
</Accordion>
255199
)
256200
})}
201+
</Stack>}
257202
</Box>
258203
</Grid2>
259204
</Box>

screen2.0/src/app/search/ccresearch.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use client"
2-
import React, { startTransition, useCallback, useEffect, useLayoutEffect, useState } from "react"
2+
import React, { startTransition, useCallback, useEffect, useState } from "react"
33
import { styled } from '@mui/material/styles';
4-
import { Divider, IconButton, Tab, Tabs, Typography, Box, Stack } from "@mui/material"
4+
import { Divider, IconButton, Tab, Tabs, Typography, Box } from "@mui/material"
55
import MainResultsTable from "../../common/components/MainResultsTable"
66
import MainResultsFilters from "../../common/components/MainResultsFilters"
77
import { CcreDetails } from "./ccredetails/ccredetails"
@@ -301,11 +301,16 @@ export const CcreSearch = (props: { mainQueryParams: MainQueryParams, globals })
301301
<StyledTab label="Linked Genes" sx={{ alignSelf: "start" }} />
302302
<StyledTab label="Nearby Genomic Features" sx={{ alignSelf: "start" }} />
303303
<StyledTab label="TF and His-mod Intersection" sx={{ alignSelf: "start" }} />
304-
<StyledTab label="TF Motifs and Sequence Features" sx={{ alignSelf: "start" }} />
304+
{ /*
305+
//Disabling this feature (temporary)
306+
<StyledTab label="TF Motifs and Sequence Features" sx={{ alignSelf: "start" }} />
307+
*/}
305308
<StyledTab label="Linked cCREs in other Assemblies" sx={{ alignSelf: "start" }} />
306-
<StyledTab label="Associated RAMPAGE Signal" sx={{ alignSelf: "start" }} />
309+
307310
<StyledTab label="Associated Gene Expression" sx={{ alignSelf: "start" }} />
308311
<StyledTab label="Functional Data" sx={{ alignSelf: "start" }} />
312+
{props.mainQueryParams.assembly!=="mm10" && <StyledTab label="TF Motifs" sx={{ alignSelf: "start" }} />}
313+
{props.mainQueryParams.assembly!=="mm10" && <StyledTab label="Associated RAMPAGE Signal" sx={{ alignSelf: "start" }} />}
309314
</Tabs>
310315
}
311316
</Drawer>

screen2.0/src/app/search/gbview/genomebrowserview.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ export const GenomeBrowserView: React.FC<GenomeBrowserViewProps> = (props) => {
182182
<Grid2 container spacing={3} sx={{ mt: "1rem", mb: "1rem" }}>
183183
<Grid2 xs={12} lg={12}>
184184
<br />
185-
<CytobandView innerWidth={1000} height={15} chromosome={coordinates.chromosome!} assembly={"hg38"} position={coordinates} />
185+
<CytobandView innerWidth={1000} height={15} chromosome={coordinates.chromosome!} assembly={props.assembly!=="mm10" ?"hg38" : "mm10"} position={coordinates} />
186186
<br />
187187
<div style={{ textAlign: "center" }}>
188188
<Controls onDomainChanged={onDomainChanged} domain={coordinates || props.coordinates} />

screen2.0/src/app/search/gbview/tfmotiftrack.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ export const TfMotifTrack = (props) => {
2727

2828
return (
2929
<g>
30-
<EmptyTrack height={40} width={props.width || 1400} text="TF Motif Occurences" transform="" id="" />
30+
<EmptyTrack height={40} width={props.width || 1000} text="TF Motif Occurences" transform="" id="" />
3131
<SquishBigBed
3232
domain={props.coordinates}
3333
svgRef={props.svgRef}
34-
width={1000}
34+
width={props.width}
3535
rowHeight={20}
3636
onHeightChanged={(x) => {
3737
setHeight(x + 40)
@@ -52,7 +52,7 @@ export const TfMotifTrack = (props) => {
5252
}}
5353
/>
5454
{settingsMousedOver && (
55-
<rect width={props.width || 1400} height={height} transform="translate(0,0)" fill="#194023" fillOpacity={0.1} />
55+
<rect width={props.width || 1000} height={height} transform="translate(0,0)" fill="#194023" fillOpacity={0.1} />
5656
)}
5757
<rect transform="translate(0,0)" height={height} width={40} fill="#ffffff" />
5858
<rect

0 commit comments

Comments
 (0)