@@ -11,7 +11,6 @@ import CellEFPIcon from './Icons/CellEFPIcon';
1111import GeneInfoViewIcon from './Icons/GeneInfoViewerIcon' ; /** Placeholder icon for those that are not yet implemented in ePlant3 */
1212import PlantEFPIcon from './Icons/PlantEFPIcon'
1313import * as constants from './constants' ;
14- //import { NavigatorContext, useViewSwitch, ViewSwitchProvider} from './index';
1514import { NavigatorContext , ViewSwitchProvider } from './index' ;
1615
1716
@@ -52,6 +51,21 @@ const grameneLinks: { [key: string]: string } = {
5251 "default" : "https://ensembl.gramene.org/Arabidopsis_thaliana/Gene/Summary?g={geneName}"
5352} ;
5453
54+ /**
55+ * Static declaration of other ePlant site links for non-Arabidopsis species
56+ */
57+ const ePlantLinks :{ [ key : string ] : string } = {
58+ "POPLAR" : "https://bar.utoronto.ca/eplant_poplar/" ,
59+ "SOYBEAN" : "https://bar.utoronto.ca/eplant_soybean/" ,
60+ "M. TRUNCATULA" : "https://bar.utoronto.ca/eplant_medicago/" ,
61+ "TOMATO" : "https://bar.utoronto.ca/eplant_tomato/" ,
62+ "POTATO" : "https://bar.utoronto.ca/eplant_potato/" ,
63+ "GRAPE" : "" ,
64+ "RICE" : "https://bar.utoronto.ca/eplant_rice/" ,
65+ "MAIZE" : "https://bar.utoronto.ca/eplant_maize/" ,
66+ "BARLEY" : "https://bar.utoronto.ca/eplant_barley/" ,
67+ } ;
68+
5569/**
5670 * Generate Gramene link based on species and gene name
5771 * @param species - The species name
@@ -916,8 +930,19 @@ useEffect(() => {
916930 onClick = { ( event ) => {
917931 /** Extract the geneName */
918932 const geneName = displayName ;
919- /** Call switch view function to swap the view using designated view id and gene name */
933+ /** Get species from node data or props - default to Arabidopsis */
934+ const species = node . data . metadata ?. genome ;
935+
920936 switchViewAndGene ( 'plant' , geneName ) ;
937+
938+ /** Call switch view function with species information */
939+ if ( ! species || ! ( species in ePlantLinks ) ) {
940+ /** Call switch view function to swap the view using designated view id and gene name */
941+ switchViewAndGene ( 'plant' , geneName ) ;
942+ } else {
943+ /** Handle external species navigation */
944+ switchViewAndGene ( 'plant' , geneName , ePlantLinks [ species ] ) ;
945+ }
921946 } }
922947 >
923948 < rect
@@ -945,8 +970,19 @@ useEffect(() => {
945970 onClick = { ( event ) => {
946971 /** Extract the geneName */
947972 const geneName = displayName ;
948- /** Call switch view function to swap the view using designated view id and gene name */
973+ /** Get species from node data or props - default to Arabidopsis */
974+ const species = node . data . metadata ?. genome ;
975+
949976 switchViewAndGene ( 'Cell eFP' , geneName ) ;
977+
978+ /** Call switch view function with species information */
979+ if ( ! species || ! ( species in ePlantLinks ) ) {
980+ /** Call switch view function to swap the view using designated view id and gene name */
981+ switchViewAndGene ( 'Cell eFP' , geneName ) ;
982+ } else {
983+ /** Handle external species navigation */
984+ switchViewAndGene ( 'Cell eFP' , geneName , ePlantLinks [ species ] ) ;
985+ }
950986 } }
951987 >
952988 < rect
0 commit comments