Skip to content

Commit

Permalink
EBI Assoc. -> GWAS Variants/Trait Assoc.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpfisher72 committed Apr 24, 2024
1 parent 420d399 commit a040604
Show file tree
Hide file tree
Showing 2 changed files with 117 additions and 125 deletions.
Binary file modified immuscreen/public/igSCREEN.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
242 changes: 117 additions & 125 deletions immuscreen/src/app/snp/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client"
import React, {useState} from "react"
import React, { useState } from "react"
import { DataTable } from "@weng-lab/psychscreen-ui-components"
import { Tabs, Typography } from "@mui/material"
import { Tabs, Typography } from "@mui/material"
import { client } from "../../common/utils"
import Grid2 from "@mui/material/Unstable_Grid2/Grid2"
import { ReadonlyURLSearchParams, useSearchParams, usePathname } from "next/navigation"
Expand All @@ -28,7 +28,7 @@ const EQTL_QUERY = gql`
}
`
const EBI_ASSO_QUERY = gql`
const EBI_ASSO_QUERY = gql`
query ebiAssoc($snpid: String)
{
ebiAssociationsQuery(snpid:$snpid) {
Expand All @@ -54,19 +54,19 @@ query ebiAssoc($snpid: String)

//Need better text styling

const Snp = () =>{
const searchParams: ReadonlyURLSearchParams = useSearchParams()!
const [value, setValue] = useState(0)
const {loading: ebiloading, data: ebidata} = useQuery(EBI_ASSO_QUERY,{
variables: {
snpid: searchParams.get("rsid")
},
skip: !searchParams.get("rsid"),
fetchPolicy: "cache-and-network",
nextFetchPolicy: "cache-first",
client,
})
console.log(searchParams.get("rsid"))
const Snp = () => {
const searchParams: ReadonlyURLSearchParams = useSearchParams()!
const [value, setValue] = useState(0)
const { loading: ebiloading, data: ebidata } = useQuery(EBI_ASSO_QUERY, {
variables: {
snpid: searchParams.get("rsid")
},
skip: !searchParams.get("rsid"),
fetchPolicy: "cache-and-network",
nextFetchPolicy: "cache-first",
client,
})
console.log(searchParams.get("rsid"))
const handleChange = (_, newValue: number) => {
setValue(newValue)
}
Expand All @@ -84,118 +84,110 @@ const Snp = () =>{
return !searchParams.get("rsid") ? (<main>

<Grid2 container spacing={6} sx={{ mr: "auto", ml: "auto", mt: "3rem" }}>
<Grid2 xs={6} sx={{ mt: "5em", ml:"2em"}}>
<Typography variant="h3">SNP Portal</Typography>
<br/>
<br/>
<br/>
<SnpAutoComplete textColor={"black"} assembly={"GRCh38"} />
</Grid2>

</Grid2>

</main>) : (
<Grid2 xs={6} sx={{ mt: "5em", ml: "2em" }}>
<Typography variant="h3">SNP Portal</Typography>
<br />
<br />
<br />
<SnpAutoComplete textColor={"black"} assembly={"GRCh38"} />
</Grid2>
</Grid2>
</main>) : (
<main>
<Grid2 container spacing={4} sx={{ maxWidth: "70%", mr: "auto", ml: "auto", mt: "3rem" }}>
<Grid2 xs={12} lg={12}>
{searchParams.get("rsid") && <Typography variant="h4">SNP Details: {searchParams.get("rsid")}</Typography>}

<Tabs aria-label="snps_tabs" value={value} onChange={handleChange}>
<StyledTab label="eQTLs" />
<StyledTab label="EBI Associations" />
</Tabs>

{value===0 && !loading && data &&
<Grid2 container>
<Grid2 xs={12} lg={12}>
<DataTable
columns={[
{
header: "Gene Id",
value: (row) => row.geneid || "",

},
{
header: "P-Value",
value: (row) => row.pvalue && row.pvalue.toExponential(2) || 0 ,
},
{
header: "Q-Value",
value: (row) => row.qvalue && row.qvalue.toExponential(2) || 0,
},
{
header: "Celltype",
value: (row) => row.celltype || "",

}

]}
tableTitle={`Yazar.Powell eQTLs have been identified for ${searchParams.get('rsid')}:`}
rows={data.icreeQTLQuery || []}
itemsPerPage={10}
/>
</Grid2>
</Grid2>}
{value===1&& ebidata &&
<Grid2 container>
<Grid2 xs={12} lg={12}>
<DataTable
columns={[
{
header: "Chromosome",
value: (row) => row.chromosome,
},
{
header: "Position",
value: (row) => row.position,
},
{
header: "Strongest snp risk allele",
value: (row) => row.strongest_snp_risk_allele,
},
{
header: "Risk Allele Frequency",
value: (row) => row.risk_allele_frequency,

},
{
header: "P-Value",
value: (row) => row.p_value && row.p_value.toExponential(2) || 0,
},
{
header: "Study",
value: (row) => row.study,
},
{
header: "Region",
value: (row) => row.region,
},
{
header:"Immu screen trait",
value: (row) => row.immu_screen_trait
},
{
header:"mapped_trait",
value: (row) => row.mapped_trait
},
{
header: "Pubmed Id",
value: (row) => row.pubmedid

}

]}
tableTitle={`EBI Associations for ${searchParams.get('rsid')}:`}
rows={ebidata.ebiAssociationsQuery || []}

sortColumn={3}
itemsPerPage={10}
/>
</Grid2>
</Grid2>
}
<Grid2 xs={12} lg={12}>
{searchParams.get("rsid") && <Typography variant="h4">SNP Details: {searchParams.get("rsid")}</Typography>}
<Tabs aria-label="snps_tabs" value={value} onChange={handleChange}>
<StyledTab label="eQTLs" />
<StyledTab label="GWAS Variants" />
</Tabs>

{value === 0 && !loading && data &&
<Grid2 container>
<Grid2 xs={12} lg={12}>
<DataTable
columns={[
{
header: "Gene Id",
value: (row) => row.geneid || "",
},
{
header: "P-Value",
value: (row) => row.pvalue && row.pvalue.toExponential(2) || 0,
},
{
header: "Q-Value",
value: (row) => row.qvalue && row.qvalue.toExponential(2) || 0,
},
{
header: "Celltype",
value: (row) => row.celltype || "",
}
]}
tableTitle={`Yazar.Powell eQTLs have been identified for ${searchParams.get('rsid')}:`}
rows={data.icreeQTLQuery || []}
itemsPerPage={10}
/>
</Grid2>
</Grid2>}
{value === 1 && ebidata &&
<Grid2 container>
<Grid2 xs={12} lg={12}>
<DataTable
columns={[
{
header: "Chromosome",
value: (row) => row.chromosome,
},
{
header: "Position",
value: (row) => row.position,
},
{
header: "Strongest snp risk allele",
value: (row) => row.strongest_snp_risk_allele,
},
{
header: "Risk Allele Frequency",
value: (row) => row.risk_allele_frequency,

},
{
header: "P-Value",
value: (row) => row.p_value && row.p_value.toExponential(2) || 0,
},
{
header: "Study",
value: (row) => row.study,
},
{
header: "Region",
value: (row) => row.region,
},
{
header: "Immu screen trait",
value: (row) => row.immu_screen_trait
},
{
header: "mapped_trait",
value: (row) => row.mapped_trait
},
{
header: "Pubmed Id",
value: (row) => row.pubmedid
}
]}
tableTitle={`Trait Associations for ${searchParams.get('rsid')}:`}
rows={ebidata.ebiAssociationsQuery || []}

sortColumn={3}
itemsPerPage={10}
/>
</Grid2>
</Grid2>
}
</Grid2>

</Grid2>
</main>
)
Expand Down

0 comments on commit a040604

Please sign in to comment.