Skip to content

cBioPortal/cbioportal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

cBioPortal

Endpoint Badge

The cBioPortal for Cancer Genomics provides visualization, analysis, and download of large-scale cancer genomics data sets. For a short intro on cBioPortal, see these introductory slides.

If you would like to know how to setup a private instance of the portal and/or get set up for developing, see the documentation. For details on contributing code changes via pull requests, see our Contributing document.

If you are interested in coordinating the development of new features, please contact [email protected] or reach out on https://slack.cbioportal.org.

πŸ“˜ Documentation

See https://docs.cbioportal.org

🀝 License

See LICENSE

πŸ’» Run Backend

cBioPortal consists of several components, please read the Architecture docs to figure out what repo would be relevant to edit. If you e.g. only want to make frontend changes, one can directly edit the frontend repo instead. Read the instructions in that repo for more info on how to do frontend development. This repo only contains the backend part. Before editing the backend, it's good to read the backend code organization.

Local Development

This section provides a summary. For Quick Start instructions, or for more additional information, please see Deploy with Docker

What MySQL database to use

We recommend to set up a MySQL database automatically using Docker Compose. It's useful to know how to do this as it allows you to import any dataset of your choice. For debugging production issues, we also have a database available with all the data on https://cbioportal.org that one can connect to directly. Please reach out on slack to get the credentials.

Deploy your development image inside Docker Compose

The easiest option is to deploy your development image directly into the docker-compose file.

  1. From the cbioportal repo, build the image:
docker build -t cbioportal/cbioportal:my-dev-cbioportal-image -f docker/web-and-data/Dockerfile .
  1. From the cbioportal-docker-compose repo, change the env file to use your image (e.g. cbioportal/cbioportal:my-dev-cbioportal-image).

  2. Run the containers.

docker compose up
  1. The app will be visible at http://localhost:8080.

For more information, please see Deploy with Docker.

Command Line

If you want to instead run the cBioPortal web app from the command line please follow these instructions. First, we want to make sure that all ports are open for the services set up through docker compose (i.e. not just accessible to other containers within the same Docker Compose file). To do so, in the docker compose repo run:

docker compose -f docker-compose.yml -f dev/open-ports.yml up

This should open the ports. Now we are ready to run the cBioPortal web app locally. You can compile the backend code with:


java -Xms2g -Xmx4g \
     -Dauthenticate=false \
     -Dsession.service.url=http://localhost:5000/api/sessions/my_portal/ \
     -Dsession.service.origin='*' \
     -Dspring.datasource.username=cbio_user \
     -Dspring.datasource.password=somepassword \
     -Dspring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver \
     -Dspring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect \
     -Dspring.datasource.url='jdbc:mysql://cbio_user:somepassword@localhost:3306/cbioportal?useSSL=false&allowPublicKeyRetrieval=true' \
     -Dshow.civic=true \
     -Dskin.footer='' \
     -Dapp.name='my-portal' \
     -Ddbconnector=dbcp \
     -cp "$PWD:$PWD/BOOT-INF/lib/*" \
     org.cbioportal.PortalApplication

The app should now show up at http://localhost:8080.

Dev Database

Note: internally we have a dev database available with the public data set that one can connect to directly. Please reach out on slack to get the credentials. It is usually best to use a small test dataset, but if a copy of the production database is necessary for e.g. fixing a bug specific to production data that can be useful.

πŸ•΅οΈβ€β™€οΈ Debugging

If you want to attach a debugger you can change the docker-compose.yml file to include the parameters: -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 (make sure to expose the debug port by adding 5005:5005 in the ports section of the cbioportal container). If you are running the java app outside of docker you can add the same parameters to the java command line arguments instead.

You can then use a JAVA IDE to connect to that port. E.g. in VSCode, one would add the following configuration to launch.json to connect:

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "java",
            "name": "Debug (Attach)",
            "request": "attach",
            "hostName": "localhost",
            "port": 5005,
            "projectName": "cbioportal"
        }
    ]
}

βœ… Testing Overview

This project uses a layered testing strategy that separates unit, integration, and end-to-end (E2E) tests for better clarity and control.


πŸ§ͺ Test Layers

Layer Purpose Runs by Default? Tools Used
Unit Test isolated logic (e.g. services, utils) βœ… Yes JUnit, Mockito
Integration Test Spring components (e.g. JPA, Repositories) using real databases 🚫 No Spring Boot, Failsafe
E2E Test full HTTP endpoints via real HTTP calls 🚫 No Spring Boot, TestRestTemplate, MockMvc

πŸ“ Directory Structure

src/test/java/             β†’ Unit tests (default)
src/integration/java/      β†’ Integration tests (DB, Spring context)
src/e2e/java/              β†’ E2E tests (REST API over HTTP)

πŸ”§ Configuration via Environment Variables

All integration and E2E tests are configured via environment variables for test DBs. This avoids hardcoding credentials and allows flexible use in local dev or CI.

βœ… Supported Environment Variables

Variable Description Applies To
TEST_DB_MYSQL_URL JDBC URL for test MySQL Integration
TEST_DB_MYSQL_USERNAME MySQL username Integration
TEST_DB_MYSQL_PASSWORD MySQL password (πŸ”’ required) Integration
TEST_DB_MYSQL_DRIVER Optional, defaults to MySQL driver Integration
TEST_DB_CLICKHOUSE_URL JDBC URL for test ClickHouse Integration & E2E
TEST_DB_CLICKHOUSE_USERNAME ClickHouse username Integration & E2E
TEST_DB_CLICKHOUSE_PASSWORD ClickHouse password (πŸ”’ required) Integration & E2E
TEST_DB_CLICKHOUSE_DRIVER Optional, defaults to ClickHouse driver Integration & E2E

If a variable is marked as required and not set, tests will fail with a helpful error.


πŸ§ͺ Running Tests

βœ… Run Unit Tests (default)

mvn test

βœ… Run Integration Tests

# Set required env vars
export TEST_DB_MYSQL_PASSWORD=...
export TEST_DB_CLICKHOUSE_PASSWORD=...

mvn verify -Pintegration-tests

βœ… Run E2E Tests

# Set required env vars
export TEST_DB_MYSQL_PASSWORD=...
export TEST_DB_CLICKHOUSE_PASSWORD=...

mvn verify -Pe2e-tests

πŸ” Test Class Inheritance

All E2E tests should extend:

public abstract class AbstractE2ETest { ... }

All integration tests (if needed) may use:

public abstract class AbstractClickhouseIntegrationTest { ... }

These base classes:

  • Load the Spring context
  • Register dynamic properties from environment variables using @DynamicPropertySource
  • Share default behavior across test suites

πŸ“¦ Maven Profile Summary

Profile Purpose Command
(default) Unit tests only mvn test
integration-tests Integration tests mvn verify -Pintegration-tests
e2e-tests E2E tests mvn verify -Pe2e-tests

🌳 Branch Information

main branch upcoming release branch later release candidate branch
Branch name master -- rc
Description All bug fixes and features not requiring database migrations go here. This code is either already in production or will be released this week Next release that requires database migrations. Thorough manual product review often takes place for this branch before release Later releases with features that require database migrations. This is useful to allow merging in new features without affecting the upcoming release. Could be seen as a development branch, but note that only high quality pull requests are merged. That is the feature should be pretty much ready for release after merge.
Live instance https://www.cbioportal.org / https://master.cbioportal.org -- https://rc.cbioportal.org
Live instance version https://www.cbioportal.org/api/info / https://master.cbioportal.org/api/info -- https://rc.cbioportal.org/api/info
Docker Image cbioportal/cbioportal:master -- cbioportal/cbioportal:rc
Kubernetes Config production / master -- rc
Status master build status master build status master build status master build status CircleCI -- --

πŸš€ Releases

Release Notes on GitHub:

https://github.com/cBioPortal/cbioportal/releases

See also the cBioPortal News section for user focused release information:

https://www.cbioportal.org/news

Docker Images are available for each tag and branch:

https://hub.docker.com/repository/docker/cbioportal/cbioportal/tags

πŸ‘‰ Other Repos

Read the Architecture docs to see how these relate: