-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2dcb451
commit d922f41
Showing
30 changed files
with
2,079 additions
and
1,142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
"use client"; | ||
|
||
import { useContext, useEffect, useState } from "react"; | ||
import RDKitContext from "../../../context/RDKitContext"; | ||
import LigandContext from "../../../context/LigandContext"; | ||
|
||
import "@react-sigma/core/lib/react-sigma.min.css"; | ||
import { scaffold_net_chunking_method } from "../../../components/utils/rdkit_loader"; | ||
import Loader from "../../../components/ui-comps/Loader"; | ||
import ScaffoldNetworkWholeGraph from "../../../components/tools/toolComp/ScaffoldNetworkWholeGraph"; | ||
import loadGraphFromScaffNet from "../../../components/utils/loadGraphFromScaffNet"; | ||
import TabWrapper, { | ||
Tabs, | ||
} from "../../../components/ui-comps/TabbedComponents"; | ||
import ScaffNetDets from "../../../components/tools/toolComp/ScaffNetDets"; | ||
|
||
export default function DisplayGraph() { | ||
const { rdkit } = useContext(RDKitContext); | ||
const { ligand } = useContext(LigandContext); | ||
const [loaded, setLoaded] = useState(false); | ||
const [graph, setGraph] = useState<any>(); | ||
|
||
useEffect(() => { | ||
setLoaded(false); | ||
setTimeout(() => { | ||
let smiles_list = ligand.map((x) => x.canonical_smiles); | ||
const network = scaffold_net_chunking_method(smiles_list, 50, rdkit); | ||
const graph = loadGraphFromScaffNet(network, smiles_list); | ||
setGraph(graph); | ||
setLoaded(true); | ||
}, 80); | ||
}, []); | ||
|
||
if (!loaded) { | ||
return ( | ||
<div className="tools-container"> | ||
<Loader loadingText="Networking is hard..." /> | ||
</div> | ||
); | ||
} | ||
|
||
return ( | ||
<div className="tools-container"> | ||
<TabWrapper> | ||
<Tabs title="Scaffold Details"> | ||
<ScaffNetDets graph={graph} /> | ||
</Tabs> | ||
<Tabs title="Whole Network"> | ||
<ScaffoldNetworkWholeGraph graph={graph} /> | ||
</Tabs> | ||
</TabWrapper> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.