Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 96 additions & 10 deletions screen2.0/src/app/search/_ccredetails/functionaldata.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,25 @@
import React from "react"
import { client } from "./client"
import { useQuery } from "@apollo/client"
import { FUNCTIONAL_DATA_QUERY, CCRE_RDHS_QUERY, MPRA_FUNCTIONAL_DATA_QUERY, CAPRA_SOLO_FUNCTIONAL_DATA_QUERY, CAPRA_DOUBLE_FUNCTIONAL_DATA_QUERY } from "./queries"
import { FUNCTIONAL_DATA_QUERY, CCRE_RDHS_QUERY, MPRA_FUNCTIONAL_DATA_QUERY, CAPRA_SOLO_FUNCTIONAL_DATA_QUERY, CAPRA_DOUBLE_FUNCTIONAL_DATA_QUERY, CRISPR_FUNCTIONAL_DATA_QUERY } from "./queries"
import Grid from "@mui/material/Grid2"
import { DataTable } from "@weng-lab/psychscreen-ui-components"
import { LoadingMessage, ErrorMessage, CreateLink } from "../../../common/lib/utility"
import { Link } from "@mui/material"

type ExperimentInfo = {
type CAPRA_ExperimentInfo = {
lab: string;
cellType: string;
};

type CRISPR_ExperimentInfo = {
lab: string;
cellType: string;
design: string;
};

// Define the map where experiment is the key
const capra_experimentMap: Record<string, ExperimentInfo> = {
const capra_experimentMap: Record<string, CAPRA_ExperimentInfo> = {
"ENCSR064KUD": { lab: "Kevin White, UChicago", cellType: "HCT116" },
"ENCSR135NXN": { lab: "Kevin White, UChicago", cellType: "HepG2" },
"ENCSR547SBZ": { lab: "Kevin White, UChicago", cellType: "MCF-7" },
Expand All @@ -24,6 +30,20 @@ const capra_experimentMap: Record<string, ExperimentInfo> = {
"ENCSR983SZZ": { lab: "Kevin White, UChicago", cellType: "SH-SY5Y" }
};

const crispr_experimentMap: Record<string, CRISPR_ExperimentInfo> = {
"ENCSR179FSH": { design: "proliferation CRISPRi screen (dCas9-KRAB)", lab: "Tim Reddy, Duke", cellType: "OCI-AML2" },
"ENCSR274OEB": { design: "proliferation CRISPRi screen (dCas9-KRAB)", lab: "Tim Reddy, Duke", cellType: "K562" },
"ENCSR295VER": { design: "roliferation CRISPRi screen (dCas9-KRAB-WSR7EEE)", lab: "Will Greenleaf, Stanford", cellType: "K562" },
"ENCSR369UFO": { design: "proliferation CRISPRi screen (dCas9-RYBP)", lab: "Will Greenleaf, Stanford", cellType: "K562" },
"ENCSR372CKT": { design: "proliferation CRISPRi screen (dCas9-ZNF705-KRAB)", lab: "Will Greenleaf, Stanford", cellType: "K562" },
"ENCSR381RDB": { design: "proliferation CRISPRi screen (dCas9-RYBP)", lab: "Will Greenleaf, Stanford", cellType: "K562" },
"ENCSR386FFV": { design: "proliferation CRISPRi screen (dCas9-KRAB-WSR7EEE)", lab: "Will Greenleaf, Stanford", cellType: "K562" },
"ENCSR427OCU": { design: "proliferation CRISPRi screen (dCas9-KRAB-MGA1-MGA2)", lab: "Will Greenleaf, Stanford", cellType: "K562" },
"ENCSR446RYW": { design: "proliferation CRISPRi screen (dCas9-KRAB)", lab: "Will Greenleaf, Stanford", cellType: "K562" },
"ENCSR690DTG": { design: "proliferation CRISPRi screen (dCas9-KRAB)", lab: "Tim Reddy, Duke", cellType: "K562" },
"ENCSR997ZOY": { design: "proliferation CRISPRi screen (dCas)", lab: "Will Greenleaf, Stanford", cellType: "K562" }
};

export const FunctionData = ({ coordinates , assembly, accession }) => {
const { loading, error, data } = useQuery(FUNCTIONAL_DATA_QUERY, {
variables: {
Expand All @@ -44,6 +64,15 @@ export const FunctionData = ({ coordinates , assembly, accession }) => {
nextFetchPolicy: "cache-first",
client,
})
const { loading: crispr_loading, error: crispr_error, data: crispr_data } = useQuery(CRISPR_FUNCTIONAL_DATA_QUERY, {
variables: {
accession: [accession],
},
skip: assembly === "mm10",
fetchPolicy: "cache-and-network",
nextFetchPolicy: "cache-first",
client,
})
const { loading: capra_loading, error: capra_error, data: capra_data } = useQuery(CAPRA_SOLO_FUNCTIONAL_DATA_QUERY, {
variables: {
accession: [accession],
Expand All @@ -53,6 +82,7 @@ export const FunctionData = ({ coordinates , assembly, accession }) => {
nextFetchPolicy: "cache-first",
client,
})

const { loading: capra_double_loading, error: capra_double_error, data: capra_double_data } = useQuery(CAPRA_DOUBLE_FUNCTIONAL_DATA_QUERY, {
variables: {
accession: [accession],
Expand All @@ -63,20 +93,20 @@ export const FunctionData = ({ coordinates , assembly, accession }) => {
client,
})


//CCRE_RDHS_QUERY
const { loading: capra_double_rdhs_loading, error: capra_double_rdhs_error, data: capra_double_rdhs_data } = useQuery(CCRE_RDHS_QUERY, {
variables: {
assembly: "GRCh38",
rDHS: [capra_double_data && capra_double_data.capraFccDoubleQuery.length>0 &&capra_double_data.capraFccDoubleQuery[0].rdhs_p1,capra_double_data && capra_double_data.capraFccDoubleQuery.length>0 && capra_double_data.capraFccDoubleQuery[0].rdhs_p2],
},
//capra_double_data.capraFccDoubleQuery[0].rdhs_p1,capra_double_data.capraFccDoubleQuery[0].rdhs_p2
skip: capra_double_data===undefined || !capra_double_data ,
rDHS: [capra_double_data && capra_double_data.capraFccDoubleQuery.length>0 && capra_double_data.capraFccDoubleQuery[0].rdhs_p1,capra_double_data && capra_double_data.capraFccDoubleQuery.length>0 && capra_double_data.capraFccDoubleQuery[0].rdhs_p2],
},
skip: capra_double_data===undefined || !capra_double_data || (capra_double_data && capra_double_data.capraFccDoubleQuery.length===0) ,
fetchPolicy: "cache-and-network",
nextFetchPolicy: "cache-first",
client,
})

return loading || mpra_loading || capra_loading || capra_double_loading || capra_double_rdhs_loading? (
return loading || mpra_loading || crispr_loading || capra_loading || capra_double_loading || capra_double_rdhs_loading? (
<LoadingMessage />
) : error ? (
<ErrorMessage error={error} />
Expand Down Expand Up @@ -262,10 +292,10 @@ export const FunctionData = ({ coordinates , assembly, accession }) => {
itemsPerPage={5}
/>
</Grid>}</>}
{ capra_double_error ? (
{ capra_double_error ? (
<ErrorMessage error={capra_double_error} />
) : <>
{assembly!=="mm10" &&<Grid
{assembly!=="mm10" && <Grid
size={{
xs: 12,
md: 12,
Expand Down Expand Up @@ -335,6 +365,62 @@ export const FunctionData = ({ coordinates , assembly, accession }) => {
itemsPerPage={5}
/>
</Grid>}</>}

{ crispr_error ? (
<ErrorMessage error={crispr_error} />
) : <>
{assembly!=="mm10" && <Grid
size={{
xs: 12,
md: 12,
lg: 12
}}>
<DataTable
tableTitle={`CRISPR perturbation data`}
columns={[
{
header: "Experiment",
value: (row) => row.experiment,
render: (row) => <CreateLink
linkPrefix="https://www.encodeproject.org/experiments/"
linkArg={row.experiment}
label={row.experiment}
showExternalIcon
underline="always"
/>
},
{
header: "Design",
value: (row) => crispr_experimentMap[row.experiment].design,
},
{
header: "Celltype",
value: (row) => crispr_experimentMap[row.experiment].cellType,
},
{
header: "Lab",
value: (row) => crispr_experimentMap[row.experiment].lab,
},
{
header: "Log2(Fold Change)",
HeaderRender: () => <>Log<sub>2</sub>(Fold Change)</>,
value: (row) => row.log2fc.toFixed(2),
},
{
header: "P",
value: (row) => !row.pvalue ? "n/a" : row.pvalue.toFixed(2),
HeaderRender: () => <i>P</i>,
},
{
header: "FDR",
value: (row) => !row.fdr ? "n/a" : row.fdr.toFixed(2),
}
]}
rows={crispr_data.crisprFccQuery || []}
sortColumn={4}
itemsPerPage={5}
/>
</Grid>}</>}
</Grid>
);
}
13 changes: 13 additions & 0 deletions screen2.0/src/app/search/_ccredetails/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,19 @@ query MPRA_FCC($coordinates: [GenomicRangeInput!]) {
}
}
`)

export const CRISPR_FUNCTIONAL_DATA_QUERY = gql(`
query crisprFccQuery($accession: [String]!) {
crisprFccQuery(accession: $accession) {
rdhs
log2fc
fdr
pvalue
experiment
}
}
`)

export const CAPRA_SOLO_FUNCTIONAL_DATA_QUERY = gql(`
query capraFccSoloQuery($accession: [String]!) {
capraFccSoloQuery(accession: $accession) {
Expand Down
6 changes: 6 additions & 0 deletions screen2.0/src/graphql/__generated__/gql.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading