diff --git a/src/components/modal/LinkOutModalContents.jsx b/src/components/modal/LinkOutModalContents.jsx index ef753099e..32a8a5da1 100644 --- a/src/components/modal/LinkOutModalContents.jsx +++ b/src/components/modal/LinkOutModalContents.jsx @@ -189,6 +189,58 @@ function MicrobeTraceLinkOut() { } +function NextcladeLinkOut() { + const displayName = 'nextclade'; + const {pathname, origin} = clientDetails(); + const {showTreeToo} = useSelector((state) => state.controls) + const {mainTreeNumTips, rootSequence} = useSelector((state) => state.metadata); + + // All datasets which have a root-sequence (either in-line or sidecar) can theoretically work as Nextclade + // datasets. See for more thorough discussion here. + // Excessively big trees may be problematic (as Nextclade was designed around smaller reference trees), but + // exactly what the threshold is isn't known. Here I use a rather ad-hoc tip-count threshold: + const largeTreeWarning = mainTreeNumTips > 4000; + + if ( + showTreeToo || // Tanglegrams won't work (surprise surprise!) + !rootSequence // Root sequence is required for Nextclade + ) { + return ( + + {displayName} + + {`The current tree isn't usable as a Nextclade dataset as ${ + showTreeToo ? + "tanglegrams aren't supported." : + "this dataset doesn't have a root-sequence (either within the main JSON or as a sidecar JSON)." + }`} + + + ) + } + + const url = `https://clades.nextstrain.org?dataset-json-url=${encodeURIComponent(`${origin}${pathname}`)}` + return ( + + {displayName} + + {`Use this tree as a nextclade reference dataset which allows you to add new sequences (via drag-and-drop) and see them placed on the tree. + Note that manually curated datasets may be better suited to your use case, see `} + clades.nextstrain.org + {` for all reference datasets or read the `} + + Nextclade Web documentation + + {` for more details.`} + {largeTreeWarning && ( + + {` Note that large trees such as this may not work in Nextclade!`} + + )} + + + ) +} export const LinkOutModalContents = () => { return ( @@ -208,6 +260,7 @@ export const LinkOutModalContents = () => {
+