diff --git a/app/tools/ml/layout.tsx b/app/tools/ml/layout.tsx index d2fad66..44f13dc 100644 --- a/app/tools/ml/layout.tsx +++ b/app/tools/ml/layout.tsx @@ -1,6 +1,6 @@ "use client" -import { createContext, useContext, useEffect, useState } from "react"; +import { createContext, useContext, useEffect, useRef, useState } from "react"; import GroupedBarChart from "../../../components/tools/toolViz/BarChart"; import Scatterplot from "../../../components/tools/toolViz/ScatterPlot"; import { round } from "mathjs"; @@ -29,6 +29,13 @@ export default function MLLayout({ children }) { const [oneOffSMILESResult, setOneOffSmilesResult] = useState(); const { pyodide } = useContext(PyodideContext); + const inputRef = useRef(null); + useEffect(() => { + if (inputRef.current) { + inputRef.current.value = oneOffSMILES; + } + }, [oneOffSMILES]); + const { ligand } = useContext(LigandContext); globalThis.neg_log_activity_column = ligand.map((obj) => obj[target.activity_columns[0]]); @@ -62,7 +69,7 @@ export default function MLLayout({ children }) {  

Predict the activity of a single molecule

- setOneOffSmiles(e.target.value)} placeholder="Input Your SMILES string here"> + setOneOffSmiles(e.target.value)} placeholder="Input Your SMILES string here">
setOneOffSmiles(smiles)} id="jsme_comp_1" /> diff --git a/app/tools/screen/page.tsx b/app/tools/screen/page.tsx index 296f113..f35db53 100644 --- a/app/tools/screen/page.tsx +++ b/app/tools/screen/page.tsx @@ -32,7 +32,7 @@ export default function Screen() { Download Predictions in CSV Format   - +
} diff --git a/app/tools/toc/page.tsx b/app/tools/toc/page.tsx index a2480d8..1a64b75 100644 --- a/app/tools/toc/page.tsx +++ b/app/tools/toc/page.tsx @@ -1,6 +1,6 @@ "use client" -import { useContext, useState } from "react"; +import { useContext, useEffect, useRef, useState } from "react"; import Table from "../../../components/ui-comps/PaginatedTables"; import LigandContext from "../../../context/LigandContext"; import { usePapaParse } from 'react-papaparse'; @@ -15,11 +15,17 @@ export default function TOC() { const { target } = useContext(TargetContext); const { jsonToCSV } = usePapaParse(); const { rdkit } = useContext(RDKitContext); - + const inputRef = useRef(null); const [searchSmi, setSearchSmi] = useState(''); const [searchRes, setSearchRes] = useState(ligand); + useEffect(() => { + if (inputRef.current) { + inputRef.current.value = searchSmi; + } + }, [searchSmi]); + const results = jsonToCSV(ligand, { delimiter: ';' }); function downloadCSV(csv: any) { @@ -56,7 +62,7 @@ export default function TOC() {

- setSearchSmi(e.target.value)}/> + setSearchSmi(e.target.value)}/>   setSearchSmi(smiles)} id="jsme_comp_2" />