Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Miscfeatures #120

Merged
merged 10 commits into from
Sep 6, 2023
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
11 changes: 11 additions & 0 deletions screen2.0/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,17 @@ const nextConfig = {
trailingSlash: false,
assetPrefix: assetPrefix,
basePath: basePath,

webpack: (config, { isServer }) => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

genome browser package uses "fs" default file system module of nodejs. Hence I was getting Module not found error. Added below code in next config to resolve this error. Reference (https://stackoverflow.com/questions/64926174/module-not-found-cant-resolve-fs-in-next-js-application)

if (!isServer) {
// don't resolve 'fs' module on the client to prevent this error on build --> Error: Can't resolve 'fs'
config.resolve.fallback = {
fs: false
}
}

return config;
}
}

module.exports = nextConfig
11 changes: 7 additions & 4 deletions screen2.0/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
"@emotion/styled": "^11.11.0",
"@mui/icons-material": "^5.14.3",
"@mui/lab": "^5.0.0-alpha.137",
"@mui/material": "^5.14.2",
"@types/node": "^20.5.0",
"@types/react": "^18.2.20",
"@mui/material": "^5.14.2",
"@types/node": "^20.4.9",
"@types/react": "^18.2.19",
"@types/react-dom": "18.2.7",
"@weng-lab/psychscreen-ui-components": "^0.8.0-a.2",
"@weng-lab/ts-ztable": "^4.0.1",
Expand All @@ -56,13 +56,16 @@
"normalize.css": "^8.0.1",
"only": "^0.0.2",
"postcss": "8.4.27",
"queryz": "^0.0.3",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-dropzone": "^14.2.3",
"server": "^1.0.38",
"sharp": "^0.32.4",
"tailwindcss": "3.3.3",
"typescript": "5.1.6"
"typescript": "5.1.6",
"umms-gb": "^3.9.13",
"uuid": "^9.0.0"
},
"devDependencies": {
"file-loader": "^6.2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Grid2 from "@mui/material/Unstable_Grid2/Grid2"
import { gene } from "./types"
import { QueryResponse } from "../../../../types/types"
import { Dispatch, SetStateAction } from "react"

import Config from "../../../config.json"
const GENE_AUTOCOMPLETE_QUERY = `
query ($assembly: String!, $name_prefix: [String!], $limit: Int) {
gene(assembly: $assembly, name_prefix: $name_prefix, limit: $limit) {
Expand Down Expand Up @@ -66,7 +66,7 @@ export default function GeneAutoComplete(props: {
// gene list
const onSearchChange = async (value: string) => {
setOptions([])
const response = await fetch("https://ga.staging.wenglab.org/graphql", {
const response = await fetch(Config.API.GraphqlAPI, {
method: "POST",
body: JSON.stringify({
query: GENE_AUTOCOMPLETE_QUERY,
Expand Down
3 changes: 2 additions & 1 deletion screen2.0/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

"use client"
import { Typography } from "@mui/material"
import MainSearch from "../common/components/MainSearch"

import MainSearch from "../common/components/mainsearch/MainSearch"

// Grid v2 isn't declared stable yet, but using it now as it's what MUI is currently developing out
import Grid2 from "@mui/material/Unstable_Grid2/Grid2"
Expand Down
3 changes: 2 additions & 1 deletion screen2.0/src/app/search/ccredetails/client.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ApolloClient, InMemoryCache } from "@apollo/client"
import Config from "../../../config.json"
export const client = new ApolloClient({
uri: "https://factorbook.api.wenglab.org/graphql",
uri: Config.API.CcreAPI,
cache: new InMemoryCache(),
})
36 changes: 26 additions & 10 deletions screen2.0/src/app/search/ccresearch.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
"use client"
import React, { useEffect } from "react"
import React, { useEffect, useState } from "react"
import { Tab, Tabs, Typography } from "@mui/material"
import MainResultsTable from "../../common/components/MainResultsTable"
import MainResultsFilters from "../../common/components/MainResultsFilters"
import { CcreDetails } from "./ccredetails/ccredetails"
import Grid2 from "../../common/mui-client-wrappers/Grid2"
import { ReadonlyURLSearchParams, useSearchParams } from "next/navigation"
import styled from "@emotion/styled"
import { GenomeBrowserView } from "./gbview/genomebrowserview"
import { MainResultTableRows } from "./types"
export const StyledTab = styled(Tab)(() => ({
textTransform: "none",
}))
export const CcreSearch = (props: { mainQueryParams, ccrerows: MainResultTableRows, globals, assembly }) => {
const searchParams: ReadonlyURLSearchParams = useSearchParams()!
const [value, setValue] = React.useState(searchParams.get("accession") ? 1 : 0)

const [value, setValue] = useState(searchParams.get("accession") ? 1 : 0)
const [tabIndex, setTabIndex] = useState(0)
const handleChange = (_, newValue: number) => {
setValue(newValue)
}
Expand Down Expand Up @@ -45,13 +46,28 @@ export const CcreSearch = (props: { mainQueryParams, ccrerows: MainResultTableRo
<MainResultsFilters mainQueryParams={props.mainQueryParams} byCellType={props.globals} />
</Grid2>
<Grid2 xs={12} lg={9}>
<MainResultsTable
rows={props.ccrerows}
tableTitle={`Searching ${props.mainQueryParams.chromosome} in ${
props.mainQueryParams.assembly
} from ${props.mainQueryParams.start.toLocaleString("en-US")} to ${props.mainQueryParams.end.toLocaleString("en-US")}`}
itemsPerPage={10}
/>
<Tabs aria-label="basic tabs example" value={tabIndex} onChange={(_, val) => setTabIndex(val)}>
<StyledTab label="Table View" />
<StyledTab label="Genome Browser View" />

</Tabs>
{tabIndex === 1 && (
<GenomeBrowserView
gene={props.mainQueryParams.gene}
biosample={props.mainQueryParams.Biosample.biosample}
assembly={props.mainQueryParams.assembly}
coordinates={{ start: +props.mainQueryParams.start, end: +props.mainQueryParams.end, chromosome: props.mainQueryParams.chromosome }}
/>
)}
{tabIndex === 0 && (
<MainResultsTable
rows={props.ccrerows}
tableTitle={`Searching ${props.mainQueryParams.chromosome} in ${
props.mainQueryParams.assembly
} from ${props.mainQueryParams.start.toLocaleString("en-US")} to ${props.mainQueryParams.end.toLocaleString("en-US")}`}
itemsPerPage={10}
/>
)}
</Grid2>
</Grid2>
)}
Expand Down
Loading
Loading