Tutorial For Cytoscape Web - cytoscape/cytoscape-web GitHub Wiki
For Linux
- Update your package repository:
- Run
sudo apt update
- Install Node.js and npm:
- Run
sudo apt install nodejs
AND - Run
sudo apt install npm
- Verify the installation:
- Run
node --version
(Must be >= 16.8.0) AND - Run
npm --version
For Mac
- Install Homebrew:
- Run
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- Install Node.js and npm:
- Run
brew install node
- Verify the installation:
- Same as in the Linux case.
For Windows
- Download the Windows Installer:
- Visit the Node.js website and download the Windows Installer.
- Run the installer and follow the prompts to install Node.js and npm.
- Verify the installation:
- Same as in the Linux case(Run the commands in a command prompt or PowerShell).
To get Cytoscape-web up and running locally, please follow these steps:
1. Prepare Your Workspace:
- Choose a directory where you want to store the Cytoscape-web codebase. Navigate to this directory in your terminal or command prompt.
2. Clone the Repository:
- Run the following command in the terminal:
git clone https://github.com/cytoscape/cytoscape-web
. - The above command creates a new folder named
cytoscape-web
containing the project files. Now you need to change into the newly cloned repository's directory by runningcd cytoscape-web
.
3. Install dependencies
- Install the project's dependencies using npm:
npm install
.
4. Start the Development Server
- Once the dependencies are installed, you can start the development server with the command
npm run dev
.
5. Access the application
- Open your web browser and navigate to
localhost:5500
. This address connects to the development server running on your machine.
Cytoscape-Web is a single-page web application, with Backend using REST API and Frontend using React. The main work data flow is shown in the following diagram:
Workspace is the basic unit of userβs data, it represents the working status on a user's Cytoscape-Web. It includes:
- name: readable name of the Workspace
- id: unique ID of the Workspace
- metadata:
creationTime
,localModificationTime
- networkIds: list of network IDs
- current network: the network that is currently loaded in website
The CyWebNetwork is a key object in Cytoscape-Web. It contains every information in a network, which includes:
Network Summary - includes metadata and network attributes
- UUID of network
- Network Name
- Network attributes
- URL of a thumbnail image
- A Key to the data model persisted in the client side storage
Visual Style - a reference to the vizmapper object
- Defaults
- Mappings
- Bypasses
Network Topology
- Edges
- Nodes
View Model: the key-value pair storing what should be displayed in the actual visualizations
- Node attribute table
- Edge attribute table
Tables: a 2-D array where each column represents an attribute and each row represents a node/edge
- Node attribute table
- Edge attribute table
ββ πdata
ββ πempty-db.json # Empty database example
ββ πdocs
ββ πtesting.md
ββ πnetlify
ββ πredirects
ββ πnode_modules # Dependencies and libraries
ββ π...
ββ πsrc # Main Code Base
ββ π assets # Static icons, images, and color palettes are stored here
ββ π BrBG.png - A color palette
ββ π cytoscape.svg - The cytoscpae icon
ββ π config.json - Basic configurations of the website
ββ π...
ββ πcomponents # Website components are stored here
ββ π Login # User login panel
ββ π NetworkPanel # Network panel (upper-right side)
ββ π CyjsRenderer - Network Renderer
ββ π TableBrowser # The bottom table that contains information on nodes, edges, and networks
ββ π ToolBar # The top navigation bar
ββ π AnalysisMenu - Dropdown menu of 'Analysis'
ββ π DataMenu - Dropdown menu of 'Data'
ββ π Workspace # The upper-left-side workspace panel
ββ π...
ββ πfeatures # Website components are stored here
ββ π HierarchyViewer
ββ π LLMQuery
ββ πmodels # Models of data or UI components are stored here
ββ π Workspace
ββ π...
ββ πstore # Managing the state related to different objects
ββ π hooks
ββ π io
ββ π persist
ββ π NetworkStore.ts
ββ πutils
ββ π...
ββ π...
ββ πtest
ββ π...
ββ πunittest
ββ π...
ββ π.gitignore
ββ πREADME.md
The main workflow is: the components interact with stores, and stores interacts with database.
Components <--> Stores <--> Database
Currently, there are basically WorkspaceStore
Store Name | Role | Operation |
---|---|---|
WorkspaceStore | - Set new workspace - Add/remove network(s) to the workspace | |
NetworkSummaryStore | Add/delete network summaries-Update contents of a summary | |
NetworkStore | Add/delete network to the store - Edit network structure - add/delete nodes-add/delete edges | |
TableStore | Add/delete tables -Update a value in a table -Utilities - get all column values | |
ViewModelStore | Add/delete view models - Keep track of selection states | |
VisualStyleStore |
To avoid data loss caused by accidents, IndexedDB is employed in this project to persist data locally. However, it also brings some limitations:
- There is always one Workspace database per domain (per browser)
- This means even if a user opens multiple tabs, the same workspace will be used.
The following tables are stored in the cached
Table Name | Key | Value |
---|---|---|
workspace | Workspace ID | Workspace object |
cyNetworkWorks | Network ID | Network Oject |
cyTables | Network ID | Table Object |
cyNetworkViews | Network ID | View Model Object |
cyVisualStyles | Network ID | Visual Style object |
summaries | Network ID | summary object |