Skip to content

Commit

Permalink
Merge branch 'main' into visx_UMAP
Browse files Browse the repository at this point in the history
  • Loading branch information
mlacadie committed Oct 9, 2024
2 parents 74bbb79 + 60537c9 commit 07156f8
Show file tree
Hide file tree
Showing 14 changed files with 1,635 additions and 1,397 deletions.
5 changes: 3 additions & 2 deletions screen2.0/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"lint": "next lint",
"prettier": "prettier --write src",
"export": "next export",
"compile": "graphql-codegen",
"watch": "graphql-codegen -w"
"generate-types": "graphql-codegen",
"generate-types -w": "graphql-codegen -w"
},
"lint-staged": {
"linters": {
Expand Down Expand Up @@ -47,6 +47,7 @@
"@mui/lab": "^6.0.0-beta.10",
"@mui/material": "^6.1.1",
"@mui/material-nextjs": "^6.1.1",
"@parcel/watcher": "^2.4.1",
"@types/node": "^22.6.1",
"@types/react": "^18.3.8",
"@types/react-dom": "18.3.0",
Expand Down
120 changes: 120 additions & 0 deletions screen2.0/src/app/_utility/GeneLink.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
import { Divider, Stack, styled, Tooltip, TooltipProps, Typography, tooltipClasses, CircularProgress, IconOwnProps, TypographyProps, Grid2 } from '@mui/material'
import { gql } from '../../graphql/__generated__';
import { useLazyQuery } from '@apollo/client';
import { useMemo, Fragment, useState } from 'react';
import NextLink from 'next/link';
import { UrlObject } from 'url';
import { ArrowOutward, Tab } from '@mui/icons-material';

export interface GeneLinkProps {
geneName: string,
assembly: "GRCh38" | "mm10",
typographyProps?: TypographyProps
}

const GET_GENE_COORDS = gql(`
query getGeneLocation($name: String!, $assembly: String!) {
gene(name: [$name], assembly: $assembly, version: 40) {
coordinates {
chromosome
start
end
}
}
}
`)

const GeneLink = ({ geneName, assembly, typographyProps }: GeneLinkProps): React.JSX.Element => {
const [open, setOpen] = useState<boolean>(false)

const handleClose = () => {
setOpen(false);
};

const handleOpen = () => {
getGeneCoords()
setOpen(true);
};

const [getGeneCoords, { data: dataCoords, loading: loadingCoords, error: errorCoords, called: coordsWereFetched }] = useLazyQuery(
GET_GENE_COORDS,
{ variables: { name: geneName, assembly: assembly } }
)

const coordinates = dataCoords && dataCoords.gene.length > 0 && dataCoords.gene[0].coordinates

const geneExpressionLink = `/applets/gene-expression?assembly=${assembly}&gene=${geneName}`

const searchLink: UrlObject = useMemo(() => {
return coordinates ? (
{
pathname: '/search',
query: {
assembly,
chromosome: coordinates.chromosome,
start: coordinates.start,
end: coordinates.end,
gene: geneName
}
}) : null
}, [coordinates])

const StyledTypography = styled((props: TypographyProps) =>
<Typography variant='body2' display={"inline"} textAlign={"center"} color="white" {...props} />
)(() => ({
'&:hover': {
textDecoration: "underline"
}
}));

const iconProps: IconOwnProps = {
fontSize: 'small',
sx: { display: "inline-flex", verticalAlign: "middle", p: 0 }
}

const linkStyles = {
flexGrow: 1,
minWidth: '130px',
display: 'flex',
justifyContent: 'center'
}

return (
<Tooltip
open={open}
onOpen={handleOpen}
onClose={handleClose}
title={
<Fragment>
<Stack
direction={"row"}
gap={1}
justifyContent={"space-between"}
divider={<Divider orientation='vertical' flexItem sx={{ backgroundColor: 'white' }} />}
>
<NextLink href={geneExpressionLink} target='_blank' style={linkStyles}>
<StyledTypography>
View <i>{geneName}</i> Gene Expression
<ArrowOutward {...iconProps} />
</StyledTypography>
</NextLink>
{searchLink ?
<NextLink href={searchLink} target='_blank' style={linkStyles}>
<StyledTypography>
Search <i>{geneName}</i> on SCREEN
<ArrowOutward {...iconProps} />
</StyledTypography>
</NextLink>
:
<CircularProgress size={"2rem"} />
}
</Stack>
</Fragment>
}
>
<Typography variant='inherit' color='primary' {...typographyProps}><i>{geneName}</i></Typography>
</Tooltip>
)
}

export default GeneLink
3 changes: 2 additions & 1 deletion screen2.0/src/app/applets/gwas/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { ParentSizeProvidedProps } from "@visx/responsive/lib/components/ParentS
import { tissueColors } from "../../../common/lib/colors"
import { CancelRounded, Info } from "@mui/icons-material"
import { capitalizeFirstLetter } from "./helpers"
import GeneLink from "../../_utility/GeneLink"

//Colors for the accordions and background
const lighterBlue = "#4B56BD"
Expand Down Expand Up @@ -256,7 +257,7 @@ export default function GWAS() {
{
header: "Gene",
value: (row: TableRow) => row.gene,
render: (row: TableRow) => <i><CreateLink linkPrefix={"/applets/gene-expression?assembly=GRCh38&gene="} linkArg={row.gene} label={row.gene} underline={"none"} /></i>
render: (row: TableRow) => <GeneLink geneName={row.gene} assembly={'GRCh38'} />
},
]

Expand Down
2 changes: 1 addition & 1 deletion screen2.0/src/app/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function ResponsiveAppBar() {
const menuItem = (page, isSubPage = false) =>
<MenuItem key={page.pageName} onClick={handleCloseNavMenu_Hamburger} >
<Typography
pl={isSubPage && 2}
pl={isSubPage ? 2 : 0}
color={isSubPage && "rgba(0, 0, 0, 0.6)"}
component='a'
href={page.link}
Expand Down
32 changes: 24 additions & 8 deletions screen2.0/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
"use client"

import { Box, Stack, Typography } from "@mui/material"
import { Box, IconButton, Stack, Tooltip, Typography } from "@mui/material"
import { MainSearch } from "./_mainsearch/mainsearch"
import Grid from "@mui/material/Grid2"
import homeImage from "../../public/homeImage.png"
import Image from "next/image"
import humanTransparentIcon from "../../public/Transparent_HumanIcon.png"
import mouseTransparentIcon from "../../public/Transparent_MouseIcon.png"
import { Download } from "@mui/icons-material"
import Config from "../config.json"


export default function Home() {
Expand All @@ -26,7 +28,7 @@ export default function Home() {
<Typography variant="h5" mt={4}>
What is SCREEN?
</Typography>
<Typography paragraph>
<Typography>
SCREEN is a web interface for searching and visualizing the Registry of candidate cis-Regulatory Elements (cCREs) derived from
ENCODE data. The Registry contains 2,348,854 human cCREs in GRCh38 and 926,843 mouse cCREs in mm10, with homologous cCREs
cross-referenced across species. SCREEN presents the data that support biochemical activities of the cCREs and the expression of
Expand All @@ -38,22 +40,36 @@ export default function Home() {
<Grid style={{ display: "grid", gridTemplateColumns: 'auto auto auto' }} border={"1px solid LightGray"} maxWidth={'500px'}>
<Typography p={1} border={"1px solid LightGray"} >Genome Assembly</Typography>
<Typography p={1} border={"1px solid LightGray"} align="right">cCRE Count</Typography>
<Typography p={1} border={"1px solid LightGray"} align="right">Cell/Tissue Types Covered</Typography>
<Stack border={"1px solid LightGray"} direction="row" pl={1} >
<Typography p={1} border={"1px solid LightGray"} align="right">Cell/Tissue Types</Typography>
<Stack border={"1px solid LightGray"} direction="row" pl={1}>
<Box position={"relative"} minWidth={"30px"}>
<Image style={{ objectFit: "contain" }} src={humanTransparentIcon} alt={""} fill />
</Box>
<Typography p={1} align="left">Human (hg38)</Typography>
<Typography p={1} align="left" alignSelf={"center"}>Human (hg38)</Typography>
</Stack>
<Stack border={"1px solid LightGray"} direction={"row"} alignItems={"center"} justifyContent={"flex-end"}>
<Typography py={1} pl={1} pr={0}>2,348,854</Typography>
<Tooltip title="Download All Human cCREs (129.1 MB)" placement="right" arrow>
<IconButton href={Config.Downloads.HumanCCREs}>
<Download />
</IconButton>
</Tooltip>
</Stack>
<Typography p={1} border={"1px solid LightGray"} align="right">2,348,854</Typography>
<Typography p={1} border={"1px solid LightGray"} align="right">1,888</Typography>
<Stack border={"1px solid LightGray"} direction="row" pl={1} >
<Box position={"relative"} minWidth={"30px"}>
<Image style={{ objectFit: "contain" }} src={mouseTransparentIcon} alt={""} fill />
</Box>
<Typography p={1} align="left">Mouse (mm10)</Typography>
<Typography p={1} align="left" alignSelf={"center"}>Mouse (mm10)</Typography>
</Stack>
<Stack border={"1px solid LightGray"} direction={"row"} alignItems={"center"} justifyContent={"flex-end"}>
<Typography py={1} pl={1} pr={0}>926,843</Typography>
<Tooltip title="Download All Mouse cCREs (50.6 MB)" placement="right" arrow>
<IconButton href={Config.Downloads.MouseCCREs}>
<Download />
</IconButton>
</Tooltip>
</Stack>
<Typography p={1} border={"1px solid LightGray"} align="right">926,843</Typography>
<Typography p={1} border={"1px solid LightGray"} align="right">382</Typography>
</Grid>
</Grid>
Expand Down
6 changes: 3 additions & 3 deletions screen2.0/src/app/search/_ccredetails/ccredetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ export const CcreDetails: React.FC<CcreDetailsProps> = ({ accession, region, ass
<Typography variant="h6">{`${region.chrom}:${region.start.toLocaleString("en-US")}-${region.end.toLocaleString("en-US")}`}</Typography>
</Stack>
<Divider sx={{ mb: 2 }} />
{page === 0 &&
<InSpecificBiosamples accession={accession} assembly={assembly} />
{page === 0 && nearest3AndLinkedGenes &&
<InSpecificBiosamples accession={accession} assembly={assembly} distanceToTSS={nearest3AndLinkedGenes.nearbyGenes.sort((a,b)=>a.distanceToTSS-b.distanceToTSS)[0].distanceToTSS}/>
}
{(page === 1 && assembly !== "mm10") &&
(loadingLinkedGenes ?
Expand All @@ -164,7 +164,7 @@ export const CcreDetails: React.FC<CcreDetailsProps> = ({ accession, region, ass
errorNearbyAndLinked ?
<Typography>{`Issue fetching Linked Genes for ${accession}.`}</Typography>
:
<LinkedGenes linkedGenes={nearest3AndLinkedGenes?.linkedGenes || []} />)
<LinkedGenes linkedGenes={nearest3AndLinkedGenes?.linkedGenes || []} assembly={assembly} />)
}
{page === 2 && (
<NearByGenomicFeatures
Expand Down
83 changes: 49 additions & 34 deletions screen2.0/src/app/search/_ccredetails/inspecificbiosample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export type cCRERow = {
type InSpecificBiosamplesProps = {
accession: string,
assembly: "GRCh38" | "mm10",
distanceToTSS: number
}


Expand Down Expand Up @@ -166,7 +167,7 @@ const ctAgnosticColumns = () => [
]

//Cache is not working as expected when switching between open cCREs
export const InSpecificBiosamples: React.FC<InSpecificBiosamplesProps> = ({ accession, assembly }) => {
export const InSpecificBiosamples: React.FC<InSpecificBiosamplesProps> = ({ accession, assembly, distanceToTSS }) => {

const { data: data_toptissues, loading: loading_toptissues, error: error_toptissues } = useQuery(TOP_TISSUES,
{
Expand All @@ -190,6 +191,8 @@ export const InSpecificBiosamples: React.FC<InSpecificBiosamplesProps> = ({ acce
)


const distance = distanceToTSS


let partialDataCollection: cCRERow[], coreCollection: cCRERow[], ancillaryCollection: cCRERow[];
if (data_toptissues) {
Expand Down Expand Up @@ -277,45 +280,57 @@ export const InSpecificBiosamples: React.FC<InSpecificBiosamplesProps> = ({ acce
: -11.0,
}
})

let igroup = data_toptissues?.cCREQuery[0]?.group


let ccreCts = typedata.map((t) => {
let group = igroup
if (t.dnase <= 1.64 && t.dnase != -11.0) group = "ylowdnase"
if (igroup == "PLS") {
if (t.h3k4me3 > 1.64) group = "PLS"
if (t.h3k27ac > 1.64) group = "pELS"
let group
let tf = data_ccre_tf && data_ccre_tf.getcCRETFQuery.length>0 ? data_ccre_tf.getcCRETFQuery.find(a=> t.ct===a.celltype)?.tf.toString(): undefined

} else {
if (t.h3k27ac > 1.64) {
if (igroup === "pELS") {
group = "pELS"
} else {
group = "dELS"
if(t.dnase != -11.0)
{
if((t.dnase >= 1.64)) {
if(t.h3k4me3 >= 1.64) {
if(distance <= 200) {
group = "PLS" //Promoter-like signatures (promoter) must fall within 200 bp of a TSS and have high chromatin accessibility and H3K4me3 signals.
}
else if((t.h3k27ac < 1.64) && distance > 200) {
group = "CA-H3K4me3" //Chromatin accessibility + H3K4me3 (CA-H3K4me3) have high chromatin accessibility and H3K4me3 signals but low H3K27ac signals and do not fall within 200 bp of a TSS.
}
else if (distance <= 2000 && t.h3k27ac >= 1.64) {
group = "pELS" //Enhancer-like signatures (enhancer) have high chromatin accessibility and H3K27ac signals. Enhancers are further divided into TSS-proximal or distal with a 2 kb distance cutoff.
} else if(distance > 2000 && t.h3k27ac >= 1.64) {
group = "dELS" //Enhancer-like signatures (enhancer) have high chromatin accessibility and H3K27ac signals. Enhancers are further divided into TSS-proximal or distal with a 2 kb distance cutoff.
}
}
else if(t.h3k27ac >= 1.64) {
if(distance <= 2000) {
group ="pELS" //Enhancer-like signatures (enhancer) have high chromatin accessibility and H3K27ac signals. Enhancers are further divided into TSS-proximal or distal with a 2 kb distance cutoff.
} else if(distance > 2000) {
group = "dELS" //Enhancer-like signatures (enhancer) have high chromatin accessibility and H3K27ac signals. Enhancers are further divided into TSS-proximal or distal with a 2 kb distance cutoff.
}
}
else if(t.ctcf >= 1.64) {
group = "CA-CTCF" //Chromatin accessibility + CTCF (CA-CTCF) have high chromatin accessibility and CTCF signals but low H3K4me3 and H3K27ac signals.
}
else if(tf==='1') {
group = "CA-TF" //Chromatin accessibility + transcription factor (CA-TF) have high chromatin accessibility, low H3K4me3, H3K27ac, and CTCF signals and are bound by a transcription factor.
}
else {
group = "CA" //Chromatin accessibility (CA) have high chromatin accessibility, and low H3K4me3, H3K27ac, and CTCF signals.
}
}
}
if (t.h3k4me3 > 1.64) group = "CA-H3K4me3"
}
if (t.ctcf > 1.64) group = "ctcf"
if (-11.0 === t.dnase) group = "zunclassified"
if (t.dnase > 1.64) {
group = "dnase"
if (t.h3k27ac > 1.64) {
if (igroup === "pELS") {
group = "pELS"
} else if(igroup === "PLS") {
group = "PLS"
}
else {
group = "dELS"
else {
if(tf==='1'){
group = "TF" //Transcription factor (TF) have low chromatin accessibility, low H3K4me3, H3K27ac, and CTCF signals and are bound by a transcription factor.
} else {
group = "InActive" //low chromatin accessibility, low H3K4me3, H3K27ac, and CTCF signals and are NOT bound by a transcription factor.
}
}
}
} else {
group = "ylowdnase"
}


else {
group = "noclass" //If not active in DNase, No class assigned
}

let type: "core" | "partial" | "ancillary"

type = "ancillary"
Expand Down
Loading

0 comments on commit 07156f8

Please sign in to comment.