diff --git a/plugins/linear-genome-view/src/LinearGenomeView/components/ImportForm.tsx b/plugins/linear-genome-view/src/LinearGenomeView/components/ImportForm.tsx index 7a0b510f59..b053dd4939 100644 --- a/plugins/linear-genome-view/src/LinearGenomeView/components/ImportForm.tsx +++ b/plugins/linear-genome-view/src/LinearGenomeView/components/ImportForm.tsx @@ -101,6 +101,10 @@ const ImportForm = observer(({ model }: { model: LGV }) => { const [ref, rest] = location.split(':') const allRefs = assembly?.allRefNames || [] try { + // instead of querying text-index, first: + // - check if input matches a refname directly + // - or looks like locstring + // then just navigate as if it were a locstring if ( allRefs.includes(location) || (allRefs.includes(ref) && diff --git a/plugins/linear-genome-view/src/LinearGenomeView/components/SearchBox.tsx b/plugins/linear-genome-view/src/LinearGenomeView/components/SearchBox.tsx index d3b803d8ae..8858c67ef7 100644 --- a/plugins/linear-genome-view/src/LinearGenomeView/components/SearchBox.tsx +++ b/plugins/linear-genome-view/src/LinearGenomeView/components/SearchBox.tsx @@ -58,20 +58,32 @@ function SearchBox({ ) } - async function handleSelectedRegion(option: BaseResult) { + // gets a string as input, or use stored option results from previous query, + // then re-query and + // 1) if it has multiple results: pop a dialog + // 2) if it's a single result navigate to it + // 3) else assume it's a locstring and navigate to it + async function handleSelectedRegion( + option: BaseResult, + assemblyName: string, + ) { let trackId = option.getTrackId() let location = option.getLocation() const label = option.getLabel() const [ref, rest] = location.split(':') const allRefs = assembly?.allRefNames || [] try { + // instead of querying text-index, first: + // - check if input matches a refName directly + // - or looks like locString + // then just navigate as if it were a locString if ( allRefs.includes(location) || (allRefs.includes(ref) && rest !== undefined && !Number.isNaN(parseInt(rest, 10))) ) { - model.navToLocString(location) + model.navToLocString(location, assemblyName) } else { const results = await fetchResults(label, 'exact') if (results.length > 1) {