diff --git a/docker/web-and-data/Dockerfile b/docker/web-and-data/Dockerfile index b1021c6db08..cc56f46d302 100644 --- a/docker/web-and-data/Dockerfile +++ b/docker/web-and-data/Dockerfile @@ -11,7 +11,7 @@ # NOTE: the .git folder is included in the build stage, but excluded # from the final image. No confidential information is exposed. # (see: stackoverflow.com/questions/56278325) -FROM maven:3-eclipse-temurin-21 as build +FROM maven:3-eclipse-temurin-21 AS build # download maven dependencies first to take advantage of docker caching COPY pom.xml /cbioportal/ @@ -22,7 +22,7 @@ WORKDIR /cbioportal RUN mvn dependency:go-offline --fail-never -COPY $PWD /cbioportal +COPY . /cbioportal RUN mvn install package -DskipTests -q RUN mkdir -p target/dependency && (cd target/dependency; jar -xf ../*-exec.jar) diff --git a/docker/web/Dockerfile b/docker/web/Dockerfile index 8e1bccaf32c..206267c4128 100644 --- a/docker/web/Dockerfile +++ b/docker/web/Dockerfile @@ -13,8 +13,8 @@ # # WARNING: the shendoah image is a nightly, untested, experimental build. If # you want to use an official openjdk image instead use the web-and-data image. -FROM maven:3-eclipse-temurin-21 as build -COPY $PWD /cbioportal +FROM maven:3-eclipse-temurin-21 AS build +COPY . /cbioportal WORKDIR /cbioportal ARG MAVEN_OPTS=-DskipTests # Use quite output so we can see the build steps easily diff --git a/pom.xml b/pom.xml index d1f7dbe00d2..fd6ca0802ac 100644 --- a/pom.xml +++ b/pom.xml @@ -24,13 +24,12 @@ 21 yyyyMMdd-HHmm ${maven.build.timestamp} - + com.github.cbioportal v6.0.5 - 2.13.1 + 3.0.0 @@ -98,6 +97,8 @@ 3.14.0 4.17.0 7.1.0 + 1.19.7 + 0.6.0 @@ -266,6 +267,12 @@ mysql-connector-java ${mysql_driver.version} + + com.clickhouse + clickhouse-jdbc + ${clickhouse-java.version} + all + org.springframework.boot spring-boot-starter-thymeleaf @@ -357,6 +364,23 @@ sentry-spring-boot-starter-jakarta ${sentry.version} + + org.testcontainers + clickhouse + ${clickhouse_testcontainer.version} + test + + + org.mybatis.spring.boot + mybatis-spring-boot-test-autoconfigure + 3.0.3 + test + + + org.springframework.boot + spring-boot-testcontainers + test + @@ -421,9 +445,25 @@ cgds.sql migration.sql + clickhouse/clickhouse.sql + clickhouse/materialized_views.sql + + + src/main/resources/db-scripts + false + + clickhouse/clickhouse.sql + clickhouse/materialized_views.sql + + + + src/test/resources + false + + diff --git a/src/main/resources/db-scripts/cgds.sql b/src/main/resources/db-scripts/cgds.sql index 2971b3d1be6..16dbd67f797 100644 --- a/src/main/resources/db-scripts/cgds.sql +++ b/src/main/resources/db-scripts/cgds.sql @@ -42,11 +42,16 @@ -- DROP TABLE statements are here in the reverse order. -- -------------------------------------------------------- +DROP TABLE IF EXISTS `resource_study`; +DROP TABLE IF EXISTS `resource_patient`; +DROP TABLE IF EXISTS `resource_sample`; +DROP TABLE IF EXISTS `resource_definition`; DROP TABLE IF EXISTS `info`; +DROP TABLE IF EXISTS `allele_specific_copy_number`; +DROP TABLE IF EXISTS `data_access_tokens`; +DROP TABLE IF EXISTS `reference_genome_gene`; DROP TABLE IF EXISTS `clinical_event_data`; DROP TABLE IF EXISTS `clinical_event`; -DROP TABLE IF EXISTS `pdb_uniprot_residue_mapping`; -DROP TABLE IF EXISTS `pdb_uniprot_alignment`; DROP TABLE IF EXISTS `cosmic_mutation`; DROP TABLE IF EXISTS `copy_number_seg_file`; DROP TABLE IF EXISTS `copy_number_seg`; @@ -58,14 +63,10 @@ DROP TABLE IF EXISTS `mut_sig`; DROP TABLE IF EXISTS `clinical_attribute_meta`; DROP TABLE IF EXISTS `clinical_sample`; DROP TABLE IF EXISTS `clinical_patient`; -DROP TABLE IF EXISTS `resource_definition`; -DROP TABLE IF EXISTS `resource_sample`; -DROP TABLE IF EXISTS `resource_patient`; -DROP TABLE IF EXISTS `resource_study`; DROP TABLE IF EXISTS `mutation_count_by_keyword`; -DROP TABLE IF EXISTS `allele_specific_copy_number`; DROP TABLE IF EXISTS `mutation`; DROP TABLE IF EXISTS `mutation_event`; +DROP TABLE IF EXISTS `alteration_driver_annotation`; DROP TABLE IF EXISTS `structural_variant`; DROP TABLE IF EXISTS `sample_profile`; DROP TABLE IF EXISTS `gene_panel_list`; @@ -73,687 +74,683 @@ DROP TABLE IF EXISTS `gene_panel`; DROP TABLE IF EXISTS `genetic_profile_samples`; DROP TABLE IF EXISTS `genetic_alteration`; DROP TABLE IF EXISTS `genetic_profile_link`; -DROP TABLE IF EXISTS `alteration_driver_annotation`; DROP TABLE IF EXISTS `genetic_profile`; -DROP TABLE IF EXISTS `gene_alias`; +DROP TABLE IF EXISTS `generic_entity_properties`; +DROP TABLE IF EXISTS `geneset_hierarchy_leaf`; +DROP TABLE IF EXISTS `geneset_hierarchy_node`; DROP TABLE IF EXISTS `geneset_gene`; -DROP TABLE IF EXISTS `reference_genome_gene`; +DROP TABLE IF EXISTS `geneset`; +DROP TABLE IF EXISTS `gene_alias`; DROP TABLE IF EXISTS `gene`; +DROP TABLE IF EXISTS `genetic_entity`; DROP TABLE IF EXISTS `sample_list_list`; DROP TABLE IF EXISTS `sample_list`; DROP TABLE IF EXISTS `sample`; DROP TABLE IF EXISTS `patient`; DROP TABLE IF EXISTS `authorities`; -DROP TABLE IF EXISTS `data_access_tokens`; DROP TABLE IF EXISTS `users`; DROP TABLE IF EXISTS `cancer_study_tags`; DROP TABLE IF EXISTS `cancer_study`; -DROP TABLE IF EXISTS `type_of_cancer`; -DROP TABLE IF EXISTS `geneset_hierarchy_leaf`; -DROP TABLE IF EXISTS `geneset_hierarchy_node`; -DROP TABLE IF EXISTS `geneset`; -DROP TABLE IF EXISTS `generic_entity_properties`; -DROP TABLE IF EXISTS `genetic_entity`; DROP TABLE IF EXISTS `reference_genome`; -- -------------------------------------------------------- CREATE TABLE `type_of_cancer` ( - `TYPE_OF_CANCER_ID` varchar(63) NOT NULL, - `NAME` varchar(255) NOT NULL, - `DEDICATED_COLOR` char(31) NOT NULL, - `SHORT_NAME` varchar(127), - `PARENT` varchar(63), - PRIMARY KEY (`TYPE_OF_CANCER_ID`) + `type_of_cancer_id` varchar(63) NOT NULL, + `name` varchar(255) NOT NULL, + `dedicated_color` char(31) NOT NULL, + `short_name` varchar(127) DEFAULT NULL, + `parent` varchar(63) DEFAULT NULL, + PRIMARY KEY (`type_of_cancer_id`) ); -- -------------------------------------------------------- CREATE TABLE `reference_genome` ( - `REFERENCE_GENOME_ID` int(4) NOT NULL AUTO_INCREMENT, - `SPECIES` varchar(64) NOT NULL, - `NAME` varchar(64) NOT NULL, - `BUILD_NAME` varchar(64) NOT NULL, - `GENOME_SIZE` bigint(20) NULL, - `URL` varchar(256) NOT NULL, - `RELEASE_DATE` datetime DEFAULT NULL, - PRIMARY KEY (`REFERENCE_GENOME_ID`), - UNIQUE INDEX `BUILD_NAME_UNIQUE` (`BUILD_NAME` ASC) + `reference_genome_id` int(4) NOT NULL AUTO_INCREMENT, + `species` varchar(64) NOT NULL, + `name` varchar(64) NOT NULL, + `build_name` varchar(64) NOT NULL, + `genome_size` bigint(20) DEFAULT NULL, + `url` varchar(256) NOT NULL, + `release_date` datetime DEFAULT NULL, + PRIMARY KEY (`reference_genome_id`), + UNIQUE KEY `build_name_unique` (`build_name`) ); -- -------------------------------------------------------- CREATE TABLE `cancer_study` ( - `CANCER_STUDY_ID` int(11) NOT NULL auto_increment, - `CANCER_STUDY_IDENTIFIER` varchar(255), - `TYPE_OF_CANCER_ID` varchar(63) NOT NULL, - `NAME` varchar(255) NOT NULL, - `DESCRIPTION` varchar(1024) NOT NULL, - `PUBLIC` BOOLEAN NOT NULL, - `PMID` varchar(1024) DEFAULT NULL, - `CITATION` varchar(200) DEFAULT NULL, - `GROUPS` varchar(200) DEFAULT NULL, - `STATUS` int(1) DEFAULT NULL, - `IMPORT_DATE` datetime DEFAULT NULL, - `REFERENCE_GENOME_ID` int(4) DEFAULT 1, - PRIMARY KEY (`CANCER_STUDY_ID`), - UNIQUE (`CANCER_STUDY_IDENTIFIER`), - FOREIGN KEY (`TYPE_OF_CANCER_ID`) REFERENCES `type_of_cancer` (`TYPE_OF_CANCER_ID`), - FOREIGN KEY (`REFERENCE_GENOME_ID`) REFERENCES `reference_genome` (`REFERENCE_GENOME_ID`) ON DELETE RESTRICT + `cancer_study_id` int(11) NOT NULL AUTO_INCREMENT, + `cancer_study_identifier` varchar(255) DEFAULT NULL, + `type_of_cancer_id` varchar(63) NOT NULL, + `name` varchar(255) NOT NULL, + `description` varchar(1024) NOT NULL, + `public` tinyint(1) NOT NULL, + `pmid` varchar(1024) DEFAULT NULL, + `citation` varchar(200) DEFAULT NULL, + `groups` varchar(200) DEFAULT NULL, + `status` int(1) DEFAULT NULL, + `import_date` datetime DEFAULT NULL, + `reference_genome_id` int(4) DEFAULT '1', + PRIMARY KEY (`cancer_study_id`), + UNIQUE KEY (`cancer_study_identifier`), + FOREIGN KEY (`type_of_cancer_id`) REFERENCES `type_of_cancer` (`type_of_cancer_id`), + FOREIGN KEY (`reference_genome_id`) REFERENCES `reference_genome` (`reference_genome_id`) ON DELETE RESTRICT ); -- -------------------------------------------------------- CREATE TABLE `cancer_study_tags` ( - `CANCER_STUDY_ID` int(11) NOT NULL, - `TAGS` text NOT NULL, - PRIMARY KEY (`CANCER_STUDY_ID`), - FOREIGN KEY (`CANCER_STUDY_ID`) REFERENCES `cancer_study` (`CANCER_STUDY_ID`) ON DELETE CASCADE + `cancer_study_id` int(11) NOT NULL, + `tags` text NOT NULL, + PRIMARY KEY (`cancer_study_id`), + FOREIGN KEY (`cancer_study_id`) REFERENCES `cancer_study` (`cancer_study_id`) ON DELETE CASCADE ); -- -------------------------------------------------------- CREATE TABLE `users` ( - `EMAIL` varchar(128) NOT NULL, - `NAME` varchar(255) NOT NULL, - `ENABLED` BOOLEAN NOT NULL, - PRIMARY KEY (`EMAIL`) + `email` varchar(128) NOT NULL, + `name` varchar(255) NOT NULL, + `enabled` tinyint(1) NOT NULL, + PRIMARY KEY (`email`) ); -- -------------------------------------------------------- CREATE TABLE `authorities` ( - `EMAIL` varchar(128) NOT NULL, - `AUTHORITY` varchar(255) NOT NULL + `email` varchar(128) NOT NULL, + `authority` varchar(255) NOT NULL ); -- -------------------------------------------------------- CREATE TABLE `patient` ( - `INTERNAL_ID` int(11) NOT NULL auto_increment, - `STABLE_ID` varchar(50) NOT NULL, - `CANCER_STUDY_ID` int(11) NOT NULL, - PRIMARY KEY (`INTERNAL_ID`), - FOREIGN KEY (`CANCER_STUDY_ID`) REFERENCES `cancer_study` (`CANCER_STUDY_ID`) ON DELETE CASCADE + `internal_id` int(11) NOT NULL AUTO_INCREMENT, + `stable_id` varchar(50) NOT NULL, + `cancer_study_id` int(11) NOT NULL, + PRIMARY KEY (`internal_id`), + FOREIGN KEY (`cancer_study_id`) REFERENCES `cancer_study` (`cancer_study_id`) ON DELETE CASCADE ); -- -------------------------------------------------------- CREATE TABLE `sample` ( - `INTERNAL_ID` int(11) NOT NULL auto_increment, - `STABLE_ID` varchar(63) NOT NULL, - `SAMPLE_TYPE` varchar(255) NOT NULL, - `PATIENT_ID` int(11) NOT NULL, - PRIMARY KEY (`INTERNAL_ID`), - FOREIGN KEY (`PATIENT_ID`) REFERENCES `patient` (`INTERNAL_ID`) ON DELETE CASCADE + `internal_id` int(11) NOT NULL AUTO_INCREMENT, + `stable_id` varchar(63) NOT NULL, + `sample_type` varchar(255) NOT NULL, + `patient_id` int(11) NOT NULL, + PRIMARY KEY (`internal_id`), + FOREIGN KEY (`patient_id`) REFERENCES `patient` (`internal_id`) ON DELETE CASCADE ); -- -------------------------------------------------------- CREATE TABLE `sample_list` ( - `LIST_ID` int(11) NOT NULL auto_increment, - `STABLE_ID` varchar(255) NOT NULL, - `CATEGORY` varchar(255) NOT NULL, - `CANCER_STUDY_ID` int(11) NOT NULL, - `NAME` varchar(255) NOT NULL, - `DESCRIPTION` mediumtext, - PRIMARY KEY (`LIST_ID`), - UNIQUE (`STABLE_ID`), - FOREIGN KEY (`CANCER_STUDY_ID`) REFERENCES `cancer_study` (`CANCER_STUDY_ID`) ON DELETE CASCADE + `list_id` int(11) NOT NULL AUTO_INCREMENT, + `stable_id` varchar(255) NOT NULL, + `category` varchar(255) NOT NULL, + `cancer_study_id` int(11) NOT NULL, + `name` varchar(255) NOT NULL, + `description` mediumtext, + PRIMARY KEY (`list_id`), + UNIQUE KEY (`stable_id`), + FOREIGN KEY (`cancer_study_id`) REFERENCES `cancer_study` (`cancer_study_id`) ON DELETE CASCADE ); -- -------------------------------------------------------- CREATE TABLE `sample_list_list` ( - `LIST_ID` int(11) NOT NULL, - `SAMPLE_ID` int(11) NOT NULL, - PRIMARY KEY (`LIST_ID`,`SAMPLE_ID`), - FOREIGN KEY (`SAMPLE_ID`) REFERENCES `sample` (`INTERNAL_ID`) ON DELETE CASCADE + `list_id` int(11) NOT NULL, + `sample_id` int(11) NOT NULL, + PRIMARY KEY (`list_id`,`sample_id`), + FOREIGN KEY (`sample_id`) REFERENCES `sample` (`internal_id`) ON DELETE CASCADE ); -- -------------------------------------------------------- CREATE TABLE `genetic_entity` ( - `ID` int(11) NOT NULL AUTO_INCREMENT, - `ENTITY_TYPE` varchar(45) NOT NULL, - `STABLE_ID` varchar(255) DEFAULT NULL, - PRIMARY KEY (`ID`) + `id` int(11) NOT NULL AUTO_INCREMENT, + `entity_type` varchar(45) NOT NULL, + `stable_id` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) ); -- -------------------------------------------------------- CREATE TABLE `gene` ( - `ENTREZ_GENE_ID` int(11) NOT NULL, - `HUGO_GENE_SYMBOL` varchar(255) NOT NULL, - `GENETIC_ENTITY_ID` int(11) NOT NULL, - `TYPE` varchar(50), - PRIMARY KEY (`ENTREZ_GENE_ID`), - UNIQUE KEY `GENETIC_ENTITY_ID_UNIQUE` (`GENETIC_ENTITY_ID`), - KEY `HUGO_GENE_SYMBOL` (`HUGO_GENE_SYMBOL`), - FOREIGN KEY (`GENETIC_ENTITY_ID`) REFERENCES `genetic_entity` (`ID`) ON DELETE CASCADE + `entrez_gene_id` int(11) NOT NULL, + `hugo_gene_symbol` varchar(255) NOT NULL, + `genetic_entity_id` int(11) NOT NULL, + `type` varchar(50) DEFAULT NULL, + PRIMARY KEY (`entrez_gene_id`), + UNIQUE KEY `genetic_entity_id_unique` (`genetic_entity_id`), + KEY `hugo_gene_symbol` (`hugo_gene_symbol`), + FOREIGN KEY (`genetic_entity_id`) REFERENCES `genetic_entity` (`id`) ON DELETE CASCADE ); -- -------------------------------------------------------- CREATE TABLE `gene_alias` ( - `ENTREZ_GENE_ID` int(11) NOT NULL, - `GENE_ALIAS` varchar(255) NOT NULL, - PRIMARY KEY (`ENTREZ_GENE_ID`,`GENE_ALIAS`), - FOREIGN KEY (`ENTREZ_GENE_ID`) REFERENCES `gene` (`ENTREZ_GENE_ID`) + `entrez_gene_id` int(11) NOT NULL, + `gene_alias` varchar(255) NOT NULL, + PRIMARY KEY (`entrez_gene_id`,`gene_alias`), + FOREIGN KEY (`entrez_gene_id`) REFERENCES `gene` (`entrez_gene_id`) ); -- -------------------------------------------------------- CREATE TABLE `geneset` ( - `ID` INT(11) NOT NULL auto_increment, - `GENETIC_ENTITY_ID` INT NOT NULL, - `EXTERNAL_ID` VARCHAR(200) NOT NULL, - `NAME` VARCHAR(200) NOT NULL, - `DESCRIPTION` VARCHAR(300) NOT NULL, - `REF_LINK` TEXT, - PRIMARY KEY (`ID`), - UNIQUE INDEX `NAME_UNIQUE` (`NAME` ASC), - UNIQUE INDEX `EXTERNAL_ID_COLL_UNIQUE` (`EXTERNAL_ID` ASC), - UNIQUE INDEX `GENESET_GENETIC_ENTITY_ID_UNIQUE` (`GENETIC_ENTITY_ID` ASC), - FOREIGN KEY (`GENETIC_ENTITY_ID`) REFERENCES `genetic_entity` (`ID`) ON DELETE CASCADE + `id` int(11) NOT NULL AUTO_INCREMENT, + `genetic_entity_id` int(11) NOT NULL, + `external_id` varchar(200) NOT NULL, + `name` varchar(200) NOT NULL, + `description` varchar(300) NOT NULL, + `ref_link` text, + PRIMARY KEY (`id`), + UNIQUE KEY `name_unique` (`name`), + UNIQUE KEY `external_id_coll_unique` (`external_id`), + UNIQUE KEY `geneset_genetic_entity_id_unique` (`genetic_entity_id`), + FOREIGN KEY (`genetic_entity_id`) REFERENCES `genetic_entity` (`id`) ON DELETE CASCADE ); -- -------------------------------------------------------- CREATE TABLE `geneset_gene` ( - `GENESET_ID` INT(11) NOT NULL, - `ENTREZ_GENE_ID` INT(11) NOT NULL, - PRIMARY KEY (`GENESET_ID`, `ENTREZ_GENE_ID`), - FOREIGN KEY (`ENTREZ_GENE_ID`) REFERENCES `gene` (`ENTREZ_GENE_ID`) ON DELETE CASCADE, - FOREIGN KEY (`GENESET_ID`) REFERENCES `geneset` (`ID`) ON DELETE CASCADE + `geneset_id` int(11) NOT NULL, + `entrez_gene_id` int(11) NOT NULL, + PRIMARY KEY (`geneset_id`,`entrez_gene_id`), + FOREIGN KEY (`entrez_gene_id`) REFERENCES `gene` (`entrez_gene_id`) ON DELETE CASCADE, + FOREIGN KEY (`geneset_id`) REFERENCES `geneset` (`id`) ON DELETE CASCADE ); -- -------------------------------------------------------- CREATE TABLE `geneset_hierarchy_node` ( - `NODE_ID` BIGINT(20) NOT NULL auto_increment, - `NODE_NAME` VARCHAR(200) NOT NULL, - `PARENT_ID` BIGINT NULL DEFAULT NULL, - PRIMARY KEY (`NODE_ID`), - UNIQUE INDEX `NODE_NAME_UNIQUE` (`NODE_NAME` ASC, `PARENT_ID` ASC) + `node_id` bigint(20) NOT NULL AUTO_INCREMENT, + `node_name` varchar(200) NOT NULL, + `parent_id` bigint(20) DEFAULT NULL, + PRIMARY KEY (`node_id`), + UNIQUE KEY `node_name_unique` (`node_name`,`parent_id`) ); -- -------------------------------------------------------- CREATE TABLE `geneset_hierarchy_leaf` ( - `NODE_ID` BIGINT NOT NULL, - `GENESET_ID` INT NOT NULL, - PRIMARY KEY (`NODE_ID`, `GENESET_ID`), - FOREIGN KEY (`NODE_ID`) REFERENCES `geneset_hierarchy_node` (`NODE_ID`) ON DELETE CASCADE, - FOREIGN KEY (`GENESET_ID`) REFERENCES `geneset` (`ID`) ON DELETE CASCADE + `node_id` bigint(20) NOT NULL, + `geneset_id` int(11) NOT NULL, + PRIMARY KEY (`node_id`,`geneset_id`), + FOREIGN KEY (`node_id`) REFERENCES `geneset_hierarchy_node` (`node_id`) ON DELETE CASCADE, + FOREIGN KEY (`geneset_id`) REFERENCES `geneset` (`id`) ON DELETE CASCADE ); -- ------------------------------------------------------ CREATE TABLE `generic_entity_properties` ( - `ID` INT(11) NOT NULL auto_increment, - `GENETIC_ENTITY_ID` INT NOT NULL, - `NAME` varchar(255) NOT NULL, - `VALUE` varchar(5000) NOT NULL, - UNIQUE (`GENETIC_ENTITY_ID`, `NAME`), - PRIMARY KEY (`ID`), - FOREIGN KEY (`GENETIC_ENTITY_ID`) REFERENCES `genetic_entity` (`ID`) ON DELETE CASCADE + `id` int(11) NOT NULL AUTO_INCREMENT, + `genetic_entity_id` int(11) NOT NULL, + `name` varchar(255) NOT NULL, + `value` varchar(5000) NOT NULL, + UNIQUE KEY (`genetic_entity_id`,`name`), + PRIMARY KEY (`id`), + FOREIGN KEY (`genetic_entity_id`) REFERENCES `genetic_entity` (`id`) ON DELETE CASCADE ); -- -------------------------------------------------------- CREATE TABLE `genetic_profile` ( - `GENETIC_PROFILE_ID` int(11) NOT NULL AUTO_INCREMENT, - `STABLE_ID` varchar(255) NOT NULL, - `CANCER_STUDY_ID` int(11) NOT NULL, - `GENETIC_ALTERATION_TYPE` varchar(255) NOT NULL, - `GENERIC_ASSAY_TYPE` varchar(255) DEFAULT NULL, - `DATATYPE` varchar(255) NOT NULL, - `NAME` varchar(255) NOT NULL, - `DESCRIPTION` mediumtext, - `SHOW_PROFILE_IN_ANALYSIS_TAB` tinyint(1) NOT NULL, - `PIVOT_THRESHOLD` FLOAT DEFAULT NULL, - `SORT_ORDER` ENUM('ASC','DESC') DEFAULT NULL, - `PATIENT_LEVEL` boolean DEFAULT 0, - PRIMARY KEY (`GENETIC_PROFILE_ID`), - UNIQUE (`STABLE_ID`), - FOREIGN KEY (`CANCER_STUDY_ID`) REFERENCES `cancer_study` (`CANCER_STUDY_ID`) ON DELETE CASCADE + `genetic_profile_id` int(11) NOT NULL AUTO_INCREMENT, + `stable_id` varchar(255) NOT NULL, + `cancer_study_id` int(11) NOT NULL, + `genetic_alteration_type` varchar(255) NOT NULL, + `generic_assay_type` varchar(255) DEFAULT NULL, + `datatype` varchar(255) NOT NULL, + `name` varchar(255) NOT NULL, + `description` mediumtext, + `show_profile_in_analysis_tab` tinyint(1) NOT NULL, + `pivot_threshold` float DEFAULT NULL, + `sort_order` enum('ASC','DESC') DEFAULT NULL, + `patient_level` tinyint(1) DEFAULT '0', + PRIMARY KEY (`genetic_profile_id`), + UNIQUE KEY (`stable_id`), + FOREIGN KEY (`cancer_study_id`) REFERENCES `cancer_study` (`cancer_study_id`) ON DELETE CASCADE ); -- -------------------------------------------------------- CREATE TABLE `genetic_profile_link` ( - `REFERRING_GENETIC_PROFILE_ID` INT NOT NULL, - `REFERRED_GENETIC_PROFILE_ID` INT NOT NULL, - `REFERENCE_TYPE` VARCHAR(45) NULL, -- COMMENT 'Values: AGGREGATION (e.g. for GSVA) or STATISTIC (e.g. for Z-SCORES) - PRIMARY KEY (`REFERRING_GENETIC_PROFILE_ID`, `REFERRED_GENETIC_PROFILE_ID`), - FOREIGN KEY (`REFERRING_GENETIC_PROFILE_ID` ) REFERENCES `genetic_profile` (`GENETIC_PROFILE_ID`) ON DELETE CASCADE, - FOREIGN KEY (`REFERRED_GENETIC_PROFILE_ID` ) REFERENCES `genetic_profile` (`GENETIC_PROFILE_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION + `referring_genetic_profile_id` int(11) NOT NULL, + `referred_genetic_profile_id` int(11) NOT NULL, + `reference_type` varchar(45) DEFAULT NULL, -- COMMENT 'Values: AGGREGATION (e.g. for GSVA) or STATISTIC (e.g. for Z-SCORES)' + PRIMARY KEY (`referring_genetic_profile_id`,`referred_genetic_profile_id`), + FOREIGN KEY (`referring_genetic_profile_id` ) REFERENCES `genetic_profile` (`genetic_profile_id`) ON DELETE CASCADE, + FOREIGN KEY (`referred_genetic_profile_id` ) REFERENCES `genetic_profile` (`genetic_profile_id`) ON DELETE NO ACTION ON UPDATE NO ACTION ); -- -------------------------------------------------------- CREATE TABLE `genetic_alteration` ( - `GENETIC_PROFILE_ID` int(11) NOT NULL, - `GENETIC_ENTITY_ID` int(11) NOT NULL, - `VALUES` longtext NOT NULL, - PRIMARY KEY (`GENETIC_PROFILE_ID`,`GENETIC_ENTITY_ID`), - FOREIGN KEY (`GENETIC_PROFILE_ID`) REFERENCES `genetic_profile` (`GENETIC_PROFILE_ID`) ON DELETE CASCADE, - FOREIGN KEY (`GENETIC_ENTITY_ID`) REFERENCES `genetic_entity` (`ID`) ON DELETE CASCADE + `genetic_profile_id` int(11) NOT NULL, + `genetic_entity_id` int(11) NOT NULL, + `values` longtext NOT NULL, + PRIMARY KEY (`genetic_profile_id`,`genetic_entity_id`), + FOREIGN KEY (`genetic_profile_id`) REFERENCES `genetic_profile` (`genetic_profile_id`) ON DELETE CASCADE, + FOREIGN KEY (`genetic_entity_id`) REFERENCES `genetic_entity` (`id`) ON DELETE CASCADE ); -- -------------------------------------------------------- CREATE TABLE `genetic_profile_samples` ( - `GENETIC_PROFILE_ID` int(11) NOT NULL, - `ORDERED_SAMPLE_LIST` longtext NOT NULL, - UNIQUE (`GENETIC_PROFILE_ID`), - FOREIGN KEY (`GENETIC_PROFILE_ID`) REFERENCES `genetic_profile` (`GENETIC_PROFILE_ID`) ON DELETE CASCADE + `genetic_profile_id` int(11) NOT NULL, + `ordered_sample_list` longtext NOT NULL, + UNIQUE KEY (`genetic_profile_id`), + FOREIGN KEY (`genetic_profile_id`) REFERENCES `genetic_profile` (`genetic_profile_id`) ON DELETE CASCADE ); -- -------------------------------------------------------- CREATE TABLE `gene_panel` ( - `INTERNAL_ID` int(11) NOT NULL auto_increment, - `STABLE_ID` varchar(255) NOT NULL, - `DESCRIPTION` mediumtext, - PRIMARY KEY (`INTERNAL_ID`), - UNIQUE (`STABLE_ID`) + `internal_id` int(11) NOT NULL AUTO_INCREMENT, + `stable_id` varchar(255) NOT NULL, + `description` mediumtext, + PRIMARY KEY (`internal_id`), + UNIQUE KEY (`stable_id`) ); -- -------------------------------------------------------- CREATE TABLE `gene_panel_list` ( - `INTERNAL_ID` int(11) NOT NULL, - `GENE_ID` int(11) NOT NULL, - PRIMARY KEY (`INTERNAL_ID`, `GENE_ID`), - FOREIGN KEY (`INTERNAL_ID`) REFERENCES `gene_panel` (`INTERNAL_ID`) ON DELETE CASCADE, - FOREIGN KEY (`GENE_ID`) REFERENCES `gene` (`ENTREZ_GENE_ID`) ON DELETE CASCADE + `internal_id` int(11) NOT NULL, + `gene_id` int(11) NOT NULL, + PRIMARY KEY (`internal_id`,`gene_id`), + FOREIGN KEY (`internal_id`) REFERENCES `gene_panel` (`internal_id`) ON DELETE CASCADE, + FOREIGN KEY (`gene_id`) REFERENCES `gene` (`entrez_gene_id`) ON DELETE CASCADE ); -- -------------------------------------------------------- CREATE TABLE `sample_profile` ( - `SAMPLE_ID` int(11) NOT NULL, - `GENETIC_PROFILE_ID` int(11) NOT NULL, - `PANEL_ID` int(11) DEFAULT NULL, - UNIQUE KEY `UQ_SAMPLE_ID_GENETIC_PROFILE_ID` (`SAMPLE_ID`,`GENETIC_PROFILE_ID`), -- Constraint to allow each sample only once in each profile - KEY (`SAMPLE_ID`), - FOREIGN KEY (`GENETIC_PROFILE_ID`) REFERENCES `genetic_profile` (`GENETIC_PROFILE_ID`) ON DELETE CASCADE, - FOREIGN KEY (`SAMPLE_ID`) REFERENCES `sample` (`INTERNAL_ID`) ON DELETE CASCADE, - FOREIGN KEY (`PANEL_ID`) REFERENCES `gene_panel` (`INTERNAL_ID`) ON DELETE RESTRICT + `sample_id` int(11) NOT NULL, + `genetic_profile_id` int(11) NOT NULL, + `panel_id` int(11) DEFAULT NULL, + UNIQUE KEY `uq_sample_id_genetic_profile_id` (`sample_id`,`genetic_profile_id`), -- Constraint to allow each sample only once in each profile + KEY (`sample_id`), + FOREIGN KEY (`genetic_profile_id`) REFERENCES `genetic_profile` (`genetic_profile_id`) ON DELETE CASCADE, + FOREIGN KEY (`sample_id`) REFERENCES `sample` (`internal_id`) ON DELETE CASCADE, + FOREIGN KEY (`panel_id`) REFERENCES `gene_panel` (`internal_id`) ON DELETE RESTRICT ); -- -------------------------------------------------------- CREATE TABLE `structural_variant` ( - `INTERNAL_ID` int(11) NOT NULL auto_increment, - `GENETIC_PROFILE_ID` int(11) NOT NULL, - `SAMPLE_ID` int(11) NOT NULL, - `SITE1_ENTREZ_GENE_ID` int(11), - `SITE1_ENSEMBL_TRANSCRIPT_ID` varchar(25), - `SITE1_CHROMOSOME` varchar(5), - `SITE1_REGION` varchar(25), - `SITE1_REGION_NUMBER` int(11), - `SITE1_CONTIG` varchar(100), - `SITE1_POSITION` int(11), - `SITE1_DESCRIPTION` varchar(255), - `SITE2_ENTREZ_GENE_ID` int(11), - `SITE2_ENSEMBL_TRANSCRIPT_ID` varchar(25), - `SITE2_CHROMOSOME` varchar(5), - `SITE2_REGION` varchar(25), - `SITE2_REGION_NUMBER` int(11), - `SITE2_CONTIG` varchar(100), - `SITE2_POSITION` int(11), - `SITE2_DESCRIPTION` varchar(255), - `SITE2_EFFECT_ON_FRAME` varchar(25), - `NCBI_BUILD` varchar(10), - `DNA_SUPPORT` varchar(3), - `RNA_SUPPORT` varchar(3), - `NORMAL_READ_COUNT` int(11), - `TUMOR_READ_COUNT` int(11), - `NORMAL_VARIANT_COUNT` int(11), - `TUMOR_VARIANT_COUNT` int(11), - `NORMAL_PAIRED_END_READ_COUNT` int(11), - `TUMOR_PAIRED_END_READ_COUNT` int(11), - `NORMAL_SPLIT_READ_COUNT` int(11), - `TUMOR_SPLIT_READ_COUNT` int(11), - `ANNOTATION` varchar(255), - `BREAKPOINT_TYPE` varchar(25), - `CONNECTION_TYPE` varchar(25), - `EVENT_INFO` varchar(255), - `CLASS` varchar(25), - `LENGTH` int(11), - `COMMENTS` varchar(255), - `SV_STATUS` varchar(25) NOT NULL DEFAULT 'SOMATIC' COMMENT 'GERMLINE or SOMATIC.', - `ANNOTATION_JSON` JSON, - PRIMARY KEY (`INTERNAL_ID`), - FOREIGN KEY (`SAMPLE_ID`) REFERENCES `sample` (`INTERNAL_ID`) ON DELETE CASCADE, - FOREIGN KEY (`SITE1_ENTREZ_GENE_ID`) REFERENCES `gene` (`ENTREZ_GENE_ID`) ON DELETE CASCADE, - FOREIGN KEY (`SITE2_ENTREZ_GENE_ID`) REFERENCES `gene` (`ENTREZ_GENE_ID`) ON DELETE CASCADE, - FOREIGN KEY (`GENETIC_PROFILE_ID`) REFERENCES `genetic_profile` (`GENETIC_PROFILE_ID`) ON DELETE CASCADE + `internal_id` int(11) NOT NULL AUTO_INCREMENT, + `genetic_profile_id` int(11) NOT NULL, + `sample_id` int(11) NOT NULL, + `site1_entrez_gene_id` int(11) DEFAULT NULL, + `site1_ensembl_transcript_id` varchar(25) DEFAULT NULL, + `site1_chromosome` varchar(5) DEFAULT NULL, + `site1_region` varchar(25) DEFAULT NULL, + `site1_region_number` int(11) DEFAULT NULL, + `site1_contig` varchar(100) DEFAULT NULL, + `site1_position` int(11) DEFAULT NULL, + `site1_description` varchar(255) DEFAULT NULL, + `site2_entrez_gene_id` int(11) DEFAULT NULL, + `site2_ensembl_transcript_id` varchar(25) DEFAULT NULL, + `site2_chromosome` varchar(5) DEFAULT NULL, + `site2_region` varchar(25) DEFAULT NULL, + `site2_region_number` int(11) DEFAULT NULL, + `site2_contig` varchar(100) DEFAULT NULL, + `site2_position` int(11) DEFAULT NULL, + `site2_description` varchar(255) DEFAULT NULL, + `site2_effect_on_frame` varchar(25) DEFAULT NULL, + `ncbi_build` varchar(10) DEFAULT NULL, + `dna_support` varchar(3) DEFAULT NULL, + `rna_support` varchar(3) DEFAULT NULL, + `normal_read_count` int(11) DEFAULT NULL, + `tumor_read_count` int(11) DEFAULT NULL, + `normal_variant_count` int(11) DEFAULT NULL, + `tumor_variant_count` int(11) DEFAULT NULL, + `normal_paired_end_read_count` int(11) DEFAULT NULL, + `tumor_paired_end_read_count` int(11) DEFAULT NULL, + `normal_split_read_count` int(11) DEFAULT NULL, + `tumor_split_read_count` int(11) DEFAULT NULL, + `annotation` varchar(255) DEFAULT NULL, + `breakpoint_type` varchar(25) DEFAULT NULL, + `connection_type` varchar(25) DEFAULT NULL, + `event_info` varchar(255) DEFAULT NULL, + `class` varchar(25) DEFAULT NULL, + `length` int(11) DEFAULT NULL, + `comments` varchar(255) DEFAULT NULL, + `sv_status` varchar(25) NOT NULL DEFAULT 'SOMATIC' COMMENT 'GERMLINE or SOMATIC.', + `annotation_json` json DEFAULT NULL, + PRIMARY KEY (`internal_id`), + FOREIGN KEY (`sample_id`) REFERENCES `sample` (`internal_id`) ON DELETE CASCADE, + FOREIGN KEY (`site1_entrez_gene_id`) REFERENCES `gene` (`entrez_gene_id`) ON DELETE CASCADE, + FOREIGN KEY (`site2_entrez_gene_id`) REFERENCES `gene` (`entrez_gene_id`) ON DELETE CASCADE, + FOREIGN KEY (`genetic_profile_id`) REFERENCES `genetic_profile` (`genetic_profile_id`) ON DELETE CASCADE ); -- -------------------------------------------------------- CREATE TABLE `alteration_driver_annotation` ( - `ALTERATION_EVENT_ID` int(255) NOT NULL, - `GENETIC_PROFILE_ID` int(11) NOT NULL, - `SAMPLE_ID` int(11) NOT NULL, - `DRIVER_FILTER` VARCHAR(20), - `DRIVER_FILTER_ANNOTATION` VARCHAR(80), - `DRIVER_TIERS_FILTER` VARCHAR(50), - `DRIVER_TIERS_FILTER_ANNOTATION` VARCHAR(80), - PRIMARY KEY (`ALTERATION_EVENT_ID`, `GENETIC_PROFILE_ID`, `SAMPLE_ID`), - FOREIGN KEY (`GENETIC_PROFILE_ID`) REFERENCES `genetic_profile` (`GENETIC_PROFILE_ID`) ON DELETE CASCADE, - FOREIGN KEY (`SAMPLE_ID`) REFERENCES `sample` (`INTERNAL_ID`) ON DELETE CASCADE, - INDEX (`DRIVER_FILTER`), - INDEX (`DRIVER_TIERS_FILTER`) + `alteration_event_id` int(255) NOT NULL, + `genetic_profile_id` int(11) NOT NULL, + `sample_id` int(11) NOT NULL, + `driver_filter` varchar(20) DEFAULT NULL, + `driver_filter_annotation` varchar(80) DEFAULT NULL, + `driver_tiers_filter` varchar(50) DEFAULT NULL, + `driver_tiers_filter_annotation` varchar(80) DEFAULT NULL, + PRIMARY KEY (`alteration_event_id`,`genetic_profile_id`,`sample_id`), + FOREIGN KEY (`genetic_profile_id`) REFERENCES `genetic_profile` (`genetic_profile_id`) ON DELETE CASCADE, + FOREIGN KEY (`sample_id`) REFERENCES `sample` (`internal_id`) ON DELETE CASCADE, + KEY (`driver_filter`), + KEY (`driver_tiers_filter`) ) COMMENT='Alteration driver annotation'; -- -------------------------------------------------------- CREATE TABLE `mutation_event` ( - `MUTATION_EVENT_ID` int(255) NOT NULL auto_increment, - `ENTREZ_GENE_ID` int(11) NOT NULL, - `CHR` varchar(5), - `START_POSITION` bigint(20), - `END_POSITION` bigint(20), - `REFERENCE_ALLELE` text, - `TUMOR_SEQ_ALLELE` text, - `PROTEIN_CHANGE` varchar(255), - `MUTATION_TYPE` varchar(255) COMMENT 'e.g. Missense, Nonsence, etc.', - `NCBI_BUILD` varchar(10), - `STRAND` varchar(2), - `VARIANT_TYPE` varchar(15), - `DB_SNP_RS` varchar(25), - `DB_SNP_VAL_STATUS` varchar(255), - `REFSEQ_MRNA_ID` varchar(64), - `CODON_CHANGE` varchar(255), - `UNIPROT_ACCESSION` varchar(64), - `PROTEIN_POS_START` int(11), - `PROTEIN_POS_END` int(11), - `CANONICAL_TRANSCRIPT` boolean, - `KEYWORD` varchar(255) DEFAULT NULL COMMENT 'e.g. truncating, V200 Missense, E338del, ', - KEY (`KEYWORD`), - PRIMARY KEY (`MUTATION_EVENT_ID`), - KEY `KEY_MUTATION_EVENT_DETAILS` (`CHR`, `START_POSITION`, `END_POSITION`, `TUMOR_SEQ_ALLELE`(240), `ENTREZ_GENE_ID`, `PROTEIN_CHANGE`, `MUTATION_TYPE`), - FOREIGN KEY (`ENTREZ_GENE_ID`) REFERENCES `gene` (`ENTREZ_GENE_ID`), - INDEX (`MUTATION_TYPE`) + `mutation_event_id` int(255) NOT NULL AUTO_INCREMENT, + `entrez_gene_id` int(11) NOT NULL, + `chr` varchar(5) DEFAULT NULL, + `start_position` bigint(20) DEFAULT NULL, + `end_position` bigint(20) DEFAULT NULL, + `reference_allele` text, + `tumor_seq_allele` text, + `protein_change` varchar(255) DEFAULT NULL, + `mutation_type` varchar(255) DEFAULT NULL COMMENT 'e.g. Missense, Nonsence, etc.', + `ncbi_build` varchar(10) DEFAULT NULL, + `strand` varchar(2) DEFAULT NULL, + `variant_type` varchar(15) DEFAULT NULL, + `db_snp_rs` varchar(25) DEFAULT NULL, + `db_snp_val_status` varchar(255) DEFAULT NULL, + `refseq_mrna_id` varchar(64) DEFAULT NULL, + `codon_change` varchar(255) DEFAULT NULL, + `uniprot_accession` varchar(64) DEFAULT NULL, + `protein_pos_start` int(11) DEFAULT NULL, + `protein_pos_end` int(11) DEFAULT NULL, + `canonical_transcript` tinyint(1) DEFAULT NULL, + `keyword` varchar(255) DEFAULT NULL COMMENT 'e.g. truncating, V200 Missense, E338del, ', + KEY (`keyword`), + PRIMARY KEY (`mutation_event_id`), + KEY `key_mutation_event_details` (`chr`,`start_position`,`end_position`,`tumor_seq_allele`(240),`entrez_gene_id`,`protein_change`,`mutation_type`), + FOREIGN KEY (`entrez_gene_id`) REFERENCES `gene` (`entrez_gene_id`), + KEY (`mutation_type`) ) COMMENT='Mutation Data'; -- -------------------------------------------------------- CREATE TABLE `mutation` ( - `MUTATION_EVENT_ID` int(255) NOT NULL, - `GENETIC_PROFILE_ID` int(11) NOT NULL, - `SAMPLE_ID` int(11) NOT NULL, - `ENTREZ_GENE_ID` int(11) NOT NULL, - `CENTER` varchar(100), - `SEQUENCER` varchar(255), - `MUTATION_STATUS` varchar(25) COMMENT 'Germline, Somatic or LOH.', - `VALIDATION_STATUS` varchar(25), - `TUMOR_SEQ_ALLELE1` TEXT, - `TUMOR_SEQ_ALLELE2` TEXT, - `MATCHED_NORM_SAMPLE_BARCODE` varchar(255), - `MATCH_NORM_SEQ_ALLELE1` TEXT, - `MATCH_NORM_SEQ_ALLELE2` TEXT, - `TUMOR_VALIDATION_ALLELE1` TEXT, - `TUMOR_VALIDATION_ALLELE2` TEXT, - `MATCH_NORM_VALIDATION_ALLELE1` TEXT, - `MATCH_NORM_VALIDATION_ALLELE2` TEXT, - `VERIFICATION_STATUS` varchar(10), - `SEQUENCING_PHASE` varchar(100), - `SEQUENCE_SOURCE` varchar(255) NOT NULL, - `VALIDATION_METHOD` varchar(255), - `SCORE` varchar(100), - `BAM_FILE` varchar(255), - `TUMOR_ALT_COUNT` int(11), - `TUMOR_REF_COUNT` int(11), - `NORMAL_ALT_COUNT` int(11), - `NORMAL_REF_COUNT` int(11), - `AMINO_ACID_CHANGE` varchar(255), - `ANNOTATION_JSON` JSON, - UNIQUE KEY `UQ_MUTATION_EVENT_ID_GENETIC_PROFILE_ID_SAMPLE_ID` (`MUTATION_EVENT_ID`,`GENETIC_PROFILE_ID`,`SAMPLE_ID`), -- Constraint to block duplicated mutation entries - KEY (`GENETIC_PROFILE_ID`,`ENTREZ_GENE_ID`), - KEY (`GENETIC_PROFILE_ID`,`SAMPLE_ID`), - KEY (`GENETIC_PROFILE_ID`), - KEY (`ENTREZ_GENE_ID`), - KEY (`SAMPLE_ID`), - KEY (`MUTATION_EVENT_ID`), - FOREIGN KEY (`MUTATION_EVENT_ID`) REFERENCES `mutation_event` (`MUTATION_EVENT_ID`), - FOREIGN KEY (`ENTREZ_GENE_ID`) REFERENCES `gene` (`ENTREZ_GENE_ID`), - FOREIGN KEY (`GENETIC_PROFILE_ID`) REFERENCES `genetic_profile` (`GENETIC_PROFILE_ID`) ON DELETE CASCADE, - FOREIGN KEY (`SAMPLE_ID`) REFERENCES `sample` (`INTERNAL_ID`) ON DELETE CASCADE + `mutation_event_id` int(255) NOT NULL, + `genetic_profile_id` int(11) NOT NULL, + `sample_id` int(11) NOT NULL, + `entrez_gene_id` int(11) NOT NULL, + `center` varchar(100) DEFAULT NULL, + `sequencer` varchar(255) DEFAULT NULL, + `mutation_status` varchar(25) DEFAULT NULL COMMENT 'Germline, Somatic or LOH.', + `validation_status` varchar(25) DEFAULT NULL, + `tumor_seq_allele1` text, + `tumor_seq_allele2` text, + `matched_norm_sample_barcode` varchar(255) DEFAULT NULL, + `match_norm_seq_allele1` text, + `match_norm_seq_allele2` text, + `tumor_validation_allele1` text, + `tumor_validation_allele2` text, + `match_norm_validation_allele1` text, + `match_norm_validation_allele2` text, + `verification_status` varchar(10) DEFAULT NULL, + `sequencing_phase` varchar(100) DEFAULT NULL, + `sequence_source` varchar(255) NOT NULL, + `validation_method` varchar(255) DEFAULT NULL, + `score` varchar(100) DEFAULT NULL, + `bam_file` varchar(255) DEFAULT NULL, + `tumor_alt_count` int(11) DEFAULT NULL, + `tumor_ref_count` int(11) DEFAULT NULL, + `normal_alt_count` int(11) DEFAULT NULL, + `normal_ref_count` int(11) DEFAULT NULL, + `amino_acid_change` varchar(255) DEFAULT NULL, + `annotation_json` json DEFAULT NULL, + UNIQUE KEY `uq_mutation_event_id_genetic_profile_id_sample_id` (`mutation_event_id`,`genetic_profile_id`,`sample_id`), -- Constraint to block duplicated mutation entries + KEY (`genetic_profile_id`,`entrez_gene_id`), + KEY (`genetic_profile_id`,`sample_id`), + KEY (`genetic_profile_id`), + KEY (`entrez_gene_id`), + KEY (`sample_id`), + KEY (`mutation_event_id`), + FOREIGN KEY (`mutation_event_id`) REFERENCES `mutation_event` (`mutation_event_id`), + FOREIGN KEY (`entrez_gene_id`) REFERENCES `gene` (`entrez_gene_id`), + FOREIGN KEY (`genetic_profile_id`) REFERENCES `genetic_profile` (`genetic_profile_id`) ON DELETE CASCADE, + FOREIGN KEY (`sample_id`) REFERENCES `sample` (`internal_id`) ON DELETE CASCADE ) COMMENT='Mutation Data Details'; -- -------------------------------------------------------- CREATE TABLE `mutation_count_by_keyword` ( - `GENETIC_PROFILE_ID` int(11) NOT NULL, - `KEYWORD` varchar(255) DEFAULT NULL, - `ENTREZ_GENE_ID` int(11) NOT NULL, - `KEYWORD_COUNT` int NOT NULL, - `GENE_COUNT` int NOT NULL, - KEY (`GENETIC_PROFILE_ID`,`KEYWORD`), - FOREIGN KEY (`GENETIC_PROFILE_ID`) REFERENCES `genetic_profile` (`GENETIC_PROFILE_ID`) ON DELETE CASCADE, - FOREIGN KEY (`ENTREZ_GENE_ID`) REFERENCES `gene` (`ENTREZ_GENE_ID`) ON DELETE CASCADE + `genetic_profile_id` int(11) NOT NULL, + `keyword` varchar(255) DEFAULT NULL, + `entrez_gene_id` int(11) NOT NULL, + `keyword_count` int(11) NOT NULL, + `gene_count` int(11) NOT NULL, + KEY (`genetic_profile_id`,`keyword`), + FOREIGN KEY (`genetic_profile_id`) REFERENCES `genetic_profile` (`genetic_profile_id`) ON DELETE CASCADE, + FOREIGN KEY (`entrez_gene_id`) REFERENCES `gene` (`entrez_gene_id`) ON DELETE CASCADE ); -- -------------------------------------------------------- CREATE TABLE `clinical_patient` ( - `INTERNAL_ID` int(11) NOT NULL, - `ATTR_ID` varchar(255) NOT NULL, - `ATTR_VALUE` varchar(255) NOT NULL, - PRIMARY KEY (`INTERNAL_ID`, `ATTR_ID`), - FOREIGN KEY (`INTERNAL_ID`) REFERENCES `patient` (`INTERNAL_ID`) ON DELETE CASCADE + `internal_id` int(11) NOT NULL, + `attr_id` varchar(255) NOT NULL, + `attr_value` varchar(255) NOT NULL, + PRIMARY KEY (`internal_id`,`attr_id`), + FOREIGN KEY (`internal_id`) REFERENCES `patient` (`internal_id`) ON DELETE CASCADE ); -- -------------------------------------------------------- CREATE TABLE `clinical_sample` ( - `INTERNAL_ID` int(11) NOT NULL, - `ATTR_ID` varchar(255) NOT NULL, - `ATTR_VALUE` varchar(255) NOT NULL, - PRIMARY KEY (`INTERNAL_ID`,`ATTR_ID`), - FOREIGN KEY (`INTERNAL_ID`) REFERENCES `sample` (`INTERNAL_ID`) ON DELETE CASCADE + `internal_id` int(11) NOT NULL, + `attr_id` varchar(255) NOT NULL, + `attr_value` varchar(255) NOT NULL, + PRIMARY KEY (`internal_id`,`attr_id`), + FOREIGN KEY (`internal_id`) REFERENCES `sample` (`internal_id`) ON DELETE CASCADE ); -- -------------------------------------------------------- CREATE TABLE `clinical_attribute_meta` ( - `ATTR_ID` varchar(255) NOT NULL, - `DISPLAY_NAME` varchar(255) NOT NULL, - `DESCRIPTION` varchar(2048) NOT NULL, - `DATATYPE` varchar(255) NOT NULL COMMENT 'NUMBER, BOOLEAN, or STRING', - `PATIENT_ATTRIBUTE` BOOLEAN NOT NULL, - `PRIORITY` varchar(255) NOT NULL, - `CANCER_STUDY_ID` int(11) NOT NULL, - PRIMARY KEY (`ATTR_ID`,`CANCER_STUDY_ID`), - FOREIGN KEY (`CANCER_STUDY_ID`) REFERENCES `cancer_study` (`CANCER_STUDY_ID`) ON DELETE CASCADE + `attr_id` varchar(255) NOT NULL, + `display_name` varchar(255) NOT NULL, + `description` varchar(2048) NOT NULL, + `datatype` varchar(255) NOT NULL COMMENT 'NUMBER, BOOLEAN, or STRING', + `patient_attribute` tinyint(1) NOT NULL, + `priority` varchar(255) NOT NULL, + `cancer_study_id` int(11) NOT NULL, + PRIMARY KEY (`attr_id`,`cancer_study_id`), + FOREIGN KEY (`cancer_study_id`) REFERENCES `cancer_study` (`cancer_study_id`) ON DELETE CASCADE ); -- -------------------------------------------------------- CREATE TABLE `mut_sig` ( - `CANCER_STUDY_ID` int(11) NOT NULL, - `ENTREZ_GENE_ID` int(11) NOT NULL, - `RANK` int(11) NOT NULL, - `NumBasesCovered` int(11) NOT NULL, - `NumMutations` int(11) NOT NULL, - `P_VALUE` float NOT NULL, - `Q_VALUE` float NOT NULL, - PRIMARY KEY (`CANCER_STUDY_ID`, `ENTREZ_GENE_ID`), - FOREIGN KEY (`CANCER_STUDY_ID`) REFERENCES `cancer_study` (`CANCER_STUDY_ID`) ON DELETE CASCADE, - FOREIGN KEY (`ENTREZ_GENE_ID`) REFERENCES `gene` (`ENTREZ_GENE_ID`) + `cancer_study_id` int(11) NOT NULL, + `entrez_gene_id` int(11) NOT NULL, + `rank` int(11) NOT NULL, + `numbasescovered` int(11) NOT NULL, + `nummutations` int(11) NOT NULL, + `p_value` float NOT NULL, + `q_value` float NOT NULL, + PRIMARY KEY (`cancer_study_id`,`entrez_gene_id`), + FOREIGN KEY (`cancer_study_id`) REFERENCES `cancer_study` (`cancer_study_id`) ON DELETE CASCADE, + FOREIGN KEY (`entrez_gene_id`) REFERENCES `gene` (`entrez_gene_id`) ); -- -------------------------------------------------------- CREATE TABLE `gistic` ( - `GISTIC_ROI_ID` bigint(20) NOT NULL auto_increment, - `CANCER_STUDY_ID` int(11) NOT NULL, - `CHROMOSOME` int(11) NOT NULL, - `CYTOBAND` varchar(255) NOT NULL, - `WIDE_PEAK_START` int(11) NOT NULL, - `WIDE_PEAK_END` int(11) NOT NULL, - `Q_VALUE` double NOT NULL, - `AMP` tinyint(1) NOT NULL, - PRIMARY KEY (`GISTIC_ROI_ID`), - FOREIGN KEY (`CANCER_STUDY_ID`) REFERENCES `cancer_study` (`CANCER_STUDY_ID`) ON DELETE CASCADE + `gistic_roi_id` bigint(20) NOT NULL AUTO_INCREMENT, + `cancer_study_id` int(11) NOT NULL, + `chromosome` int(11) NOT NULL, + `cytoband` varchar(255) NOT NULL, + `wide_peak_start` int(11) NOT NULL, + `wide_peak_end` int(11) NOT NULL, + `q_value` double NOT NULL, + `amp` tinyint(1) NOT NULL, + PRIMARY KEY (`gistic_roi_id`), + FOREIGN KEY (`cancer_study_id`) REFERENCES `cancer_study` (`cancer_study_id`) ON DELETE CASCADE ); -- -------------------------------------------------------- CREATE TABLE `gistic_to_gene` ( - `GISTIC_ROI_ID` bigint(20) NOT NULL, - `ENTREZ_GENE_ID` int(11) NOT NULL, - PRIMARY KEY(`GISTIC_ROI_ID`, `ENTREZ_GENE_ID`), - FOREIGN KEY (`ENTREZ_GENE_ID`) REFERENCES `gene` (`ENTREZ_GENE_ID`), - FOREIGN KEY (`GISTIC_ROI_ID`) REFERENCES `gistic` (`GISTIC_ROI_ID`) ON DELETE CASCADE + `gistic_roi_id` bigint(20) NOT NULL, + `entrez_gene_id` int(11) NOT NULL, + PRIMARY KEY (`gistic_roi_id`,`entrez_gene_id`), + FOREIGN KEY (`entrez_gene_id`) REFERENCES `gene` (`entrez_gene_id`), + FOREIGN KEY (`gistic_roi_id`) REFERENCES `gistic` (`gistic_roi_id`) ON DELETE CASCADE ); -- -------------------------------------------------------- CREATE TABLE `cna_event` ( - `CNA_EVENT_ID` int(255) NOT NULL auto_increment, - `ENTREZ_GENE_ID` int(11) NOT NULL, - `ALTERATION` tinyint NOT NULL, - PRIMARY KEY (`CNA_EVENT_ID`), - UNIQUE (`ENTREZ_GENE_ID`, `ALTERATION`), - FOREIGN KEY (`ENTREZ_GENE_ID`) REFERENCES `gene` (`ENTREZ_GENE_ID`), - INDEX (`ALTERATION`) + `cna_event_id` int(255) NOT NULL AUTO_INCREMENT, + `entrez_gene_id` int(11) NOT NULL, + `alteration` tinyint(4) NOT NULL, + PRIMARY KEY (`cna_event_id`), + UNIQUE KEY (`entrez_gene_id`,`alteration`), + FOREIGN KEY (`entrez_gene_id`) REFERENCES `gene` (`entrez_gene_id`), + KEY (`alteration`) ); -- -------------------------------------------------------- CREATE TABLE `sample_cna_event` ( - `CNA_EVENT_ID` int(255) NOT NULL, - `SAMPLE_ID` int(11) NOT NULL, - `GENETIC_PROFILE_ID` int(11) NOT NULL, - `ANNOTATION_JSON` JSON, - KEY (`GENETIC_PROFILE_ID`,`SAMPLE_ID`), - PRIMARY KEY (`CNA_EVENT_ID`, `SAMPLE_ID`, `GENETIC_PROFILE_ID`), - FOREIGN KEY (`CNA_EVENT_ID`) REFERENCES `cna_event` (`CNA_EVENT_ID`), - FOREIGN KEY (`GENETIC_PROFILE_ID`) REFERENCES `genetic_profile` (`GENETIC_PROFILE_ID`) ON DELETE CASCADE, - FOREIGN KEY (`SAMPLE_ID`) REFERENCES `sample` (`INTERNAL_ID`) ON DELETE CASCADE + `cna_event_id` int(255) NOT NULL, + `sample_id` int(11) NOT NULL, + `genetic_profile_id` int(11) NOT NULL, + `annotation_json` json DEFAULT NULL, + KEY (`genetic_profile_id`,`sample_id`), + PRIMARY KEY (`cna_event_id`,`sample_id`,`genetic_profile_id`), + FOREIGN KEY (`cna_event_id`) REFERENCES `cna_event` (`cna_event_id`), + FOREIGN KEY (`genetic_profile_id`) REFERENCES `genetic_profile` (`genetic_profile_id`) ON DELETE CASCADE, + FOREIGN KEY (`sample_id`) REFERENCES `sample` (`internal_id`) ON DELETE CASCADE ); -- -------------------------------------------------------- CREATE TABLE `copy_number_seg` ( - `SEG_ID` bigint(20) NOT NULL auto_increment, - `CANCER_STUDY_ID` int(11) NOT NULL, - `SAMPLE_ID` int(11) NOT NULL, - `CHR` varchar(5) NOT NULL, - `START` int(11) NOT NULL, - `END` int(11) NOT NULL, - `NUM_PROBES` int(11) NOT NULL, - `SEGMENT_MEAN` double NOT NULL, - KEY (`CANCER_STUDY_ID`,`SAMPLE_ID`), - PRIMARY KEY (`SEG_ID`), - FOREIGN KEY (`CANCER_STUDY_ID`) REFERENCES `cancer_study` (`CANCER_STUDY_ID`) ON DELETE CASCADE, - FOREIGN KEY (`SAMPLE_ID`) REFERENCES `sample` (`INTERNAL_ID`) ON DELETE CASCADE + `seg_id` bigint(20) NOT NULL AUTO_INCREMENT, + `cancer_study_id` int(11) NOT NULL, + `sample_id` int(11) NOT NULL, + `chr` varchar(5) NOT NULL, + `start` int(11) NOT NULL, + `end` int(11) NOT NULL, + `num_probes` int(11) NOT NULL, + `segment_mean` double NOT NULL, + KEY (`cancer_study_id`,`sample_id`), + PRIMARY KEY (`seg_id`), + FOREIGN KEY (`cancer_study_id`) REFERENCES `cancer_study` (`cancer_study_id`) ON DELETE CASCADE, + FOREIGN KEY (`sample_id`) REFERENCES `sample` (`internal_id`) ON DELETE CASCADE ); -- -------------------------------------------------------- CREATE TABLE `copy_number_seg_file` ( - `SEG_FILE_ID` int(11) NOT NULL auto_increment, - `CANCER_STUDY_ID` int(11) NOT NULL, - `REFERENCE_GENOME_ID` varchar(10) NOT NULL, - `DESCRIPTION` varchar(255) NOT NULL, - `FILENAME` varchar(255) NOT NULL, - PRIMARY KEY(`SEG_FILE_ID`), - FOREIGN KEY (`CANCER_STUDY_ID`) REFERENCES `cancer_study` (`CANCER_STUDY_ID`) ON DELETE CASCADE + `seg_file_id` int(11) NOT NULL AUTO_INCREMENT, + `cancer_study_id` int(11) NOT NULL, + `reference_genome_id` varchar(10) NOT NULL, + `description` varchar(255) NOT NULL, + `filename` varchar(255) NOT NULL, + PRIMARY KEY(`seg_file_id`), + FOREIGN KEY (`cancer_study_id`) REFERENCES `cancer_study` (`cancer_study_id`) ON DELETE CASCADE ); -- -------------------------------------------------------- CREATE TABLE `cosmic_mutation` ( - `COSMIC_MUTATION_ID` varchar(30) NOT NULL, - `CHR` varchar(5), - `START_POSITION` bigint(20), - `REFERENCE_ALLELE` varchar(255), - `TUMOR_SEQ_ALLELE` varchar(255), - `STRAND` varchar(2), - `CODON_CHANGE` varchar(255), - `ENTREZ_GENE_ID` int(11) NOT NULL, - `PROTEIN_CHANGE` varchar(255) NOT NULL, - `COUNT` int(11) NOT NULL, - `KEYWORD` varchar(50) DEFAULT NULL, - KEY (`KEYWORD`), - PRIMARY KEY (`COSMIC_MUTATION_ID`), - FOREIGN KEY (`ENTREZ_GENE_ID`) REFERENCES `gene` (`ENTREZ_GENE_ID`) + `cosmic_mutation_id` varchar(30) NOT NULL, + `chr` varchar(5) DEFAULT NULL, + `start_position` bigint(20) DEFAULT NULL, + `reference_allele` varchar(255) DEFAULT NULL, + `tumor_seq_allele` varchar(255) DEFAULT NULL, + `strand` varchar(2) DEFAULT NULL, + `codon_change` varchar(255) DEFAULT NULL, + `entrez_gene_id` int(11) NOT NULL, + `protein_change` varchar(255) NOT NULL, + `count` int(11) NOT NULL, + `keyword` varchar(50) DEFAULT NULL, + KEY (`keyword`), + PRIMARY KEY (`cosmic_mutation_id`), + FOREIGN KEY (`entrez_gene_id`) REFERENCES `gene` (`entrez_gene_id`) ); -- -------------------------------------------------------- CREATE TABLE `clinical_event` ( - `CLINICAL_EVENT_ID` int NOT NULL auto_increment, - `PATIENT_ID` int(11) NOT NULL, - `START_DATE` int NOT NULL, - `STOP_DATE` int, - `EVENT_TYPE` varchar(20) NOT NULL, - PRIMARY KEY (`CLINICAL_EVENT_ID`), - KEY (`PATIENT_ID`, `EVENT_TYPE`), - FOREIGN KEY (`PATIENT_ID`) REFERENCES `patient` (`INTERNAL_ID`) ON DELETE CASCADE + `clinical_event_id` int(11) NOT NULL AUTO_INCREMENT, + `patient_id` int(11) NOT NULL, + `start_date` int(11) NOT NULL, + `stop_date` int(11) DEFAULT NULL, + `event_type` varchar(20) NOT NULL, + PRIMARY KEY (`clinical_event_id`), + KEY (`patient_id`,`event_type`), + FOREIGN KEY (`patient_id`) REFERENCES `patient` (`internal_id`) ON DELETE CASCADE ); -- -------------------------------------------------------- CREATE TABLE `clinical_event_data` ( - `CLINICAL_EVENT_ID` int(255) NOT NULL, - `KEY` varchar(255) NOT NULL, - `VALUE` varchar(5000) NOT NULL, - FOREIGN KEY (`CLINICAL_EVENT_ID`) REFERENCES `clinical_event` (`CLINICAL_EVENT_ID`) ON DELETE CASCADE + `clinical_event_id` int(255) NOT NULL, + `key` varchar(255) NOT NULL, + `value` varchar(5000) NOT NULL, + FOREIGN KEY (`clinical_event_id`) REFERENCES `clinical_event` (`clinical_event_id`) ON DELETE CASCADE ); -- -------------------------------------------------------- CREATE TABLE `reference_genome_gene` ( - `ENTREZ_GENE_ID` int(11) NOT NULL, - `REFERENCE_GENOME_ID` int(4) NOT NULL, - `CHR` varchar(5) DEFAULT NULL, - `CYTOBAND` varchar(64) DEFAULT NULL, - `START` bigint(20) DEFAULT NULL, - `END` bigint(20) DEFAULT NULL, - PRIMARY KEY (`ENTREZ_GENE_ID`,`REFERENCE_GENOME_ID`), - FOREIGN KEY (`REFERENCE_GENOME_ID`) REFERENCES `reference_genome` (`REFERENCE_GENOME_ID`) ON DELETE CASCADE, - FOREIGN KEY (`ENTREZ_GENE_ID`) REFERENCES `gene` (`ENTREZ_GENE_ID`) ON DELETE CASCADE + `entrez_gene_id` int(11) NOT NULL, + `reference_genome_id` int(4) NOT NULL, + `chr` varchar(5) DEFAULT NULL, + `cytoband` varchar(64) DEFAULT NULL, + `start` bigint(20) DEFAULT NULL, + `end` bigint(20) DEFAULT NULL, + PRIMARY KEY (`entrez_gene_id`,`reference_genome_id`), + FOREIGN KEY (`reference_genome_id`) REFERENCES `reference_genome` (`reference_genome_id`) ON DELETE CASCADE, + FOREIGN KEY (`entrez_gene_id`) REFERENCES `gene` (`entrez_gene_id`) ON DELETE CASCADE ); -- -------------------------------------------------------- CREATE TABLE `data_access_tokens` ( - `TOKEN` varchar(50) NOT NULL, - `USERNAME` varchar(128) NOT NULL, - `EXPIRATION` datetime NOT NULL, - `CREATION` datetime NOT NULL, - PRIMARY KEY (`TOKEN`), - FOREIGN KEY (`USERNAME`) REFERENCES `users` (`EMAIL`) ON DELETE CASCADE + `token` varchar(50) NOT NULL, + `username` varchar(128) NOT NULL, + `expiration` datetime NOT NULL, + `creation` datetime NOT NULL, + PRIMARY KEY (`token`), + FOREIGN KEY (`username`) REFERENCES `users` (`email`) ON DELETE CASCADE ); -- -------------------------------------------------------- CREATE TABLE `allele_specific_copy_number` ( - `MUTATION_EVENT_ID` int(255) NOT NULL, - `GENETIC_PROFILE_ID` int(11) NOT NULL, - `SAMPLE_ID` int(11) NOT NULL, - `ASCN_INTEGER_COPY_NUMBER` int DEFAULT NULL, - `ASCN_METHOD` varchar(24) NOT NULL, - `CCF_EXPECTED_COPIES_UPPER` float DEFAULT NULL, - `CCF_EXPECTED_COPIES` float DEFAULT NULL, - `CLONAL` varchar(16) DEFAULT NULL, - `MINOR_COPY_NUMBER` int DEFAULT NULL, - `EXPECTED_ALT_COPIES` int DEFAULT NULL, - `TOTAL_COPY_NUMBER` int DEFAULT NULL, - UNIQUE KEY `UQ_ASCN_MUTATION_EVENT_ID_GENETIC_PROFILE_ID_SAMPLE_ID` (`MUTATION_EVENT_ID`,`GENETIC_PROFILE_ID`,`SAMPLE_ID`), -- Constraint to block duplicated mutation entries - FOREIGN KEY (`MUTATION_EVENT_ID`) REFERENCES `mutation_event` (`MUTATION_EVENT_ID`), - FOREIGN KEY (`GENETIC_PROFILE_ID`) REFERENCES `genetic_profile` (`GENETIC_PROFILE_ID`) ON DELETE CASCADE, - FOREIGN KEY (`SAMPLE_ID`) REFERENCES `sample` (`INTERNAL_ID`) ON DELETE CASCADE + `mutation_event_id` int(255) NOT NULL, + `genetic_profile_id` int(11) NOT NULL, + `sample_id` int(11) NOT NULL, + `ascn_integer_copy_number` int(11) DEFAULT NULL, + `ascn_method` varchar(24) NOT NULL, + `ccf_expected_copies_upper` float DEFAULT NULL, + `ccf_expected_copies` float DEFAULT NULL, + `clonal` varchar(16) DEFAULT NULL, + `minor_copy_number` int(11) DEFAULT NULL, + `expected_alt_copies` int(11) DEFAULT NULL, + `total_copy_number` int(11) DEFAULT NULL, + UNIQUE KEY `uq_ascn_mutation_event_id_genetic_profile_id_sample_id` (`mutation_event_id`,`genetic_profile_id`,`sample_id`), -- Constraint to block duplicated mutation entries + FOREIGN KEY (`mutation_event_id`) REFERENCES `mutation_event` (`mutation_event_id`), + FOREIGN KEY (`genetic_profile_id`) REFERENCES `genetic_profile` (`genetic_profile_id`) ON DELETE CASCADE, + FOREIGN KEY (`sample_id`) REFERENCES `sample` (`internal_id`) ON DELETE CASCADE ); -- -------------------------------------------------------- CREATE TABLE `info` ( - `DB_SCHEMA_VERSION` varchar(24), - `GENESET_VERSION` varchar(24) + `db_schema_version` varchar(24) DEFAULT NULL, + `geneset_version` varchar(24) DEFAULT NULL ); -- -------------------------------------------------------- CREATE TABLE `resource_definition` ( - `RESOURCE_ID` varchar(255) NOT NULL, - `DISPLAY_NAME` varchar(255) NOT NULL, - `DESCRIPTION` varchar(2048) DEFAULT NULL, - `RESOURCE_TYPE` ENUM('STUDY', 'PATIENT', 'SAMPLE') NOT NULL, - `OPEN_BY_DEFAULT` BOOLEAN DEFAULT 0, - `PRIORITY` int(11) NOT NULL, - `CANCER_STUDY_ID` int(11) NOT NULL, - PRIMARY KEY (`RESOURCE_ID`,`CANCER_STUDY_ID`), - FOREIGN KEY (`CANCER_STUDY_ID`) REFERENCES `cancer_study` (`CANCER_STUDY_ID`) ON DELETE CASCADE + `resource_id` varchar(255) NOT NULL, + `display_name` varchar(255) NOT NULL, + `description` varchar(2048) DEFAULT NULL, + `resource_type` enum('STUDY','PATIENT','SAMPLE') NOT NULL, + `open_by_default` tinyint(1) DEFAULT '0', + `priority` int(11) NOT NULL, + `cancer_study_id` int(11) NOT NULL, + PRIMARY KEY (`resource_id`,`cancer_study_id`), + FOREIGN KEY (`cancer_study_id`) REFERENCES `cancer_study` (`cancer_study_id`) ON DELETE CASCADE ); -- -------------------------------------------------------- CREATE TABLE `resource_sample` ( - `INTERNAL_ID` int(11) NOT NULL, - `RESOURCE_ID` varchar(255) NOT NULL, - `URL` varchar(255) NOT NULL, - PRIMARY KEY (`INTERNAL_ID`, `RESOURCE_ID`, `URL`), - FOREIGN KEY (`INTERNAL_ID`) REFERENCES `sample` (`INTERNAL_ID`) ON DELETE CASCADE + `internal_id` int(11) NOT NULL, + `resource_id` varchar(255) NOT NULL, + `url` varchar(255) NOT NULL, + PRIMARY KEY (`internal_id`,`resource_id`,`url`), + FOREIGN KEY (`internal_id`) REFERENCES `sample` (`internal_id`) ON DELETE CASCADE ); -- -------------------------------------------------------- CREATE TABLE `resource_patient` ( - `INTERNAL_ID` int(11) NOT NULL, - `RESOURCE_ID` varchar(255) NOT NULL, - `URL` varchar(255) NOT NULL, - PRIMARY KEY (`INTERNAL_ID`, `RESOURCE_ID`, `URL`), - FOREIGN KEY (`INTERNAL_ID`) REFERENCES `patient` (`INTERNAL_ID`) ON DELETE CASCADE + `internal_id` int(11) NOT NULL, + `resource_id` varchar(255) NOT NULL, + `url` varchar(255) NOT NULL, + PRIMARY KEY (`internal_id`,`resource_id`,`url`), + FOREIGN KEY (`internal_id`) REFERENCES `patient` (`internal_id`) ON DELETE CASCADE ); -- -------------------------------------------------------- CREATE TABLE `resource_study` ( - `INTERNAL_ID` int(11) NOT NULL, - `RESOURCE_ID` varchar(255) NOT NULL, - `URL` varchar(255) NOT NULL, - PRIMARY KEY (`INTERNAL_ID`, `RESOURCE_ID`, `URL`), - FOREIGN KEY (`INTERNAL_ID`) REFERENCES `cancer_study` (`CANCER_STUDY_ID`) ON DELETE CASCADE + `internal_id` int(11) NOT NULL, + `resource_id` varchar(255) NOT NULL, + `url` varchar(255) NOT NULL, + PRIMARY KEY (`internal_id`,`resource_id`,`url`), + FOREIGN KEY (`internal_id`) REFERENCES `cancer_study` (`cancer_study_id`) ON DELETE CASCADE ); -- THIS MUST BE KEPT IN SYNC WITH db.version PROPERTY IN pom.xml -INSERT INTO info VALUES ('2.13.1', NULL); +INSERT INTO info VALUES ('3.0.0', NULL); diff --git a/src/main/resources/db-scripts/migration.sql b/src/main/resources/db-scripts/migration.sql index 78c0d25ea14..fb4fd6f16aa 100644 --- a/src/main/resources/db-scripts/migration.sql +++ b/src/main/resources/db-scripts/migration.sql @@ -1027,4 +1027,9 @@ ALTER TABLE `clinical_event_data` MODIFY COLUMN `VALUE` varchar(3000) NOT NULL; CREATE INDEX idx_clinical_event_key ON clinical_event_data (`KEY`); CREATE INDEX idx_clinical_event_value ON clinical_event_data (`VALUE`); CREATE INDEX idx_sample_stable_id ON sample (`STABLE_ID`); -UPDATE `info` SET `DB_SCHEMA_VERSION`="2.13.1"; \ No newline at end of file +UPDATE `info` SET `DB_SCHEMA_VERSION`="2.13.1"; + +-- TODO: comprehensive conversion script needed here +##version: 3.0.0 +DROP TABLE IF EXISTS `drug`; +UPDATE `info` SET `DB_SCHEMA_VERSION`="3.0.0"; diff --git a/src/main/resources/org/cbioportal/persistence/mybatis/AlterationCountsMapper.xml b/src/main/resources/org/cbioportal/persistence/mybatis/AlterationCountsMapper.xml index f9e53a35b08..6487c7d3574 100644 --- a/src/main/resources/org/cbioportal/persistence/mybatis/AlterationCountsMapper.xml +++ b/src/main/resources/org/cbioportal/persistence/mybatis/AlterationCountsMapper.xml @@ -4,11 +4,12 @@ - + - + @@ -210,9 +212,9 @@ LEFT JOIN alteration_driver_annotation ON - mutation.MUTATION_EVENT_ID = alteration_driver_annotation.ALTERATION_EVENT_ID - AND mutation.GENETIC_PROFILE_ID = alteration_driver_annotation.GENETIC_PROFILE_ID - AND mutation.SAMPLE_ID = alteration_driver_annotation.SAMPLE_ID + mutation.mutation_event_id = alteration_driver_annotation.alteration_event_id + AND mutation.genetic_profile_id = alteration_driver_annotation.genetic_profile_id + AND mutation.sample_id = alteration_driver_annotation.sample_id @@ -224,12 +226,12 @@ LEFT JOIN alteration_driver_annotation ON - sample_cna_event.CNA_EVENT_ID = alteration_driver_annotation.ALTERATION_EVENT_ID - AND sample_cna_event.GENETIC_PROFILE_ID = alteration_driver_annotation.GENETIC_PROFILE_ID - AND sample_cna_event.SAMPLE_ID = alteration_driver_annotation.SAMPLE_ID + sample_cna_event.cna_event_id = alteration_driver_annotation.alteration_event_id + AND sample_cna_event.genetic_profile_id = alteration_driver_annotation.genetic_profile_id + AND sample_cna_event.sample_id = alteration_driver_annotation.sample_id - + @@ -238,18 +240,18 @@ LEFT JOIN alteration_driver_annotation ON - structural_variant.INTERNAL_ID = alteration_driver_annotation.ALTERATION_EVENT_ID - AND structural_variant.GENETIC_PROFILE_ID = alteration_driver_annotation.GENETIC_PROFILE_ID - AND structural_variant.SAMPLE_ID = alteration_driver_annotation.SAMPLE_ID + structural_variant.internal_id = alteration_driver_annotation.alteration_event_id + AND structural_variant.genetic_profile_id = alteration_driver_annotation.genetic_profile_id + AND structural_variant.sample_id = alteration_driver_annotation.sample_id ( - structural_variant.SITE2_ENTREZ_GENE_ID != structural_variant.SITE1_ENTREZ_GENE_ID + structural_variant.site2_entrez_gene_id != structural_variant.site1_entrez_gene_id OR - structural_variant.SITE1_ENTREZ_GENE_ID IS NULL + structural_variant.site1_entrez_gene_id IS NULL ) @@ -260,14 +262,14 @@ - OR LOWER(DRIVER_FILTER) = 'putative_driver' + OR LOWER(driver_filter) = 'putative_driver' - OR LOWER(DRIVER_FILTER) = 'putative_passenger' + OR LOWER(driver_filter) = 'putative_passenger' - OR DRIVER_FILTER IS NULL - OR LOWER(DRIVER_FILTER) IN ('unknown', 'na', '') + OR driver_filter IS NULL + OR LOWER(driver_filter) IN ('unknown', 'na', '') @@ -280,22 +282,20 @@ - + - + - OR DRIVER_TIERS_FILTER IN - - #{item} - + OR driver_tiers_filter IN + #{item} - OR DRIVER_TIERS_FILTER IS NULL - OR LOWER(DRIVER_TIERS_FILTER) IN ('', 'na', 'unknown') + OR driver_tiers_filter IS NULL + OR LOWER(driver_tiers_filter) IN ('', 'na', 'unknown') @@ -307,7 +307,7 @@ - + @@ -316,15 +316,15 @@ OR - LOWER(mutation.MUTATION_STATUS) LIKE '%germline%' + LOWER(mutation.mutation_status) LIKE '%germline%' OR - LOWER(mutation.MUTATION_STATUS) = 'somatic' + LOWER(mutation.mutation_status) = 'somatic' OR - (LOWER(mutation.MUTATION_STATUS) != 'somatic' AND LOWER(mutation.MUTATION_STATUS) NOT LIKE '%germline%') + (LOWER(mutation.mutation_status) != 'somatic' AND LOWER(mutation.mutation_status) NOT LIKE '%germline%') @@ -345,15 +345,15 @@ OR - LOWER(SV_STATUS) = 'germline' + LOWER(sv_status) = 'germline' OR - LOWER(SV_STATUS) = 'somatic' + LOWER(sv_status) = 'somatic' OR - LOWER(SV_STATUS) NOT IN ('germline', 'somatic') + LOWER(sv_status) NOT IN ('germline', 'somatic') @@ -372,64 +372,59 @@ AND NULL - AND JoinedTable.ENTREZ_GENE_ID IN - - #{entrezGeneId} - + AND JoinedTable.entrez_gene_id IN + #{entrezGeneId} - + AND NULL - AND cna_event.ENTREZ_GENE_ID IN - - #{entrezGeneId} - + AND cna_event.entrez_gene_id IN + #{entrezGeneId} SELECT - as CASE_ID, - mutation.ENTREZ_GENE_ID, - gene.HUGO_GENE_SYMBOL, - mutation_event.MUTATION_TYPE - FROM mutation - INNER JOIN mutation_event ON mutation_event.MUTATION_EVENT_ID = mutation.MUTATION_EVENT_ID - INNER JOIN gene ON mutation.ENTREZ_GENE_ID = gene.ENTREZ_GENE_ID - INNER JOIN genetic_profile ON mutation.GENETIC_PROFILE_ID = genetic_profile.GENETIC_PROFILE_ID - INNER JOIN sample ON sample.INTERNAL_ID = mutation.SAMPLE_ID - INNER JOIN patient ON sample.PATIENT_ID = patient.INTERNAL_ID + AS case_id, + mutation.entrez_gene_id AS "entrez_gene_id", + gene.hugo_gene_symbol AS "hugo_gene_symbol", + mutation_event.mutation_type + FROM + mutation + INNER JOIN mutation_event ON mutation_event.mutation_event_id = mutation.mutation_event_id + INNER JOIN gene ON mutation.entrez_gene_id = gene.entrez_gene_id + INNER JOIN genetic_profile ON mutation.genetic_profile_id = genetic_profile.genetic_profile_id + INNER JOIN sample ON sample.internal_id = mutation.sample_id + INNER JOIN patient ON sample.patient_id = patient.internal_id NULL - LOWER(mutation_event.MUTATION_TYPE) + LOWER(mutation_event.mutation_type) - - NOT IN - - - IN - - - - LOWER(#{type}) - + + NOT IN + + + IN + + + LOWER(#{type}) - + @@ -437,57 +432,56 @@ SELECT - as CASE_ID, - cna_event.ENTREZ_GENE_ID, - gene.HUGO_GENE_SYMBOL, - CAST(cna_event.ALTERATION AS CHAR(3)) - FROM cna_event - INNER JOIN sample_cna_event ON cna_event.CNA_EVENT_ID = sample_cna_event.CNA_EVENT_ID - INNER JOIN gene ON cna_event.ENTREZ_GENE_ID = gene.ENTREZ_GENE_ID - INNER JOIN genetic_profile ON sample_cna_event.GENETIC_PROFILE_ID = genetic_profile.GENETIC_PROFILE_ID - INNER JOIN patient ON patient.CANCER_STUDY_ID = genetic_profile.CANCER_STUDY_ID - INNER JOIN sample ON sample.PATIENT_ID = patient.INTERNAL_ID AND sample.INTERNAL_ID = sample_cna_event.SAMPLE_ID - INNER JOIN cancer_study ON cancer_study.CANCER_STUDY_ID = genetic_profile.CANCER_STUDY_ID + AS case_id, + cna_event.entrez_gene_id AS "entrez_gene_id", + gene.hugo_gene_symbol AS "hugo_gene_symbol", + CAST(cna_event.alteration AS CHAR(3)) + FROM + cna_event + INNER JOIN sample_cna_event ON cna_event.cna_event_id = sample_cna_event.cna_event_id + INNER JOIN gene ON cna_event.entrez_gene_id = gene.entrez_gene_id + INNER JOIN genetic_profile ON sample_cna_event.genetic_profile_id = genetic_profile.genetic_profile_id + INNER JOIN patient ON patient.cancer_study_id = genetic_profile.cancer_study_id + INNER JOIN sample ON sample.patient_id = patient.internal_id AND sample.internal_id = sample_cna_event.sample_id + INNER JOIN cancer_study ON cancer_study.cancer_study_id = genetic_profile.cancer_study_id NULL - cna_event.ALTERATION IN - - #{type} - + cna_event.alteration IN + #{type} - + - + - SELECT - caseUniqueId as "CASE_ID", - entrezGeneId as "ENTREZ_GENE_ID", - hugoGeneSymbol as "HUGO_GENE_SYMBOL", - NULL as "DUMMY_COLUMN" + SELECT + caseUniqueId AS "case_id", + entrez_gene_id, + hugo_gene_symbol, + 7 AS "DUMMY_COLUMN" FROM - (SELECT - gene.ENTREZ_GENE_ID AS "entrezGeneId", - gene.HUGO_GENE_SYMBOL AS "hugoGeneSymbol", - as "caseUniqueId", - as "caseStableId", - genetic_profile.GENETIC_PROFILE_ID as "geneticProfileId", - structural_variant.SV_STATUS as "SV_STATUS" + (SELECT + gene.entrez_gene_id AS "entrez_gene_id", + gene.hugo_gene_symbol AS "hugo_gene_symbol", + AS "caseUniqueId", + AS "caseStableId", + genetic_profile.genetic_profile_id AS "geneticProfileId", + structural_variant.sv_status AS "sv_status" FROM structural_variant - INNER JOIN genetic_profile ON structural_variant.GENETIC_PROFILE_ID = genetic_profile.GENETIC_PROFILE_ID - INNER JOIN sample ON structural_variant.SAMPLE_ID = sample.INTERNAL_ID - INNER JOIN patient ON sample.PATIENT_ID = patient.INTERNAL_ID - INNER JOIN gene ON structural_variant.SITE1_ENTREZ_GENE_ID = gene.ENTREZ_GENE_ID + INNER JOIN genetic_profile ON structural_variant.genetic_profile_id = genetic_profile.genetic_profile_id + INNER JOIN sample ON structural_variant.sample_id = sample.internal_id + INNER JOIN patient ON sample.patient_id = patient.internal_id + INNER JOIN gene ON structural_variant.site1_entrez_gene_id = gene.entrez_gene_id @@ -495,19 +489,19 @@ UNION ALL - SELECT - gene.ENTREZ_GENE_ID AS entrezGeneId, - gene.HUGO_GENE_SYMBOL AS hugoGeneSymbol, - as caseUniqueId, - as caseStableId, - genetic_profile.GENETIC_PROFILE_ID as geneticProfileId, - structural_variant.SV_STATUS as SV_STATUS + SELECT + gene.entrez_gene_id AS "entrez_gene_id", + gene.hugo_gene_symbol AS "hugo_gene_symbol", + AS caseUniqueId, + AS caseStableId, + genetic_profile.genetic_profile_id AS geneticProfileId, + structural_variant.sv_status AS sv_status FROM structural_variant - INNER JOIN genetic_profile ON structural_variant.GENETIC_PROFILE_ID = genetic_profile.GENETIC_PROFILE_ID - INNER JOIN sample ON structural_variant.SAMPLE_ID = sample.INTERNAL_ID - INNER JOIN patient ON sample.PATIENT_ID = patient.INTERNAL_ID - INNER JOIN gene ON structural_variant.SITE2_ENTREZ_GENE_ID = gene.ENTREZ_GENE_ID + INNER JOIN genetic_profile ON structural_variant.genetic_profile_id = genetic_profile.genetic_profile_id + INNER JOIN sample ON structural_variant.sample_id = sample.internal_id + INNER JOIN patient ON sample.patient_id = patient.internal_id + INNER JOIN gene ON structural_variant.site2_entrez_gene_id = gene.entrez_gene_id @@ -521,7 +515,7 @@ - + @@ -534,15 +528,11 @@ AND ${geneticProfileIdentifier} = #{${identifiers}[0].molecularProfileId} AND IN - - #{id.caseId} - + #{id.caseId} - AND (${geneticProfileIdentifier}, ) IN - - (#{id.molecularProfileId}, #{id.caseId}) - + AND (${geneticProfileIdentifier},) IN + (#{id.molecularProfileId},#{id.caseId}) @@ -552,10 +542,10 @@ - sample.STABLE_ID + sample.stable_id - patient.STABLE_ID + patient.stable_id @@ -563,10 +553,10 @@ - sample.INTERNAL_ID + sample.internal_id - patient.INTERNAL_ID + patient.internal_id @@ -574,26 +564,27 @@ caseStableId - + caseUniqueId - + SELECT - alteration_driver_annotation.ALTERATION_EVENT_ID as alterationEventId, - alteration_driver_annotation.GENETIC_PROFILE_ID as geneticProfileId, - alteration_driver_annotation.SAMPLE_ID as sampleId, - alteration_driver_annotation.DRIVER_FILTER as driverFilter, - alteration_driver_annotation.DRIVER_FILTER_ANNOTATION as driverFilterAnnotation, - alteration_driver_annotation.DRIVER_TIERS_FILTER as driverTiersFilter, - alteration_driver_annotation.DRIVER_TIERS_FILTER_ANNOTATION as driverTiersFilterAnnotation + alteration_driver_annotation.alteration_event_id as alterationEventId, + alteration_driver_annotation.genetic_profile_id as geneticProfileId, + alteration_driver_annotation.sample_id as sampleId, + alteration_driver_annotation.driver_filter as driverFilter, + alteration_driver_annotation.driver_filter_annotation as driverFilterAnnotation, + alteration_driver_annotation.driver_tiers_filter as driverTiersFilter, + alteration_driver_annotation.driver_tiers_filter_annotation as driverTiersFilterAnnotation FROM alteration_driver_annotation INNER JOIN genetic_profile ON - genetic_profile.GENETIC_PROFILE_ID = alteration_driver_annotation.GENETIC_PROFILE_ID + genetic_profile.genetic_profile_id = alteration_driver_annotation.genetic_profile_id - genetic_profile.STABLE_ID IN - - #{id} - + genetic_profile.stable_id IN + #{id} - \ No newline at end of file + diff --git a/src/main/resources/org/cbioportal/persistence/mybatis/CancerTypeMapper.xml b/src/main/resources/org/cbioportal/persistence/mybatis/CancerTypeMapper.xml index 138ae3932bc..4aa626cab13 100644 --- a/src/main/resources/org/cbioportal/persistence/mybatis/CancerTypeMapper.xml +++ b/src/main/resources/org/cbioportal/persistence/mybatis/CancerTypeMapper.xml @@ -4,16 +4,16 @@ - type_of_cancer.TYPE_OF_CANCER_ID AS "${prefix}typeOfCancerId" + type_of_cancer.type_of_cancer_id AS "${prefix}typeOfCancerId" , - type_of_cancer.NAME AS "${prefix}name", - type_of_cancer.DEDICATED_COLOR AS "${prefix}dedicatedColor", - type_of_cancer.SHORT_NAME AS "${prefix}shortName", - type_of_cancer.PARENT AS "${prefix}parent" + type_of_cancer.name AS "${prefix}name", + type_of_cancer.dedicated_color AS "${prefix}dedicatedColor", + type_of_cancer.short_name AS "${prefix}shortName", + type_of_cancer.parent AS "${prefix}parent" - + diff --git a/src/main/resources/org/cbioportal/persistence/mybatis/ClinicalAttributeMapper.xml b/src/main/resources/org/cbioportal/persistence/mybatis/ClinicalAttributeMapper.xml index 8dbdbc9a942..bc73d6906d5 100644 --- a/src/main/resources/org/cbioportal/persistence/mybatis/ClinicalAttributeMapper.xml +++ b/src/main/resources/org/cbioportal/persistence/mybatis/ClinicalAttributeMapper.xml @@ -4,49 +4,45 @@ - clinical_attribute_meta.ATTR_ID AS "${prefix}attrId", - cancer_study.CANCER_STUDY_IDENTIFIER AS "${prefix}cancerStudyIdentifier", - clinical_attribute_meta.CANCER_STUDY_ID AS "${prefix}cancerStudyId", - clinical_attribute_meta.PATIENT_ATTRIBUTE AS "${prefix}patientAttribute", - clinical_attribute_meta.DISPLAY_NAME AS "${prefix}displayName" + clinical_attribute_meta.attr_id AS "${prefix}attrId", + cancer_study.cancer_study_identifier AS "${prefix}cancerStudyIdentifier", + clinical_attribute_meta.cancer_study_id AS "${prefix}cancerStudyId", + clinical_attribute_meta.patient_attribute AS "${prefix}patientAttribute", + clinical_attribute_meta.display_name AS "${prefix}displayName" , - clinical_attribute_meta.DESCRIPTION AS "${prefix}description", - clinical_attribute_meta.DATATYPE AS "${prefix}datatype", - clinical_attribute_meta.PRIORITY AS "${prefix}priority" + clinical_attribute_meta.description AS "${prefix}description", + clinical_attribute_meta.datatype AS "${prefix}datatype", + clinical_attribute_meta.priority AS "${prefix}priority" - INNER JOIN sample ON clinical_sample.INTERNAL_ID = sample.INTERNAL_ID - INNER JOIN patient ON sample.PATIENT_ID = patient.INTERNAL_ID - INNER JOIN cancer_study ON patient.CANCER_STUDY_ID = cancer_study.CANCER_STUDY_ID + INNER JOIN sample ON clinical_sample.internal_id = sample.internal_id + INNER JOIN patient ON sample.patient_id = patient.internal_id + INNER JOIN cancer_study ON patient.cancer_study_id = cancer_study.cancer_study_id - INNER JOIN patient ON clinical_patient.INTERNAL_ID = patient.INTERNAL_ID - INNER JOIN sample ON sample.PATIENT_ID = patient.INTERNAL_ID - INNER JOIN cancer_study ON patient.CANCER_STUDY_ID = cancer_study.CANCER_STUDY_ID + INNER JOIN patient ON clinical_patient.internal_id = patient.internal_id + INNER JOIN sample ON sample.patient_id = patient.internal_id + INNER JOIN cancer_study ON patient.cancer_study_id = cancer_study.cancer_study_id - cancer_study.CANCER_STUDY_IDENTIFIER = #{studyIds[0]} + cancer_study.cancer_study_identifier = #{studyIds[0]} - cancer_study.CANCER_STUDY_IDENTIFIER = #{studyIds[0]} AND - sample.STABLE_ID IN - - #{item} - + cancer_study.cancer_study_identifier = #{studyIds[0]} AND + sample.stable_id IN + #{item} - (cancer_study.CANCER_STUDY_IDENTIFIER, sample.STABLE_ID) IN - - (#{studyIds[${i}]}, #{sampleIds[${i}]}) - + (cancer_study.cancer_study_identifier, sample.stable_id) IN + (#{studyIds[${i}]},#{sampleIds[${i}]}) @@ -54,12 +50,12 @@ - sample.INTERNAL_ID IN + sample.internal_id IN ( - SELECT sample_list_list.SAMPLE_ID FROM sample_list_list - INNER JOIN sample_list ON sample_list_list.LIST_ID = sample_list.LIST_ID - WHERE sample_list.STABLE_ID = #{sampleListId} - AND sample_list_list.SAMPLE_ID = sample.INTERNAL_ID + SELECT sample_list_list.sample_id FROM sample_list_list + INNER JOIN sample_list ON sample_list_list.list_id = sample_list.list_id + WHERE sample_list.stable_id = #{sampleListId} + AND sample_list_list.sample_id = sample.internal_id ) @@ -70,20 +66,18 @@ FROM clinical_attribute_meta - INNER JOIN cancer_study ON clinical_attribute_meta.CANCER_STUDY_ID = cancer_study.CANCER_STUDY_ID + INNER JOIN cancer_study ON clinical_attribute_meta.cancer_study_id = cancer_study.cancer_study_id - cancer_study.CANCER_STUDY_IDENTIFIER IN - - #{item} - + cancer_study.cancer_study_identifier IN + #{item} ORDER BY "${sortBy}" ${direction} - ORDER BY clinical_attribute_meta.ATTR_ID ASC + ORDER BY clinical_attribute_meta.attr_id ASC LIMIT #{limit} OFFSET #{offset} @@ -94,13 +88,11 @@ SELECT COUNT(*) AS "totalCount" FROM clinical_attribute_meta - INNER JOIN cancer_study ON clinical_attribute_meta.CANCER_STUDY_ID = cancer_study.CANCER_STUDY_ID + INNER JOIN cancer_study ON clinical_attribute_meta.cancer_study_id = cancer_study.cancer_study_id - cancer_study.CANCER_STUDY_IDENTIFIER IN - - #{item} - + cancer_study.cancer_study_identifier IN + #{item} @@ -111,70 +103,66 @@ FROM clinical_attribute_meta - INNER JOIN cancer_study ON clinical_attribute_meta.CANCER_STUDY_ID = cancer_study.CANCER_STUDY_ID - WHERE clinical_attribute_meta.ATTR_ID = #{clinicalAttributeId} - AND cancer_study.CANCER_STUDY_IDENTIFIER = #{studyId} + INNER JOIN cancer_study ON clinical_attribute_meta.cancer_study_id = cancer_study.cancer_study_id + WHERE clinical_attribute_meta.attr_id = #{clinicalAttributeId} + AND cancer_study.cancer_study_identifier = #{studyId} - + diff --git a/src/main/resources/org/cbioportal/persistence/mybatis/ClinicalDataMapper.xml b/src/main/resources/org/cbioportal/persistence/mybatis/ClinicalDataMapper.xml index c286e75d76f..e0ef17a4253 100644 --- a/src/main/resources/org/cbioportal/persistence/mybatis/ClinicalDataMapper.xml +++ b/src/main/resources/org/cbioportal/persistence/mybatis/ClinicalDataMapper.xml @@ -4,14 +4,14 @@ - clinical_sample.INTERNAL_ID AS "${prefix}internalId", - sample.STABLE_ID AS "${prefix}sampleId", - patient.STABLE_ID AS "${prefix}patientId", - clinical_sample.ATTR_ID AS "${prefix}attrId", - cancer_study.CANCER_STUDY_IDENTIFIER AS "${prefix}studyId" + clinical_sample.internal_id AS "${prefix}internalId", + sample.stable_id AS "${prefix}sampleId", + patient.stable_id AS "${prefix}patientId", + clinical_sample.attr_id AS "${prefix}attrId", + cancer_study.cancer_study_identifier AS "${prefix}studyId" - , clinical_sample.ATTR_VALUE AS "${prefix}attrValue" + , clinical_sample.attr_value AS "${prefix}attrValue" , @@ -23,13 +23,13 @@ - clinical_patient.INTERNAL_ID AS "${prefix}internalId", - patient.STABLE_ID AS "${prefix}patientId", - clinical_patient.ATTR_ID AS "${prefix}attrId", - cancer_study.CANCER_STUDY_IDENTIFIER AS "${prefix}studyId" + clinical_patient.internal_id AS "${prefix}internalId", + patient.stable_id AS "${prefix}patientId", + clinical_patient.attr_id AS "${prefix}attrId", + cancer_study.cancer_study_identifier AS "${prefix}studyId" - , clinical_patient.ATTR_VALUE AS "${prefix}attrValue" + , clinical_patient.attr_value AS "${prefix}attrValue" , @@ -38,53 +38,46 @@ - - + FROM clinical_sample - INNER JOIN sample ON clinical_sample.INTERNAL_ID = sample.INTERNAL_ID - INNER JOIN patient ON sample.PATIENT_ID = patient.INTERNAL_ID - INNER JOIN cancer_study ON patient.CANCER_STUDY_ID = cancer_study.CANCER_STUDY_ID + INNER JOIN sample ON clinical_sample.internal_id = sample.internal_id + INNER JOIN patient ON sample.patient_id = patient.internal_id + INNER JOIN cancer_study ON patient.cancer_study_id = cancer_study.cancer_study_id - LEFT JOIN clinical_patient ON clinical_patient.INTERNAL_ID = patient.INTERNAL_ID + LEFT JOIN clinical_patient ON clinical_patient.internal_id = patient.internal_id FROM clinical_patient - INNER JOIN patient ON clinical_patient.INTERNAL_ID = patient.INTERNAL_ID - INNER JOIN cancer_study ON patient.CANCER_STUDY_ID = cancer_study.CANCER_STUDY_ID + INNER JOIN patient ON clinical_patient.internal_id = patient.internal_id + INNER JOIN cancer_study ON patient.cancer_study_id = cancer_study.cancer_study_id - cancer_study.CANCER_STUDY_IDENTIFIER = #{studyIds[0]} + cancer_study.cancer_study_identifier = #{studyIds[0]} - cancer_study.CANCER_STUDY_IDENTIFIER = #{studyIds[0]} AND - sample.STABLE_ID IN - - #{item} - + cancer_study.cancer_study_identifier = #{studyIds[0]} AND + sample.stable_id IN + #{item} - (cancer_study.CANCER_STUDY_IDENTIFIER, sample.STABLE_ID) IN - - (#{studyIds[${i}]}, #{sampleIds[${i}]}) - + (cancer_study.cancer_study_identifier, sample.stable_id) IN + (#{studyIds[${i}]},#{sampleIds[${i}]}) - AND clinical_sample.ATTR_ID IN - - #{item} - + AND clinical_sample.attr_id IN + #{item} @@ -92,30 +85,24 @@ - cancer_study.CANCER_STUDY_IDENTIFIER = #{studyIds[0]} + cancer_study.cancer_study_identifier = #{studyIds[0]} - cancer_study.CANCER_STUDY_IDENTIFIER = #{studyIds[0]} AND - patient.STABLE_ID IN - - #{item} - + cancer_study.cancer_study_identifier = #{studyIds[0]} AND + patient.stable_id IN + #{item} - (cancer_study.CANCER_STUDY_IDENTIFIER, patient.STABLE_ID) IN - - (#{studyIds[${i}]}, #{patientIds[${i}]}) - + (cancer_study.cancer_study_identifier, patient.stable_id) IN + (#{studyIds[${i}]},#{patientIds[${i}]}) - AND clinical_patient.ATTR_ID IN - - #{item} - + AND clinical_patient.attr_id IN + #{item} @@ -127,16 +114,16 @@ - INNER JOIN clinical_attribute_meta ON clinical_sample.ATTR_ID = clinical_attribute_meta.ATTR_ID - AND cancer_study.CANCER_STUDY_ID = clinical_attribute_meta.CANCER_STUDY_ID - INNER JOIN type_of_cancer ON cancer_study.TYPE_OF_CANCER_ID = type_of_cancer.TYPE_OF_CANCER_ID + INNER JOIN clinical_attribute_meta ON clinical_sample.attr_id = clinical_attribute_meta.attr_id + AND cancer_study.cancer_study_id = clinical_attribute_meta.cancer_study_id + INNER JOIN type_of_cancer ON cancer_study.type_of_cancer_id = type_of_cancer.type_of_cancer_id ORDER BY "${sortBy}" ${direction} - ORDER BY clinical_sample.ATTR_ID ASC + ORDER BY clinical_sample.attr_id ASC LIMIT #{limit} OFFSET #{offset} @@ -157,41 +144,41 @@ - INNER JOIN clinical_attribute_meta ON clinical_patient.ATTR_ID = clinical_attribute_meta.ATTR_ID - AND cancer_study.CANCER_STUDY_ID = clinical_attribute_meta.CANCER_STUDY_ID - INNER JOIN type_of_cancer ON cancer_study.TYPE_OF_CANCER_ID = type_of_cancer.TYPE_OF_CANCER_ID + INNER JOIN clinical_attribute_meta ON clinical_patient.attr_id = clinical_attribute_meta.attr_id + AND cancer_study.cancer_study_id = clinical_attribute_meta.cancer_study_id + INNER JOIN type_of_cancer ON cancer_study.type_of_cancer_id = type_of_cancer.type_of_cancer_id ORDER BY ${sortBy} ${direction} - ORDER BY clinical_patient.ATTR_ID ASC + ORDER BY clinical_patient.attr_id ASC LIMIT #{limit} OFFSET #{offset} - + SELECT count(*) as count, - clinical_sample.ATTR_ID as attributeId, - clinical_sample.ATTR_VALUE as value + clinical_sample.attr_id as attributeId, + clinical_sample.attr_value as value - GROUP BY clinical_sample.ATTR_ID, clinical_sample.ATTR_VALUE + GROUP BY clinical_sample.attr_id, clinical_sample.attr_value - + INNER JOIN ( - SELECT DISTINCT clinical_sample.INTERNAL_ID + SELECT DISTINCT clinical_sample.internal_id - , sample.STABLE_ID AS SORT_BY + , sample.stable_id AS sort_by - , patient.STABLE_ID AS SORT_BY + , patient.stable_id AS sort_by - , CASE - WHEN clinical_sample.ATTR_ID = #{sortBy} THEN clinical_sample.ATTR_VALUE - WHEN clinical_patient.ATTR_ID = #{sortBy} THEN clinical_patient.ATTR_VALUE - ELSE NULL - END AS SORT_BY + , CASE + WHEN clinical_sample.attr_id = #{sortBy} THEN clinical_sample.attr_value + WHEN clinical_patient.attr_id = #{sortBy} THEN clinical_patient.attr_value + ELSE NULL + END AS sort_by AND - clinical_sample.ATTR_VALUE LIKE CONCAT('%', #{searchTerm}, '%') + clinical_sample.attr_value LIKE CONCAT('%', #{searchTerm}, '%') - ORDER BY ISNULL(SORT_BY), SORT_BY ${direction} + ORDER BY ISNULL(sort_by), sort_by ${direction} - ORDER BY SORT_BY ${direction} NULLS LAST + ORDER BY sort_by ${direction} NULLS LAST - + LIMIT #{limit} OFFSET #{offset} ) AS sample_id_subquery - ON clinical_sample.INTERNAL_ID = sample_id_subquery.INTERNAL_ID + ON clinical_sample.internal_id = sample_id_subquery.internal_id - + diff --git a/src/main/resources/org/cbioportal/persistence/mybatis/ClinicalEventMapper.xml b/src/main/resources/org/cbioportal/persistence/mybatis/ClinicalEventMapper.xml index 58cd60d098f..2d41068d9a3 100644 --- a/src/main/resources/org/cbioportal/persistence/mybatis/ClinicalEventMapper.xml +++ b/src/main/resources/org/cbioportal/persistence/mybatis/ClinicalEventMapper.xml @@ -2,35 +2,35 @@ - + - clinical_event.CLINICAL_EVENT_ID AS "clinicalEventId", - clinical_event.EVENT_TYPE AS "eventType", - patient.STABLE_ID AS "patientId", - cancer_study.CANCER_STUDY_IDENTIFIER AS "studyId" + clinical_event.clinical_event_id AS "clinicalEventId", + clinical_event.event_type AS "eventType", + patient.stable_id AS "patientId", + cancer_study.cancer_study_identifier AS "studyId" , - clinical_event.START_DATE AS "startDate", - clinical_event.STOP_DATE AS "stopDate" + clinical_event.start_date AS "startDate", + clinical_event.stop_date AS "stopDate" FROM clinical_event - INNER JOIN patient ON clinical_event.PATIENT_ID = patient.INTERNAL_ID - INNER JOIN cancer_study ON patient.CANCER_STUDY_ID = cancer_study.CANCER_STUDY_ID + INNER JOIN patient ON clinical_event.patient_id = patient.internal_id + INNER JOIN cancer_study ON patient.cancer_study_id = cancer_study.cancer_study_id - cancer_study.CANCER_STUDY_IDENTIFIER = #{studyId} - AND patient.STABLE_ID = #{patientId} + cancer_study.cancer_study_identifier = #{studyId} + AND patient.stable_id = #{patientId} - cancer_study.CANCER_STUDY_IDENTIFIER = #{studyId} + cancer_study.cancer_study_identifier = #{studyId} @@ -43,7 +43,7 @@ ORDER BY "${sortBy}" ${direction} - ORDER BY clinical_event.PATIENT_ID ASC + ORDER BY clinical_event.patient_id ASC LIMIT #{limit} OFFSET #{offset} @@ -59,16 +59,14 @@ @@ -82,59 +80,47 @@ ORDER BY "${sortBy}" ${direction} - ORDER BY clinical_event.PATIENT_ID ASC + ORDER BY clinical_event.patient_id ASC LIMIT #{limit} OFFSET #{offset} - + - + diff --git a/src/main/resources/org/cbioportal/persistence/mybatis/CopyNumberSegmentMapper.xml b/src/main/resources/org/cbioportal/persistence/mybatis/CopyNumberSegmentMapper.xml index 58e2a37da07..b2865e3b414 100644 --- a/src/main/resources/org/cbioportal/persistence/mybatis/CopyNumberSegmentMapper.xml +++ b/src/main/resources/org/cbioportal/persistence/mybatis/CopyNumberSegmentMapper.xml @@ -2,67 +2,65 @@ - + - copy_number_seg.SEG_ID AS "segId", + copy_number_seg.seg_id AS "segId", copy_number_seg.CANCER_STUDY_ID AS "cancerStudyId", - cancer_study.CANCER_STUDY_IDENTIFIER AS "cancerStudyIdentifier", - copy_number_seg.SAMPLE_ID AS "sampleId", - patient.STABLE_ID AS "patientId", - sample.STABLE_ID AS "sampleStableId", - copy_number_seg.CHR AS "chr", - copy_number_seg.START AS "start", - copy_number_seg.END AS "end", - copy_number_seg.NUM_PROBES AS "numProbes", - copy_number_seg.SEGMENT_MEAN AS "segmentMean" + cancer_study.cancer_study_identifier AS "cancerStudyIdentifier", + copy_number_seg.sample_id AS "sampleId", + patient.stable_id AS "patientId", + sample.stable_id AS "sampleStableId", + copy_number_seg.chr AS "chr", + copy_number_seg.start AS "start", + copy_number_seg.end AS "end", + copy_number_seg.num_probes AS "numProbes", + copy_number_seg.segment_mean AS "segmentMean" FROM copy_number_seg - INNER JOIN cancer_study ON copy_number_seg.CANCER_STUDY_ID = cancer_study.CANCER_STUDY_ID - INNER JOIN sample ON copy_number_seg.SAMPLE_ID = sample.INTERNAL_ID - INNER JOIN patient ON sample.PATIENT_ID = patient.INTERNAL_ID + INNER JOIN cancer_study ON copy_number_seg.cancer_study_id = cancer_study.cancer_study_id + INNER JOIN sample ON copy_number_seg.sample_id = sample.internal_id + INNER JOIN patient ON sample.patient_id = patient.internal_id - + - (cancer_study.CANCER_STUDY_IDENTIFIER, sample.STABLE_ID) IN - - (#{studyIds[${i}]}, #{sampleIds[${i}]}) - + (cancer_study.cancer_study_identifier, sample.stable_id) IN + (#{studyIds[${i}]},#{sampleIds[${i}]}) - + - - + + - + diff --git a/src/main/resources/org/cbioportal/persistence/mybatis/CosmicCountMapper.xml b/src/main/resources/org/cbioportal/persistence/mybatis/CosmicCountMapper.xml index df0fe7e0fe3..77b15dc79b7 100644 --- a/src/main/resources/org/cbioportal/persistence/mybatis/CosmicCountMapper.xml +++ b/src/main/resources/org/cbioportal/persistence/mybatis/CosmicCountMapper.xml @@ -2,20 +2,18 @@ - + diff --git a/src/main/resources/org/cbioportal/persistence/mybatis/DataAccessTokenMapper.xml b/src/main/resources/org/cbioportal/persistence/mybatis/DataAccessTokenMapper.xml index f6aea8ca139..5821f98b071 100644 --- a/src/main/resources/org/cbioportal/persistence/mybatis/DataAccessTokenMapper.xml +++ b/src/main/resources/org/cbioportal/persistence/mybatis/DataAccessTokenMapper.xml @@ -4,10 +4,10 @@ - data_access_tokens.TOKEN AS "${prefix}token", - data_access_tokens.USERNAME AS "${prefix}username", - data_access_tokens.EXPIRATION AS "${prefix}expiration", - data_access_tokens.CREATION AS "${prefix}creation" + data_access_tokens.token AS "${prefix}token", + data_access_tokens.username AS "${prefix}username", + data_access_tokens.expiration AS "${prefix}expiration", + data_access_tokens.creation AS "${prefix}creation" DELETE FROM data_access_tokens - WHERE TOKEN = #{token} + WHERE token = #{token} DELETE FROM data_access_tokens - WHERE USERNAME = #{username} + WHERE username = #{username} INSERT - INTO data_access_tokens(TOKEN, USERNAME, EXPIRATION, CREATION) + INTO data_access_tokens(token, username, expiration, creation) VALUES (#{token}, #{username}, #{expiration}, #{creation}) diff --git a/src/main/resources/org/cbioportal/persistence/mybatis/DiscreteCopyNumberMapper.xml b/src/main/resources/org/cbioportal/persistence/mybatis/DiscreteCopyNumberMapper.xml index 3060a8a389e..af428ef9e7d 100644 --- a/src/main/resources/org/cbioportal/persistence/mybatis/DiscreteCopyNumberMapper.xml +++ b/src/main/resources/org/cbioportal/persistence/mybatis/DiscreteCopyNumberMapper.xml @@ -4,83 +4,73 @@ - cna_event.ENTREZ_GENE_ID as entrezGeneId, - cna_event.ALTERATION AS "alteration", - genetic_profile.STABLE_ID AS "molecularProfileId", - sample_cna_event.ANNOTATION_JSON as annotationJson, - sample.STABLE_ID AS "sampleId", - patient.STABLE_ID AS "patientId", - cancer_study.CANCER_STUDY_IDENTIFIER AS "studyId", - alteration_driver_annotation.DRIVER_FILTER AS "driverFilter", - alteration_driver_annotation.DRIVER_FILTER_ANNOTATION AS "driverFilterAnnotation", - alteration_driver_annotation.DRIVER_TIERS_FILTER AS "driverTiersFilter", - alteration_driver_annotation.DRIVER_TIERS_FILTER_ANNOTATION AS "driverTiersFilterAnnotation" + cna_event.entrez_gene_id as entrezGeneId, + cna_event.alteration AS "alteration", + genetic_profile.stable_id AS "molecularProfileId", + sample_cna_event.annotation_json as annotationJson, + sample.stable_id AS "sampleId", + patient.stable_id AS "patientId", + cancer_study.cancer_study_identifier AS "studyId", + alteration_driver_annotation.driver_filter AS "driverFilter", + alteration_driver_annotation.driver_filter_annotation AS "driverFilterAnnotation", + alteration_driver_annotation.driver_tiers_filter AS "driverTiersFilter", + alteration_driver_annotation.driver_tiers_filter_annotation AS "driverTiersFilterAnnotation" , - + FROM cna_event - INNER JOIN sample_cna_event ON cna_event.CNA_EVENT_ID = sample_cna_event.CNA_EVENT_ID - INNER JOIN genetic_profile ON sample_cna_event.GENETIC_PROFILE_ID = genetic_profile.GENETIC_PROFILE_ID - INNER JOIN sample ON sample_cna_event.SAMPLE_ID = sample.INTERNAL_ID - INNER JOIN patient ON sample.PATIENT_ID = patient.INTERNAL_ID - INNER JOIN cancer_study ON patient.CANCER_STUDY_ID = cancer_study.CANCER_STUDY_ID + INNER JOIN sample_cna_event ON cna_event.cna_event_id = sample_cna_event.cna_event_id + INNER JOIN genetic_profile ON sample_cna_event.genetic_profile_id = genetic_profile.genetic_profile_id + INNER JOIN sample ON sample_cna_event.sample_id = sample.internal_id + INNER JOIN patient ON sample.patient_id = patient.internal_id + INNER JOIN cancer_study ON patient.cancer_study_id = cancer_study.cancer_study_id LEFT JOIN alteration_driver_annotation ON - sample_cna_event.GENETIC_PROFILE_ID = alteration_driver_annotation.GENETIC_PROFILE_ID - and sample_cna_event.SAMPLE_ID = alteration_driver_annotation.SAMPLE_ID - and sample_cna_event.CNA_EVENT_ID = alteration_driver_annotation.ALTERATION_EVENT_ID + sample_cna_event.genetic_profile_id = alteration_driver_annotation.genetic_profile_id + and sample_cna_event.sample_id = alteration_driver_annotation.sample_id + and sample_cna_event.cna_event_id = alteration_driver_annotation.alteration_event_id - genetic_profile.STABLE_ID = #{molecularProfileId} + genetic_profile.stable_id = #{molecularProfileId} - AND sample.STABLE_ID IN - - #{item} - + AND sample.stable_id IN + #{item} - AND cna_event.ENTREZ_GENE_ID IN - - #{item} - + AND cna_event.entrez_gene_id IN + #{item} - AND cna_event.ALTERATION IN - - #{item} - + AND cna_event.alteration IN + #{item} - genetic_profile.STABLE_ID = #{molecularProfileId} - AND sample_cna_event.SAMPLE_ID IN + genetic_profile.stable_id = #{molecularProfileId} + AND sample_cna_event.sample_id IN ( - SELECT sample_list_list.SAMPLE_ID FROM sample_list_list - INNER JOIN sample_list ON sample_list_list.LIST_ID = sample_list.LIST_ID - WHERE sample_list.STABLE_ID = #{sampleListId} - AND sample_list_list.SAMPLE_ID = sample_cna_event.SAMPLE_ID + SELECT sample_list_list.sample_id FROM sample_list_list + INNER JOIN sample_list ON sample_list_list.list_id = sample_list.list_id + WHERE sample_list.stable_id = #{sampleListId} + AND sample_list_list.sample_id = sample_cna_event.sample_id ) - AND cna_event.ENTREZ_GENE_ID IN - - #{item} - + AND cna_event.entrez_gene_id IN + #{item} - AND cna_event.ALTERATION IN - - #{item} - + AND cna_event.alteration IN + #{item} @@ -88,29 +78,21 @@ - genetic_profile.STABLE_ID = #{molecularProfileIds[0]} AND - sample.STABLE_ID IN - - #{item} - + genetic_profile.stable_id = #{molecularProfileIds[0]} AND + sample.stable_id IN + #{item} - (sample.STABLE_ID, genetic_profile.STABLE_ID) IN - - (#{sampleIds[${i}]}, #{molecularProfileIds[${i}]}) - + (sample.stable_id, genetic_profile.stable_id) IN + (#{sampleIds[${i}]},#{molecularProfileIds[${i}]}) - AND cna_event.ENTREZ_GENE_ID IN - - #{item} - + AND cna_event.entrez_gene_id IN + #{item} - AND cna_event.ALTERATION IN - - #{item} - + AND cna_event.alteration IN + #{item} @@ -120,21 +102,21 @@ AND - ( cna_event.ENTREZ_GENE_ID = '${geneFilterQuery.getEntrezGeneId()}' + ( cna_event.entrez_gene_id = '${geneFilterQuery.getEntrezGeneId()}' - OR LOWER(alteration_driver_annotation.DRIVER_FILTER) = 'putative_driver' + OR LOWER(alteration_driver_annotation.driver_filter) = 'putative_driver' - OR LOWER(alteration_driver_annotation.DRIVER_FILTER) = 'putative_passenger' + OR LOWER(alteration_driver_annotation.driver_filter) = 'putative_passenger' - OR alteration_driver_annotation.DRIVER_FILTER IS NULL - OR LOWER(alteration_driver_annotation.DRIVER_FILTER) IN ('unknown', 'na', '') + OR alteration_driver_annotation.driver_filter IS NULL + OR LOWER(alteration_driver_annotation.driver_filter) IN ('unknown', 'na', '') @@ -150,20 +132,18 @@ - AND NOT alteration_driver_annotation.DRIVER_TIERS_FILTER IS NULL - AND NOT LOWER(alteration_driver_annotation.DRIVER_TIERS_FILTER) IN ('', 'na', 'unknown') + AND NOT alteration_driver_annotation.driver_tiers_filter IS NULL + AND NOT LOWER(alteration_driver_annotation.driver_tiers_filter) IN ('', 'na', 'unknown') - OR alteration_driver_annotation.DRIVER_TIERS_FILTER IN - - #{item} - + OR alteration_driver_annotation.driver_tiers_filter IN + #{item} - OR alteration_driver_annotation.DRIVER_TIERS_FILTER IS NULL - OR LOWER(alteration_driver_annotation.DRIVER_TIERS_FILTER) IN ('', 'na', 'unknown') + OR alteration_driver_annotation.driver_tiers_filter IS NULL + OR LOWER(alteration_driver_annotation.driver_tiers_filter) IN ('', 'na', 'unknown') @@ -178,10 +158,8 @@ - OR cna_event.ALTERATION IN - - ${item.getCode()} - + OR cna_event.alteration IN + ${item.getCode()} @@ -198,7 +176,7 @@ - INNER JOIN gene ON cna_event.ENTREZ_GENE_ID = gene.ENTREZ_GENE_ID + INNER JOIN gene ON cna_event.entrez_gene_id = gene.entrez_gene_id @@ -215,7 +193,7 @@ - INNER JOIN gene ON cna_event.ENTREZ_GENE_ID = gene.ENTREZ_GENE_ID + INNER JOIN gene ON cna_event.entrez_gene_id = gene.entrez_gene_id @@ -225,7 +203,7 @@ - INNER JOIN gene ON cna_event.ENTREZ_GENE_ID = gene.ENTREZ_GENE_ID + INNER JOIN gene ON cna_event.entrez_gene_id = gene.entrez_gene_id @@ -235,7 +213,7 @@ - INNER JOIN gene ON cna_event.ENTREZ_GENE_ID = gene.ENTREZ_GENE_ID + INNER JOIN gene ON cna_event.entrez_gene_id = gene.entrez_gene_id @@ -249,30 +227,27 @@ diff --git a/src/main/resources/org/cbioportal/persistence/mybatis/GeneMapper.xml b/src/main/resources/org/cbioportal/persistence/mybatis/GeneMapper.xml index eb9bbf1f24a..3947ebd4cbc 100644 --- a/src/main/resources/org/cbioportal/persistence/mybatis/GeneMapper.xml +++ b/src/main/resources/org/cbioportal/persistence/mybatis/GeneMapper.xml @@ -4,34 +4,34 @@ - gene.ENTREZ_GENE_ID AS "${prefix}entrezGeneId", - gene.HUGO_GENE_SYMBOL AS "${prefix}hugoGeneSymbol" + gene.entrez_gene_id AS "${prefix}entrezGeneId", + gene.hugo_gene_symbol AS "${prefix}hugoGeneSymbol" , - gene.TYPE AS "${prefix}type" + gene.type AS "${prefix}type" FROM gene - INNER JOIN gene_alias ON gene.ENTREZ_GENE_ID = gene_alias.ENTREZ_GENE_ID + INNER JOIN gene_alias ON gene.entrez_gene_id = gene_alias.entrez_gene_id - gene_alias.GENE_ALIAS = #{alias} + gene_alias.gene_alias = #{alias} - gene.HUGO_GENE_SYMBOL like CONCAT('%', #{item}, '%') + gene.hugo_gene_symbol like CONCAT('%', #{item}, '%') - + - + @@ -115,10 +115,8 @@ FROM gene - gene.ENTREZ_GENE_ID IN - - #{item} - + gene.entrez_gene_id IN + #{item} FALSE @@ -132,10 +130,8 @@ FROM gene - gene.ENTREZ_GENE_ID IN - - #{item} - + gene.entrez_gene_id IN + #{item} FALSE @@ -151,10 +147,8 @@ FROM gene - gene.HUGO_GENE_SYMBOL IN - - #{item} - + gene.hugo_gene_symbol IN + #{item} FALSE @@ -168,10 +162,8 @@ FROM gene - gene.HUGO_GENE_SYMBOL IN - - #{item} - + gene.hugo_gene_symbol IN + #{item} FALSE diff --git a/src/main/resources/org/cbioportal/persistence/mybatis/GenePanelMapper.xml b/src/main/resources/org/cbioportal/persistence/mybatis/GenePanelMapper.xml index 96a1d434c15..f99ebe2e9cd 100644 --- a/src/main/resources/org/cbioportal/persistence/mybatis/GenePanelMapper.xml +++ b/src/main/resources/org/cbioportal/persistence/mybatis/GenePanelMapper.xml @@ -2,34 +2,34 @@ - + - gene_panel.INTERNAL_ID AS "internalId", - gene_panel.STABLE_ID AS "stableId" + gene_panel.internal_id AS "internalId", + gene_panel.stable_id AS "stableId" , - gene_panel.DESCRIPTION AS "description" + gene_panel.description AS "description" - gene_panel.STABLE_ID AS "genePanelId", - sample.STABLE_ID AS "sampleId", - patient.STABLE_ID AS "patientId", - cancer_study.CANCER_STUDY_IDENTIFIER AS "studyId", - genetic_profile.STABLE_ID AS "molecularProfileId", - sample_profile.GENETIC_PROFILE_ID IS NOT NULL AS "profiled" + gene_panel.stable_id AS "genePanelId", + sample.stable_id AS "sampleId", + patient.stable_id AS "patientId", + cancer_study.cancer_study_identifier AS "studyId", + genetic_profile.stable_id AS "molecularProfileId", + sample_profile.genetic_profile_id IS NOT NULL AS "profiled" FROM sample - INNER JOIN patient ON sample.PATIENT_ID = patient.INTERNAL_ID - INNER JOIN cancer_study ON patient.CANCER_STUDY_ID = cancer_study.CANCER_STUDY_ID - LEFT JOIN genetic_profile ON cancer_study.CANCER_STUDY_ID = genetic_profile.CANCER_STUDY_ID - LEFT JOIN sample_profile ON sample_profile.GENETIC_PROFILE_ID = genetic_profile.GENETIC_PROFILE_ID AND sample.INTERNAL_ID = sample_profile.SAMPLE_ID - LEFT JOIN gene_panel ON sample_profile.PANEL_ID = gene_panel.INTERNAL_ID + INNER JOIN patient ON sample.patient_id = patient.internal_id + INNER JOIN cancer_study ON patient.cancer_study_id = cancer_study.cancer_study_id + LEFT JOIN genetic_profile ON cancer_study.cancer_study_id = genetic_profile.cancer_study_id + LEFT JOIN sample_profile ON sample_profile.genetic_profile_id = genetic_profile.genetic_profile_id AND sample.internal_id = sample_profile.sample_id + LEFT JOIN gene_panel ON sample_profile.panel_id = gene_panel.internal_id - + - + - + - + @@ -121,10 +115,8 @@ WHERE - genetic_profile.STABLE_ID IN - - #{item} - + genetic_profile.stable_id IN + #{item} - SELECT genetic_entity.STABLE_ID as stableId, - genetic_entity.ENTITY_TYPE as entityType + SELECT genetic_entity.stable_id as stableId, + genetic_entity.entity_type as entityType FROM genetic_entity - genetic_entity.STABLE_ID IN - - #{item} - + genetic_entity.stable_id IN + #{item} diff --git a/src/main/resources/org/cbioportal/persistence/mybatis/GenesetHierarchyMapper.xml b/src/main/resources/org/cbioportal/persistence/mybatis/GenesetHierarchyMapper.xml index 6ed4252ada4..6b49ae26a05 100644 --- a/src/main/resources/org/cbioportal/persistence/mybatis/GenesetHierarchyMapper.xml +++ b/src/main/resources/org/cbioportal/persistence/mybatis/GenesetHierarchyMapper.xml @@ -4,58 +4,54 @@ - a.NODE_ID AS nodeId, - a.NODE_NAME AS nodeName, - a.PARENT_ID AS parentId, - b.NODE_NAME AS parentNodeName + a.node_id AS nodeId, + a.node_name AS nodeName, + a.parent_id AS parentId, + b.node_name AS parentNodeName - + - + diff --git a/src/main/resources/org/cbioportal/persistence/mybatis/GenesetMapper.xml b/src/main/resources/org/cbioportal/persistence/mybatis/GenesetMapper.xml index 8c1fe553431..3b336f47c9d 100644 --- a/src/main/resources/org/cbioportal/persistence/mybatis/GenesetMapper.xml +++ b/src/main/resources/org/cbioportal/persistence/mybatis/GenesetMapper.xml @@ -4,11 +4,11 @@ - geneset.ID AS "${prefix}internalId", - geneset.EXTERNAL_ID AS "${prefix}genesetId", - geneset.NAME as "${prefix}name", - geneset.DESCRIPTION as "${prefix}description", - geneset.REF_LINK as "${prefix}refLink" + geneset.id AS "${prefix}internalId", + geneset.external_id AS "${prefix}genesetId", + geneset.name AS "${prefix}name", + geneset.description AS "${prefix}description", + geneset.ref_link AS "${prefix}refLink" - + - + diff --git a/src/main/resources/org/cbioportal/persistence/mybatis/MolecularDataMapper.xml b/src/main/resources/org/cbioportal/persistence/mybatis/MolecularDataMapper.xml index 45a1e222e63..52089a3b8ac 100644 --- a/src/main/resources/org/cbioportal/persistence/mybatis/MolecularDataMapper.xml +++ b/src/main/resources/org/cbioportal/persistence/mybatis/MolecularDataMapper.xml @@ -6,57 +6,49 @@ - genetic_profile.STABLE_ID IN - - #{item} - + genetic_profile.stable_id IN + #{item} - AND gene.ENTREZ_GENE_ID IN - - #{item} - + AND gene.entrez_gene_id IN + #{item} - + @@ -69,24 +61,22 @@ --> @@ -94,52 +84,50 @@ @@ -147,24 +135,22 @@ @@ -177,24 +163,22 @@ --> diff --git a/src/main/resources/org/cbioportal/persistence/mybatis/MolecularProfileMapper.xml b/src/main/resources/org/cbioportal/persistence/mybatis/MolecularProfileMapper.xml index b51a2f9b5ab..ae24dbb16de 100644 --- a/src/main/resources/org/cbioportal/persistence/mybatis/MolecularProfileMapper.xml +++ b/src/main/resources/org/cbioportal/persistence/mybatis/MolecularProfileMapper.xml @@ -4,21 +4,21 @@ - genetic_profile.GENETIC_PROFILE_ID AS "${prefix}molecularProfileId", - genetic_profile.STABLE_ID AS "${prefix}stableId", - genetic_profile.CANCER_STUDY_ID AS "${prefix}cancerStudyId", - cancer_study.CANCER_STUDY_IDENTIFIER AS "${prefix}cancerStudyIdentifier" + genetic_profile.genetic_profile_id AS "${prefix}molecularProfileId", + genetic_profile.stable_id AS "${prefix}stableId", + genetic_profile.cancer_study_id AS "${prefix}cancerStudyId", + cancer_study.cancer_study_identifier AS "${prefix}cancerStudyIdentifier" , - genetic_profile.GENETIC_ALTERATION_TYPE AS "${prefix}molecularAlterationType", - genetic_profile.DATATYPE AS "${prefix}datatype", - genetic_profile.NAME AS "${prefix}name", - genetic_profile.DESCRIPTION AS "${prefix}description", - genetic_profile.SHOW_PROFILE_IN_ANALYSIS_TAB AS "${prefix}showProfileInAnalysisTab", - genetic_profile.PIVOT_THRESHOLD AS "${prefix}pivotThreshold", - genetic_profile.SORT_ORDER AS "${prefix}sortOrder", - genetic_profile.GENERIC_ASSAY_TYPE AS "${prefix}genericAssayType", - genetic_profile.PATIENT_LEVEL AS "${prefix}patientLevel" + genetic_profile.genetic_alteration_type AS "${prefix}molecularAlterationType", + genetic_profile.datatype AS "${prefix}datatype", + genetic_profile.name AS "${prefix}name", + genetic_profile.description AS "${prefix}description", + genetic_profile.show_profile_in_analysis_tab AS "${prefix}showProfileInAnalysisTab", + genetic_profile.pivot_threshold AS "${prefix}pivotThreshold", + genetic_profile.sort_order AS "${prefix}sortOrder", + genetic_profile.generic_assay_type AS "${prefix}genericAssayType", + genetic_profile.patient_level AS "${prefix}patientLevel" , @@ -34,24 +34,18 @@ FROM genetic_profile - INNER JOIN cancer_study ON genetic_profile.CANCER_STUDY_ID = cancer_study.CANCER_STUDY_ID - INNER JOIN reference_genome ON cancer_study.REFERENCE_GENOME_ID = reference_genome.REFERENCE_GENOME_ID + INNER JOIN cancer_study ON genetic_profile.cancer_study_id = cancer_study.cancer_study_id + INNER JOIN reference_genome ON cancer_study.reference_genome_id = reference_genome.reference_genome_id - WHERE cancer_study.CANCER_STUDY_IDENTIFIER IN - - (NULL) - - - - #{item} - - + WHERE cancer_study.cancer_study_identifier IN + (NULL) + #{item} ORDER BY "${sortBy}" ${direction} - ORDER BY genetic_profile.STABLE_ID ASC + ORDER BY genetic_profile.stable_id ASC LIMIT #{limit} OFFSET #{offset} @@ -63,24 +57,22 @@ COUNT(*) AS totalCount FROM genetic_profile - INNER JOIN cancer_study ON genetic_profile.CANCER_STUDY_ID = cancer_study.CANCER_STUDY_ID - INNER JOIN reference_genome ON cancer_study.REFERENCE_GENOME_ID = reference_genome.REFERENCE_GENOME_ID - WHERE cancer_study.CANCER_STUDY_IDENTIFIER IN - - #{item} - + INNER JOIN cancer_study ON genetic_profile.cancer_study_id = cancer_study.cancer_study_id + INNER JOIN reference_genome ON cancer_study.reference_genome_id = reference_genome.reference_genome_id + WHERE cancer_study.cancer_study_identifier IN + #{item} - + @@ -107,47 +97,45 @@ FROM genetic_profile - genetic_profile.STABLE_ID IN - - #{item} - + genetic_profile.stable_id IN + #{item} - + - + diff --git a/src/main/resources/org/cbioportal/persistence/mybatis/MutationMapper.xml b/src/main/resources/org/cbioportal/persistence/mybatis/MutationMapper.xml index de6a18dc104..4d1f5c526f5 100644 --- a/src/main/resources/org/cbioportal/persistence/mybatis/MutationMapper.xml +++ b/src/main/resources/org/cbioportal/persistence/mybatis/MutationMapper.xml @@ -4,44 +4,44 @@ - genetic_profile.STABLE_ID AS "molecularProfileId", - sample.STABLE_ID AS "sampleId", - patient.STABLE_ID AS "patientId", - mutation.ENTREZ_GENE_ID AS "entrezGeneId", - cancer_study.CANCER_STUDY_IDENTIFIER AS "studyId" + genetic_profile.stable_id AS "molecularProfileId", + sample.stable_id AS "sampleId", + patient.stable_id AS "patientId", + mutation.entrez_gene_id AS "entrezGeneId", + cancer_study.cancer_study_identifier AS "studyId" , - mutation.CENTER AS "center", - mutation.MUTATION_STATUS AS "mutationStatus", - mutation.VALIDATION_STATUS AS "validationStatus", - mutation.TUMOR_ALT_COUNT AS "tumorAltCount", - mutation.TUMOR_REF_COUNT AS "tumorRefCount", - mutation.NORMAL_ALT_COUNT AS "normalAltCount", - mutation.NORMAL_REF_COUNT AS "normalRefCount", - mutation.AMINO_ACID_CHANGE AS "aminoAcidChange", - mutation_event.CHR AS "chr", - mutation_event.START_POSITION AS "startPosition", - mutation_event.END_POSITION AS "endPosition", - mutation_event.REFERENCE_ALLELE AS "referenceAllele", - mutation_event.TUMOR_SEQ_ALLELE AS "tumorSeqAllele", - mutation_event.PROTEIN_CHANGE AS "proteinChange", - mutation_event.MUTATION_TYPE AS "mutationType", - mutation_event.NCBI_BUILD AS "ncbiBuild", - mutation_event.VARIANT_TYPE AS "variantType", - mutation_event.REFSEQ_MRNA_ID AS "refseqMrnaId", - mutation_event.PROTEIN_POS_START AS "proteinPosStart", - mutation_event.PROTEIN_POS_END AS "proteinPosEnd", - mutation_event.KEYWORD AS "keyword", - mutation.ANNOTATION_JSON AS "annotationJSON", - alteration_driver_annotation.DRIVER_FILTER AS "driverFilter", - alteration_driver_annotation.DRIVER_FILTER_ANNOTATION AS "driverFilterAnnotation", - alteration_driver_annotation.DRIVER_TIERS_FILTER AS "driverTiersFilter", - alteration_driver_annotation.DRIVER_TIERS_FILTER_ANNOTATION as "driverTiersFilterAnnotation" + mutation.center AS "center", + mutation.mutation_status AS "mutationStatus", + mutation.validation_status AS "validationStatus", + mutation.tumor_alt_count AS "tumorAltCount", + mutation.tumor_ref_count AS "tumorRefCount", + mutation.normal_alt_count AS "normalAltCount", + mutation.normal_ref_count AS "normalRefCount", + mutation.amino_acid_change AS "aminoAcidChange", + mutation_event.chr AS "chr", + mutation_event.start_position AS "startPosition", + mutation_event.end_position AS "endPosition", + mutation_event.reference_allele AS "referenceAllele", + mutation_event.tumor_seq_allele AS "tumorSeqAllele", + mutation_event.protein_change AS "proteinChange", + mutation_event.mutation_type AS "mutationType", + mutation_event.ncbi_build AS "ncbiBuild", + mutation_event.variant_type AS "variantType", + mutation_event.refseq_mrna_id AS "refseqMrnaId", + mutation_event.protein_pos_start AS "proteinPosStart", + mutation_event.protein_pos_end AS "proteinPosEnd", + mutation_event.keyword AS "keyword", + mutation.annotation_json AS "annotationJSON", + alteration_driver_annotation.driver_filter AS "driverFilter", + alteration_driver_annotation.driver_filter_annotation AS "driverFilterAnnotation", + alteration_driver_annotation.driver_tiers_filter AS "driverTiersFilter", + alteration_driver_annotation.driver_tiers_filter_annotation as "driverTiersFilterAnnotation" , - + , @@ -49,13 +49,13 @@ - + ORDER BY "${sortBy}" ${direction} - ORDER BY genetic_profile.STABLE_ID ASC, sample.STABLE_ID ASC, mutation.ENTREZ_GENE_ID ASC + ORDER BY genetic_profile.stable_id ASC, sample.stable_id ASC, mutation.entrez_gene_id ASC LIMIT #{limit} OFFSET #{offset} @@ -64,60 +64,54 @@ FROM mutation - INNER JOIN genetic_profile ON mutation.GENETIC_PROFILE_ID = genetic_profile.GENETIC_PROFILE_ID - INNER JOIN sample ON mutation.SAMPLE_ID = sample.INTERNAL_ID - INNER JOIN patient ON sample.PATIENT_ID = patient.INTERNAL_ID - INNER JOIN cancer_study ON patient.CANCER_STUDY_ID = cancer_study.CANCER_STUDY_ID + INNER JOIN genetic_profile ON mutation.genetic_profile_id = genetic_profile.genetic_profile_id + INNER JOIN sample ON mutation.sample_id = sample.internal_id + INNER JOIN patient ON sample.patient_id = patient.internal_id + INNER JOIN cancer_study ON patient.cancer_study_id = cancer_study.cancer_study_id LEFT JOIN alteration_driver_annotation ON - mutation.GENETIC_PROFILE_ID = alteration_driver_annotation.GENETIC_PROFILE_ID - and mutation.SAMPLE_ID = alteration_driver_annotation.SAMPLE_ID - and mutation.MUTATION_EVENT_ID = alteration_driver_annotation.ALTERATION_EVENT_ID + mutation.genetic_profile_id = alteration_driver_annotation.genetic_profile_id + AND mutation.sample_id = alteration_driver_annotation.sample_id + AND mutation.mutation_event_id = alteration_driver_annotation.alteration_event_id - genetic_profile.STABLE_ID = #{molecularProfileId} + genetic_profile.stable_id = #{molecularProfileId} - AND sample.STABLE_ID IN - - #{item} - + AND sample.stable_id IN + #{item} - AND mutation.ENTREZ_GENE_ID IN - - #{item} - + AND mutation.entrez_gene_id IN + #{item} - AND mutation_event.REFERENCE_ALLELE IN ('A','T','C','G') - AND mutation_event.TUMOR_SEQ_ALLELE IN ('A','T','C','G') + AND mutation_event.reference_allele IN ('A','T','C','G') + AND mutation_event.tumor_seq_allele IN ('A','T','C','G') - genetic_profile.STABLE_ID = #{molecularProfileId} - AND mutation.SAMPLE_ID IN + genetic_profile.stable_id = #{molecularProfileId} + AND mutation.sample_id IN ( - SELECT sample_list_list.SAMPLE_ID FROM sample_list_list - INNER JOIN sample_list ON sample_list_list.LIST_ID = sample_list.LIST_ID - WHERE sample_list.STABLE_ID = #{sampleListId} - AND sample_list_list.SAMPLE_ID = mutation.SAMPLE_ID + SELECT sample_list_list.sample_id FROM sample_list_list + INNER JOIN sample_list ON sample_list_list.list_id = sample_list.list_id + WHERE sample_list.stable_id = #{sampleListId} + AND sample_list_list.sample_id = mutation.sample_id ) - AND mutation.ENTREZ_GENE_ID IN - - #{item} - + AND mutation.entrez_gene_id IN + #{item} - AND mutation_event.REFERENCE_ALLELE IN ('A','T','C','G') - AND mutation_event.TUMOR_SEQ_ALLELE IN ('A','T','C','G') + AND mutation_event.reference_allele IN ('A','T','C','G') + AND mutation_event.tumor_seq_allele IN ('A','T','C','G') @@ -125,49 +119,39 @@ - mutation.SAMPLE_ID IN ( - SELECT sample.INTERNAL_ID from sample - INNER JOIN patient ON sample.PATIENT_ID = patient.INTERNAL_ID - INNER JOIN genetic_profile ON patient.CANCER_STUDY_ID = genetic_profile.CANCER_STUDY_ID + mutation.sample_id IN ( + SELECT sample.internal_id FROM sample + INNER JOIN patient ON sample.patient_id = patient.internal_id + INNER JOIN genetic_profile ON patient.cancer_study_id = genetic_profile.cancer_study_id WHERE - genetic_profile.STABLE_ID = #{molecularProfileIds[0]} AND - sample.STABLE_ID IN - - #{item} - + genetic_profile.stable_id = #{molecularProfileIds[0]} AND + sample.stable_id IN + #{item} - (sample.STABLE_ID, genetic_profile.STABLE_ID) IN - - (#{sampleIds[${i}]}, #{molecularProfileIds[${i}]}) - - AND genetic_profile.STABLE_ID IN - - #{item} - + (sample.stable_id, genetic_profile.stable_id) IN + (#{sampleIds[${i}]},#{molecularProfileIds[${i}]}) + AND genetic_profile.stable_id IN + #{item} - AND sample.INTERNAL_ID = mutation.SAMPLE_ID + AND sample.internal_id = mutation.sample_id ) - genetic_profile.STABLE_ID IN - - #{item} - + genetic_profile.stable_id IN + #{item} - AND mutation.ENTREZ_GENE_ID IN - - #{item} - + AND mutation.entrez_gene_id IN + #{item} - AND mutation_event.REFERENCE_ALLELE IN ('A','T','C','G') - AND mutation_event.TUMOR_SEQ_ALLELE IN ('A','T','C','G') + AND mutation_event.reference_allele IN ('A','T','C','G') + AND mutation_event.tumor_seq_allele IN ('A','T','C','G') @@ -176,20 +160,20 @@ AND - ( mutation.ENTREZ_GENE_ID = '${geneFilterQuery.getEntrezGeneId()}' + ( mutation.entrez_gene_id = '${geneFilterQuery.getEntrezGeneId()}' - OR LOWER(mutation.MUTATION_STATUS) = 'germline' + OR LOWER(mutation.mutation_status) = 'germline' - OR LOWER(mutation.MUTATION_STATUS) = 'somatic' + OR LOWER(mutation.mutation_status) = 'somatic' - OR LOWER(mutation.MUTATION_STATUS) NOT IN ('somatic', 'germline') + OR LOWER(mutation.mutation_status) NOT IN ('somatic', 'germline') @@ -199,21 +183,21 @@ - + - OR LOWER(alteration_driver_annotation.DRIVER_FILTER) = 'putative_driver' + OR LOWER(alteration_driver_annotation.driver_filter) = 'putative_driver' - OR LOWER(alteration_driver_annotation.DRIVER_FILTER) = 'putative_passenger' + OR LOWER(alteration_driver_annotation.driver_filter) = 'putative_passenger' - OR alteration_driver_annotation.DRIVER_FILTER IS NULL - OR LOWER(alteration_driver_annotation.DRIVER_FILTER) IN ('unknown', 'na', '') + OR alteration_driver_annotation.driver_filter IS NULL + OR LOWER(alteration_driver_annotation.driver_filter) IN ('unknown', 'na', '') @@ -229,20 +213,18 @@ - AND NOT alteration_driver_annotation.DRIVER_TIERS_FILTER IS NULL - AND NOT LOWER(alteration_driver_annotation.DRIVER_TIERS_FILTER) IN ('', 'na', 'unknown') + AND NOT alteration_driver_annotation.driver_tiers_filter IS NULL + AND NOT LOWER(alteration_driver_annotation.driver_tiers_filter) IN ('', 'na', 'unknown') - OR alteration_driver_annotation.DRIVER_TIERS_FILTER IN - - #{item} - + OR alteration_driver_annotation.driver_tiers_filter IN + #{item} - OR alteration_driver_annotation.DRIVER_TIERS_FILTER IS NULL - OR LOWER(alteration_driver_annotation.DRIVER_TIERS_FILTER) IN ('', 'na', 'unknown') + OR alteration_driver_annotation.driver_tiers_filter IS NULL + OR LOWER(alteration_driver_annotation.driver_tiers_filter) IN ('', 'na', 'unknown') @@ -259,20 +241,20 @@ - allele_specific_copy_number.ASCN_INTEGER_COPY_NUMBER AS "${prefix}ascnIntegerCopyNumber", - allele_specific_copy_number.ASCN_METHOD AS "${prefix}ascnMethod", - allele_specific_copy_number.CCF_EXPECTED_COPIES_UPPER AS "${prefix}ccfExpectedCopiesUpper", - allele_specific_copy_number.CCF_EXPECTED_COPIES AS "${prefix}ccfExpectedCopies", - allele_specific_copy_number.CLONAL AS "${prefix}clonal", - allele_specific_copy_number.MINOR_COPY_NUMBER AS "${prefix}minorCopyNumber", - allele_specific_copy_number.EXPECTED_ALT_COPIES AS "${prefix}expectedAltCopies", - allele_specific_copy_number.TOTAL_COPY_NUMBER AS "${prefix}totalCopyNumber" + allele_specific_copy_number.ascn_integer_copy_number AS "${prefix}ascnIntegerCopyNumber", + allele_specific_copy_number.ascn_method AS "${prefix}ascnMethod", + allele_specific_copy_number.ccf_expected_copies_upper AS "${prefix}ccfExpectedCopiesUpper", + allele_specific_copy_number.ccf_expected_copies AS "${prefix}ccfExpectedCopies", + allele_specific_copy_number.clonal AS "${prefix}clonal", + allele_specific_copy_number.minor_copy_number AS "${prefix}minorCopyNumber", + allele_specific_copy_number.expected_alt_copies AS "${prefix}expectedAltCopies", + allele_specific_copy_number.total_copy_number AS "${prefix}totalCopyNumber" - LEFT JOIN allele_specific_copy_number ON mutation.MUTATION_EVENT_ID = allele_specific_copy_number.MUTATION_EVENT_ID - AND mutation.GENETIC_PROFILE_ID = allele_specific_copy_number.GENETIC_PROFILE_ID - AND mutation.SAMPLE_ID = allele_specific_copy_number.SAMPLE_ID + LEFT JOIN allele_specific_copy_number ON mutation.mutation_event_id = allele_specific_copy_number.mutation_event_id + AND mutation.genetic_profile_id = allele_specific_copy_number.genetic_profile_id + AND mutation.sample_id = allele_specific_copy_number.sample_id @@ -293,9 +275,9 @@ SELECT - INNER JOIN mutation_event ON mutation.MUTATION_EVENT_ID = mutation_event.MUTATION_EVENT_ID + INNER JOIN mutation_event ON mutation.mutation_event_id = mutation_event.mutation_event_id - INNER JOIN gene ON mutation.ENTREZ_GENE_ID = gene.ENTREZ_GENE_ID + INNER JOIN gene ON mutation.entrez_gene_id = gene.entrez_gene_id @@ -303,7 +285,7 @@ ORDER BY "${sortBy}" ${direction} - ORDER BY genetic_profile.STABLE_ID ASC, sample.STABLE_ID ASC, mutation.ENTREZ_GENE_ID ASC + ORDER BY genetic_profile.stable_id ASC, sample.stable_id ASC, mutation.entrez_gene_id ASC LIMIT #{limit} OFFSET #{offset} @@ -313,9 +295,9 @@ @@ -323,9 +305,9 @@ SELECT - INNER JOIN mutation_event ON mutation.MUTATION_EVENT_ID = mutation_event.MUTATION_EVENT_ID + INNER JOIN mutation_event ON mutation.mutation_event_id = mutation_event.mutation_event_id - INNER JOIN gene ON mutation.ENTREZ_GENE_ID = gene.ENTREZ_GENE_ID + INNER JOIN gene ON mutation.entrez_gene_id = gene.entrez_gene_id @@ -336,9 +318,9 @@ SELECT - INNER JOIN mutation_event ON mutation.MUTATION_EVENT_ID = mutation_event.MUTATION_EVENT_ID + INNER JOIN mutation_event ON mutation.mutation_event_id = mutation_event.mutation_event_id - INNER JOIN gene ON mutation.ENTREZ_GENE_ID = gene.ENTREZ_GENE_ID + INNER JOIN gene ON mutation.entrez_gene_id = gene.entrez_gene_id @@ -348,61 +330,63 @@ - + diff --git a/src/main/resources/org/cbioportal/persistence/mybatis/PatientMapper.xml b/src/main/resources/org/cbioportal/persistence/mybatis/PatientMapper.xml index 3b396bdfa6a..0c8907da4b3 100644 --- a/src/main/resources/org/cbioportal/persistence/mybatis/PatientMapper.xml +++ b/src/main/resources/org/cbioportal/persistence/mybatis/PatientMapper.xml @@ -4,10 +4,10 @@ - patient.INTERNAL_ID AS "${prefix}internalId", - patient.STABLE_ID AS "${prefix}stableId", - patient.CANCER_STUDY_ID AS "${prefix}cancerStudyId", - cancer_study.CANCER_STUDY_IDENTIFIER AS "${prefix}cancerStudyIdentifier" + patient.internal_id AS "${prefix}internalId", + patient.stable_id AS "${prefix}stableId", + patient.cancer_study_id AS "${prefix}cancerStudyId", + cancer_study.cancer_study_identifier AS "${prefix}cancerStudyIdentifier" , @@ -18,28 +18,26 @@ FROM patient - INNER JOIN cancer_study ON patient.CANCER_STUDY_ID = cancer_study.CANCER_STUDY_ID - INNER JOIN reference_genome ON cancer_study.REFERENCE_GENOME_ID = reference_genome.REFERENCE_GENOME_ID + INNER JOIN cancer_study ON patient.cancer_study_id = cancer_study.cancer_study_id + INNER JOIN reference_genome ON cancer_study.reference_genome_id = reference_genome.reference_genome_id - cancer_study.CANCER_STUDY_IDENTIFIER = #{studyIds[0]} + cancer_study.cancer_study_identifier = #{studyIds[0]} - (cancer_study.CANCER_STUDY_IDENTIFIER, patient.STABLE_ID) IN - - (#{studyIds[${i}]}, #{patientIds[${i}]}) - + (cancer_study.cancer_study_identifier,patient.stable_id) IN + (#{studyIds[${i}]},#{patientIds[${i}]}) - patient.STABLE_ID like CONCAT('%', #{item}, '%') + patient.stable_id like CONCAT('%', #{item}, '%') OR - sample.STABLE_ID like CONCAT('%', #{item}, '%') + sample.stable_id like CONCAT('%', #{item}, '%') @@ -52,17 +50,17 @@ - INNER JOIN sample ON patient.INTERNAL_ID = sample.PATIENT_ID + INNER JOIN sample ON patient.internal_id = sample.patient_id ORDER BY "${sortBy}" ${direction} - ORDER BY patient.STABLE_ID ASC + ORDER BY patient.stable_id ASC - ORDER BY CASE WHEN patient.STABLE_ID LIKE CONCAT(#{keyword}, '%') THEN 0 ELSE 1 END, patient.STABLE_ID + ORDER BY CASE WHEN patient.stable_id LIKE CONCAT(#{keyword}, '%') THEN 0 ELSE 1 END, patient.stable_id LIMIT #{limit} OFFSET #{offset} @@ -74,7 +72,7 @@ COUNT(*) AS totalCount - INNER JOIN sample ON patient.INTERNAL_ID = sample.PATIENT_ID + INNER JOIN sample ON patient.internal_id = sample.patient_id @@ -85,30 +83,26 @@ - WHERE patient.STABLE_ID = #{patientId} - AND cancer_study.CANCER_STUDY_IDENTIFIER = #{studyId} + WHERE patient.stable_id = #{patientId} + AND cancer_study.cancer_study_identifier = #{studyId} @@ -37,15 +37,13 @@ FROM reference_genome_gene - INNER JOIN reference_genome ON reference_genome.REFERENCE_GENOME_ID = reference_genome_gene.REFERENCE_GENOME_ID - INNER JOIN gene ON gene.ENTREZ_GENE_ID = reference_genome_gene.ENTREZ_GENE_ID + INNER JOIN reference_genome ON reference_genome.reference_genome_id = reference_genome_gene.reference_genome_id + INNER JOIN gene ON gene.entrez_gene_id = reference_genome_gene.entrez_gene_id - gene.HUGO_GENE_SYMBOL IN - - #{item} - - AND reference_genome.NAME = #{genomeName} + gene.hugo_gene_symbol IN + #{item} + AND reference_genome.name = #{genomeName} FALSE @@ -59,34 +57,32 @@ FROM reference_genome_gene - INNER JOIN reference_genome ON reference_genome.REFERENCE_GENOME_ID = reference_genome_gene.REFERENCE_GENOME_ID - INNER JOIN gene ON gene.ENTREZ_GENE_ID = reference_genome_gene.ENTREZ_GENE_ID + INNER JOIN reference_genome ON reference_genome.reference_genome_id = reference_genome_gene.reference_genome_id + INNER JOIN gene ON gene.entrez_gene_id = reference_genome_gene.entrez_gene_id - gene.ENTREZ_GENE_ID IN - - #{item} - - AND reference_genome.NAME = #{genomeName} + gene.entrez_gene_id IN + #{item} + AND reference_genome.name = #{genomeName} FALSE - + diff --git a/src/main/resources/org/cbioportal/persistence/mybatis/SampleListMapper.xml b/src/main/resources/org/cbioportal/persistence/mybatis/SampleListMapper.xml index ffb47f850f5..756cf5dc124 100644 --- a/src/main/resources/org/cbioportal/persistence/mybatis/SampleListMapper.xml +++ b/src/main/resources/org/cbioportal/persistence/mybatis/SampleListMapper.xml @@ -4,15 +4,16 @@ - sample_list.LIST_ID AS "${prefix}listId", - sample_list.STABLE_ID AS "${prefix}stableId" + + ANY_VALUE(sample_list.list_id) AS "${prefix}listId", + ANY_VALUE(sample_list.stable_id) AS "${prefix}stableId" , - sample_list.CANCER_STUDY_ID AS "${prefix}cancerStudyId", - cancer_study.CANCER_STUDY_IDENTIFIER AS "${prefix}cancerStudyIdentifier", - sample_list.CATEGORY AS "${prefix}category", - sample_list.NAME AS "${prefix}name", - sample_list.DESCRIPTION AS "${prefix}description" + ANY_VALUE(sample_list.cancer_study_id) AS "${prefix}cancerStudyId", + ANY_VALUE(cancer_study.cancer_study_identifier) AS "${prefix}cancerStudyIdentifier", + ANY_VALUE(sample_list.category) AS "${prefix}category", + ANY_VALUE(sample_list.name) AS "${prefix}name", + ANY_VALUE(sample_list.description) AS "${prefix}description" , @@ -28,25 +29,22 @@ FROM sample_list - INNER JOIN cancer_study ON sample_list.CANCER_STUDY_ID = cancer_study.CANCER_STUDY_ID - INNER JOIN reference_genome ON cancer_study.REFERENCE_GENOME_ID = reference_genome.REFERENCE_GENOME_ID + INNER JOIN cancer_study ON sample_list.cancer_study_id = cancer_study.cancer_study_id + INNER JOIN reference_genome ON cancer_study.reference_genome_id = reference_genome.reference_genome_id WHERE FALSE - WHERE cancer_study.CANCER_STUDY_IDENTIFIER IN - - #{item} - + WHERE cancer_study.cancer_study_identifier IN + #{item} - + ORDER BY "${sortBy}" ${direction} - ORDER BY sample_list.STABLE_ID ASC + ORDER BY sample_list.stable_id ASC LIMIT #{limit} OFFSET #{offset} @@ -58,8 +56,8 @@ COUNT(*) AS totalCount FROM sample_list - INNER JOIN cancer_study ON sample_list.CANCER_STUDY_ID = cancer_study.CANCER_STUDY_ID - WHERE cancer_study.CANCER_STUDY_IDENTIFIER = #{studyId} + INNER JOIN cancer_study ON sample_list.cancer_study_id = cancer_study.cancer_study_id + WHERE cancer_study.cancer_study_identifier = #{studyId} @@ -69,9 +67,9 @@ FROM sample_list - INNER JOIN cancer_study ON sample_list.CANCER_STUDY_ID = cancer_study.CANCER_STUDY_ID - INNER JOIN reference_genome ON cancer_study.REFERENCE_GENOME_ID = reference_genome.REFERENCE_GENOME_ID - WHERE sample_list.STABLE_ID = #{sampleListId} + INNER JOIN cancer_study ON sample_list.cancer_study_id = cancer_study.cancer_study_id + INNER JOIN reference_genome ON cancer_study.reference_genome_id = reference_genome.reference_genome_id + WHERE sample_list.stable_id = #{sampleListId} diff --git a/src/main/resources/org/cbioportal/persistence/mybatis/SampleMapper.xml b/src/main/resources/org/cbioportal/persistence/mybatis/SampleMapper.xml index 21f4e86da37..37b68b0ec87 100644 --- a/src/main/resources/org/cbioportal/persistence/mybatis/SampleMapper.xml +++ b/src/main/resources/org/cbioportal/persistence/mybatis/SampleMapper.xml @@ -4,65 +4,55 @@ - sample.INTERNAL_ID AS "${prefix}internalId", - sample.STABLE_ID AS "${prefix}stableId", - patient.STABLE_ID AS "${prefix}patientStableId", - cancer_study.CANCER_STUDY_IDENTIFIER AS "${prefix}cancerStudyIdentifier" + sample.internal_id AS "${prefix}internalId", + sample.stable_id AS "${prefix}stableId", + patient.stable_id AS "${prefix}patientStableId", + cancer_study.cancer_study_identifier AS "${prefix}cancerStudyIdentifier" , - sample.SAMPLE_TYPE AS "${prefix}sampleType", - sample.PATIENT_ID AS "${prefix}patientId" + sample.sample_type AS "${prefix}sampleType", + sample.patient_id AS "${prefix}patientId" , - + FROM sample - INNER JOIN patient ON sample.PATIENT_ID = patient.INTERNAL_ID - INNER JOIN cancer_study ON patient.CANCER_STUDY_ID = cancer_study.CANCER_STUDY_ID - INNER JOIN reference_genome ON cancer_study.REFERENCE_GENOME_ID = reference_genome.REFERENCE_GENOME_ID + INNER JOIN patient ON sample.patient_id = patient.internal_id + INNER JOIN cancer_study ON patient.cancer_study_id = cancer_study.cancer_study_id + INNER JOIN reference_genome ON cancer_study.reference_genome_id = reference_genome.reference_genome_id - cancer_study.CANCER_STUDY_IDENTIFIER IN - - (NULL) - - - - #{item} - - + cancer_study.cancer_study_identifier IN + (NULL) + #{item} - cancer_study.CANCER_STUDY_IDENTIFIER = #{studyIds[0]} AND - sample.STABLE_ID IN - - #{item} - + cancer_study.cancer_study_identifier = #{studyIds[0]} AND + sample.stable_id IN + #{item} - (cancer_study.CANCER_STUDY_IDENTIFIER, sample.STABLE_ID) IN - - (#{studyIds[${i}]}, #{sampleIds[${i}]}) - + (cancer_study.cancer_study_identifier,sample.stable_id) IN + (#{studyIds[${i}]},#{sampleIds[${i}]}) - AND patient.STABLE_ID = #{patientId} + AND patient.stable_id = #{patientId} AND - sample.STABLE_ID like CONCAT('%', #{item}, '%') + sample.stable_id like CONCAT('%', #{item}, '%') @@ -79,10 +69,10 @@ ORDER BY "${sortBy}" ${direction} - ORDER BY sample.STABLE_ID ASC + ORDER BY sample.stable_id ASC - ORDER BY CASE WHEN sample.STABLE_ID LIKE CONCAT(#{keyword}, '%') THEN 0 ELSE 1 END, sample.STABLE_ID + ORDER BY CASE WHEN sample.stable_id LIKE CONCAT(#{keyword}, '%') THEN 0 ELSE 1 END, sample.stable_id LIMIT #{limit} OFFSET #{offset} @@ -95,15 +85,12 @@ - WHERE sample.INTERNAL_ID IN + WHERE sample.internal_id IN ( - SELECT sample_list_list.SAMPLE_ID FROM sample_list_list - INNER JOIN sample_list ON sample_list_list.LIST_ID = sample_list.LIST_ID - WHERE sample_list.STABLE_ID IN - - #{item} - - AND sample_list_list.SAMPLE_ID = sample.INTERNAL_ID + SELECT sample_list_list.sample_id FROM sample_list_list + INNER JOIN sample_list ON sample_list_list.list_id = sample_list.list_id + WHERE sample_list.stable_id IN + #{item} ) @@ -118,15 +105,12 @@ SELECT COUNT(*) AS "totalCount" - WHERE sample.INTERNAL_ID IN + WHERE sample.internal_id IN ( - SELECT sample_list_list.SAMPLE_ID FROM sample_list_list - INNER JOIN sample_list ON sample_list_list.LIST_ID = sample_list.LIST_ID - WHERE sample_list.STABLE_ID IN - - #{item} - - AND sample_list_list.SAMPLE_ID = sample.INTERNAL_ID + SELECT sample_list_list.sample_id FROM sample_list_list + INNER JOIN sample_list ON sample_list_list.list_id = sample_list.list_id + WHERE sample_list.stable_id IN + #{item} ) @@ -136,8 +120,8 @@ - WHERE sample.STABLE_ID = #{sampleId} - AND cancer_study.CANCER_STUDY_IDENTIFIER = #{studyId} + WHERE sample.stable_id = #{sampleId} + AND cancer_study.cancer_study_identifier = #{studyId} - + @@ -189,17 +169,13 @@ WHERE - cancer_study.CANCER_STUDY_IDENTIFIER = #{studyIds[0]} AND - patient.STABLE_ID IN - - #{item} - + cancer_study.cancer_study_identifier = #{studyIds[0]} AND + patient.stable_id IN + #{item} - (cancer_study.CANCER_STUDY_IDENTIFIER, patient.STABLE_ID) IN - - (#{studyIds[${i}]}, #{patientIds[${i}]}) - + (cancer_study.cancer_study_identifier,patient.stable_id) IN + (#{studyIds[${i}]},#{patientIds[${i}]}) diff --git a/src/main/resources/org/cbioportal/persistence/mybatis/SecurityMapper.xml b/src/main/resources/org/cbioportal/persistence/mybatis/SecurityMapper.xml index 77eb4a73004..d60fcc994c2 100644 --- a/src/main/resources/org/cbioportal/persistence/mybatis/SecurityMapper.xml +++ b/src/main/resources/org/cbioportal/persistence/mybatis/SecurityMapper.xml @@ -4,7 +4,7 @@ - + @@ -40,9 +40,9 @@ diff --git a/src/main/resources/org/cbioportal/persistence/mybatis/SignificantCopyNumberRegionMapper.xml b/src/main/resources/org/cbioportal/persistence/mybatis/SignificantCopyNumberRegionMapper.xml index eeea7c87f8c..a55c5d1f5b5 100644 --- a/src/main/resources/org/cbioportal/persistence/mybatis/SignificantCopyNumberRegionMapper.xml +++ b/src/main/resources/org/cbioportal/persistence/mybatis/SignificantCopyNumberRegionMapper.xml @@ -2,26 +2,26 @@ - + - gistic.GISTIC_ROI_ID AS "gisticRoiId", - cancer_study.CANCER_STUDY_IDENTIFIER AS "cancerStudyId", - gistic.CHROMOSOME AS "chromosome", - gistic.CYTOBAND AS "cytoband", - gistic.WIDE_PEAK_START AS "widePeakStart", - gistic.WIDE_PEAK_END AS "widePeakEnd", - gistic.Q_VALUE AS "qValue", - gistic.AMP AS "amp" + gistic.gistic_roi_id AS "gisticRoiId", + cancer_study.cancer_study_identifier AS "cancerStudyId", + gistic.chromosome AS "chromosome", + gistic.cytoband AS "cytoband", + gistic.wide_peak_start AS "widePeakStart", + gistic.wide_peak_end AS "widePeakEnd", + gistic.q_value AS "qValue", + gistic.amp AS "amp" FROM gistic - INNER JOIN cancer_study ON gistic.CANCER_STUDY_ID = cancer_study.CANCER_STUDY_ID + INNER JOIN cancer_study ON gistic.cancer_study_id = cancer_study.cancer_study_id - cancer_study.CANCER_STUDY_IDENTIFIER = #{studyId} + cancer_study.cancer_study_identifier = #{studyId} @@ -34,7 +34,7 @@ ORDER BY "${sortBy}" ${direction} - ORDER BY gistic.CANCER_STUDY_ID ASC + ORDER BY gistic.cancer_study_id ASC LIMIT #{limit} OFFSET #{offset} @@ -47,20 +47,18 @@ - + diff --git a/src/main/resources/org/cbioportal/persistence/mybatis/SignificantlyMutatedGeneMapper.xml b/src/main/resources/org/cbioportal/persistence/mybatis/SignificantlyMutatedGeneMapper.xml index 51d26473570..548056c6cf1 100644 --- a/src/main/resources/org/cbioportal/persistence/mybatis/SignificantlyMutatedGeneMapper.xml +++ b/src/main/resources/org/cbioportal/persistence/mybatis/SignificantlyMutatedGeneMapper.xml @@ -4,25 +4,25 @@ - mut_sig.ENTREZ_GENE_ID AS "entrezGeneId", - mut_sig.CANCER_STUDY_ID AS "cancerStudyId", - cancer_study.CANCER_STUDY_IDENTIFIER AS "cancerStudyIdentifier", - gene.HUGO_GENE_SYMBOL AS "hugoGeneSymbol", - mut_sig.`RANK` AS `rank`, - mut_sig.NumBasesCovered AS "numBasesCovered", - mut_sig.NumMutations AS "numMutations", - mut_sig.P_VALUE AS "pValue", - mut_sig.Q_VALUE AS "qValue" + mut_sig.entrez_gene_id AS "entrezGeneId", + mut_sig.cancer_study_id AS "cancerStudyId", + cancer_study.cancer_study_identifier AS "cancerStudyIdentifier", + gene.hugo_gene_symbol AS "hugoGeneSymbol", + mut_sig.`rank` AS `rank`, + mut_sig.numbasescovered AS "numBasesCovered", + mut_sig.nummutations AS "numMutations", + mut_sig.p_value AS "pValue", + mut_sig.q_value AS "qValue" FROM mut_sig - INNER JOIN cancer_study ON mut_sig.CANCER_STUDY_ID = cancer_study.CANCER_STUDY_ID + INNER JOIN cancer_study ON mut_sig.cancer_study_id = cancer_study.cancer_study_id - cancer_study.CANCER_STUDY_IDENTIFIER = #{studyId} + cancer_study.cancer_study_identifier = #{studyId} @@ -30,13 +30,13 @@ SELECT - INNER JOIN gene ON mut_sig.ENTREZ_GENE_ID = gene.ENTREZ_GENE_ID + INNER JOIN gene ON mut_sig.entrez_gene_id = gene.entrez_gene_id ORDER BY "${sortBy}" ${direction} - ORDER BY mut_sig.ENTREZ_GENE_ID ASC + ORDER BY mut_sig.entrez_gene_id ASC LIMIT #{limit} OFFSET #{offset} diff --git a/src/main/resources/org/cbioportal/persistence/mybatis/StaticDataTimestampMapper.xml b/src/main/resources/org/cbioportal/persistence/mybatis/StaticDataTimestampMapper.xml index d1e69e5d8b7..67e6589e42a 100644 --- a/src/main/resources/org/cbioportal/persistence/mybatis/StaticDataTimestampMapper.xml +++ b/src/main/resources/org/cbioportal/persistence/mybatis/StaticDataTimestampMapper.xml @@ -6,18 +6,16 @@ - \ No newline at end of file + diff --git a/src/main/resources/org/cbioportal/persistence/mybatis/StructuralVariantMapper.xml b/src/main/resources/org/cbioportal/persistence/mybatis/StructuralVariantMapper.xml index 0fe8bbe8955..176c129a983 100644 --- a/src/main/resources/org/cbioportal/persistence/mybatis/StructuralVariantMapper.xml +++ b/src/main/resources/org/cbioportal/persistence/mybatis/StructuralVariantMapper.xml @@ -2,79 +2,73 @@ - + - genetic_profile.STABLE_ID AS "${prefix}molecularProfileId", - sample.STABLE_ID AS "${prefix}sampleId", - patient.STABLE_ID AS "${prefix}patientId", - cancer_study.CANCER_STUDY_IDENTIFIER AS "${prefix}studyId", - structural_variant.SITE1_ENTREZ_GENE_ID AS "${prefix}site1EntrezGeneId", - gene1.HUGO_GENE_SYMBOL AS "${prefix}site1HugoSymbol", - structural_variant.SITE1_ENSEMBL_TRANSCRIPT_ID AS "${prefix}site1EnsemblTranscriptId", - structural_variant.SITE1_CONTIG AS "${prefix}site1Contig", - structural_variant.SITE1_REGION AS "${prefix}site1Region", - structural_variant.SITE1_REGION_NUMBER AS "${prefix}site1RegionNumber", - structural_variant.SITE1_CHROMOSOME AS "${prefix}site1Chromosome", - structural_variant.SITE1_POSITION AS "${prefix}site1Position", - structural_variant.SITE1_DESCRIPTION AS "${prefix}site1Description", - structural_variant.SITE2_ENTREZ_GENE_ID AS "${prefix}site2EntrezGeneId", - gene2.HUGO_GENE_SYMBOL AS "${prefix}site2HugoSymbol", - structural_variant.SITE2_ENSEMBL_TRANSCRIPT_ID AS "${prefix}site2EnsemblTranscriptId", - structural_variant.SITE2_CONTIG AS "${prefix}site2Contig", - structural_variant.SITE2_REGION AS "${prefix}site2Region", - structural_variant.SITE2_REGION_NUMBER AS "${prefix}site2RegionNumber", - structural_variant.SITE2_CHROMOSOME AS "${prefix}site2Chromosome", - structural_variant.SITE2_POSITION AS "${prefix}site2Position", - structural_variant.SITE2_DESCRIPTION AS "${prefix}site2Description", - structural_variant.SITE2_EFFECT_ON_FRAME AS "${prefix}site2EffectOnFrame", - structural_variant.NCBI_BUILD AS "${prefix}ncbiBuild", - structural_variant.DNA_SUPPORT AS "${prefix}dnaSupport", - structural_variant.RNA_SUPPORT AS "${prefix}rnaSupport", - structural_variant.NORMAL_READ_COUNT AS "${prefix}normalReadCount", - structural_variant.TUMOR_READ_COUNT AS "${prefix}tumorReadCount", - structural_variant.NORMAL_VARIANT_COUNT AS "${prefix}normalVariantCount", - structural_variant.TUMOR_VARIANT_COUNT AS "${prefix}tumorVariantCount", - structural_variant.NORMAL_PAIRED_END_READ_COUNT AS "${prefix}normalPairedEndReadCount", - structural_variant.TUMOR_PAIRED_END_READ_COUNT AS "${prefix}tumorPairedEndReadCount", - structural_variant.NORMAL_SPLIT_READ_COUNT AS "${prefix}normalSplitReadCount", - structural_variant.TUMOR_SPLIT_READ_COUNT AS "${prefix}tumorSplitReadCount", - structural_variant.ANNOTATION AS "${prefix}annotation", - structural_variant.BREAKPOINT_TYPE AS "${prefix}breakpointType", - structural_variant.CONNECTION_TYPE AS "${prefix}connectionType", - structural_variant.EVENT_INFO AS "${prefix}eventInfo", - structural_variant.CLASS AS "${prefix}variantClass", - structural_variant.LENGTH AS "${prefix}length", - structural_variant.COMMENTS AS "${prefix}comments", - structural_variant.SV_STATUS AS "${prefix}svStatus", - structural_variant.ANNOTATION_JSON AS "${prefix}annotationJson", - alteration_driver_annotation.DRIVER_FILTER AS "${prefix}driverFilter", - alteration_driver_annotation.DRIVER_FILTER_ANNOTATION AS "${prefix}driverFilterAnn", - alteration_driver_annotation.DRIVER_TIERS_FILTER AS "${prefix}driverTiersFilter", - alteration_driver_annotation.DRIVER_TIERS_FILTER_ANNOTATION AS "${prefix}driverTiersFilterAnn" + genetic_profile.stable_id AS "${prefix}molecularProfileId", + sample.stable_id AS "${prefix}sampleId", + patient.stable_id AS "${prefix}patientId", + cancer_study.cancer_study_identifier AS "${prefix}studyId", + structural_variant.site1_entrez_gene_id AS "${prefix}site1EntrezGeneId", + gene1.hugo_gene_symbol AS "${prefix}site1HugoSymbol", + structural_variant.site1_ensembl_transcript_id AS "${prefix}site1EnsemblTranscriptId", + structural_variant.site1_contig AS "${prefix}site1Contig", + structural_variant.site1_region AS "${prefix}site1Region", + structural_variant.site1_region_number AS "${prefix}site1RegionNumber", + structural_variant.site1_chromosome AS "${prefix}site1Chromosome", + structural_variant.site1_position AS "${prefix}site1Position", + structural_variant.site1_description AS "${prefix}site1Description", + structural_variant.site2_entrez_gene_id AS "${prefix}site2EntrezGeneId", + gene2.hugo_gene_symbol AS "${prefix}site2HugoSymbol", + structural_variant.site2_ensembl_transcript_id AS "${prefix}site2EnsemblTranscriptId", + structural_variant.site2_contig AS "${prefix}site2Contig", + structural_variant.site2_region AS "${prefix}site2Region", + structural_variant.site2_region_number AS "${prefix}site2RegionNumber", + structural_variant.site2_chromosome AS "${prefix}site2Chromosome", + structural_variant.site2_position AS "${prefix}site2Position", + structural_variant.site2_description AS "${prefix}site2Description", + structural_variant.site2_effect_on_frame AS "${prefix}site2EffectOnFrame", + structural_variant.ncbi_build AS "${prefix}ncbiBuild", + structural_variant.dna_support AS "${prefix}dnaSupport", + structural_variant.rna_support AS "${prefix}rnaSupport", + structural_variant.normal_read_count AS "${prefix}normalReadCount", + structural_variant.tumor_read_count AS "${prefix}tumorReadCount", + structural_variant.normal_variant_count AS "${prefix}normalVariantCount", + structural_variant.tumor_variant_count AS "${prefix}tumorVariantCount", + structural_variant.normal_paired_end_read_count AS "${prefix}normalPairedEndReadCount", + structural_variant.tumor_paired_end_read_count AS "${prefix}tumorPairedEndReadCount", + structural_variant.normal_split_read_count AS "${prefix}normalSplitReadCount", + structural_variant.tumor_split_read_count AS "${prefix}tumorSplitReadCount", + structural_variant.annotation AS "${prefix}annotation", + structural_variant.breakpoint_type AS "${prefix}breakpointType", + structural_variant.connection_type AS "${prefix}connectionType", + structural_variant.event_info AS "${prefix}eventInfo", + structural_variant.class AS "${prefix}variantClass", + structural_variant.length AS "${prefix}length", + structural_variant.comments AS "${prefix}comments", + structural_variant.sv_status AS "${prefix}svStatus", + structural_variant.annotation_json AS "${prefix}annotationJson", + alteration_driver_annotation.driver_filter AS "${prefix}driverFilter", + alteration_driver_annotation.driver_filter_annotation AS "${prefix}driverFilterAnn", + alteration_driver_annotation.driver_tiers_filter AS "${prefix}driverTiersFilter", + alteration_driver_annotation.driver_tiers_filter_annotation AS "${prefix}driverTiersFilterAnn" - AND + AND - genetic_profile.STABLE_ID IN - - #{item} - + genetic_profile.stable_id IN + #{item} - genetic_profile.STABLE_ID = #{molecularProfileIds[0]} AND - sample.STABLE_ID IN - - #{item} - + genetic_profile.stable_id = #{molecularProfileIds[0]} AND + sample.stable_id IN + #{item} - (sample.STABLE_ID, genetic_profile.STABLE_ID) IN - - (#{sampleIds[${i}]}, #{molecularProfileIds[${i}]}) - + (sample.stable_id,genetic_profile.stable_id) IN + (#{sampleIds[${i}]},#{molecularProfileIds[${i}]}) @@ -86,32 +80,32 @@ ( - (structural_variant.SITE1_ENTREZ_GENE_ID = ${geneFilterQuery.getEntrezGeneId()} - OR structural_variant.SITE2_ENTREZ_GENE_ID = ${geneFilterQuery.getEntrezGeneId()}) + (structural_variant.site1_entrez_gene_id = ${geneFilterQuery.getEntrezGeneId()} + OR structural_variant.site2_entrez_gene_id = ${geneFilterQuery.getEntrezGeneId()}) - AND structural_variant.SITE1_ENTREZ_GENE_ID IS NULL + AND structural_variant.site1_entrez_gene_id IS NULL - AND structural_variant.SITE1_ENTREZ_GENE_ID = ${geneFilterQuery.getGene1Query().getEntrezId()} + AND structural_variant.site1_entrez_gene_id = ${geneFilterQuery.getGene1Query().getEntrezId()} AND - structural_variant.SITE2_ENTREZ_GENE_ID IS NULL + structural_variant.site2_entrez_gene_id IS NULL AND - structural_variant.SITE2_ENTREZ_GENE_ID = ${geneFilterQuery.getGene2Query().getEntrezId()} + structural_variant.site2_entrez_gene_id = ${geneFilterQuery.getGene2Query().getEntrezId()} - + @@ -120,13 +114,13 @@ - OR LOWER(structural_variant.SV_STATUS) = 'germline' + OR LOWER(structural_variant.sv_status) = 'germline' - OR LOWER(structural_variant.SV_STATUS) = 'somatic' + OR LOWER(structural_variant.sv_status) = 'somatic' - OR LOWER(structural_variant.SV_STATUS) NOT IN ('somatic', 'germline') + OR LOWER(structural_variant.sv_status) NOT IN ('somatic', 'germline') ) @@ -145,14 +139,14 @@ - OR LOWER(alteration_driver_annotation.DRIVER_FILTER) = 'putative_driver' + OR LOWER(alteration_driver_annotation.driver_filter) = 'putative_driver' - OR LOWER(alteration_driver_annotation.DRIVER_FILTER) = 'putative_passenger' + OR LOWER(alteration_driver_annotation.driver_filter) = 'putative_passenger' - OR alteration_driver_annotation.DRIVER_FILTER IS NULL - OR LOWER(alteration_driver_annotation.DRIVER_FILTER) IN ('unknown', 'na', '') + OR alteration_driver_annotation.driver_filter IS NULL + OR LOWER(alteration_driver_annotation.driver_filter) IN ('unknown', 'na', '') @@ -169,20 +163,18 @@ - AND NOT alteration_driver_annotation.DRIVER_TIERS_FILTER IS NULL - AND NOT LOWER(alteration_driver_annotation.DRIVER_TIERS_FILTER) IN ('', 'na', 'unknown') + AND NOT alteration_driver_annotation.driver_tiers_filter IS NULL + AND NOT LOWER(alteration_driver_annotation.driver_tiers_filter) IN ('', 'na', 'unknown') - OR alteration_driver_annotation.DRIVER_TIERS_FILTER IN - - #{item} - + OR alteration_driver_annotation.driver_tiers_filter IN + #{item} - OR alteration_driver_annotation.DRIVER_TIERS_FILTER IS NULL - OR LOWER(alteration_driver_annotation.DRIVER_TIERS_FILTER) IN ('', 'na', 'unknown') + OR alteration_driver_annotation.driver_tiers_filter IS NULL + OR LOWER(alteration_driver_annotation.driver_tiers_filter) IN ('', 'na', 'unknown') @@ -196,19 +188,15 @@ ) - + OR ( - structural_variant.SITE1_ENTREZ_GENE_ID in - - #{item} - - OR - structural_variant.SITE2_ENTREZ_GENE_ID IN - - #{item} - + structural_variant.site1_entrez_gene_id IN + #{item} + OR + structural_variant.site2_entrez_gene_id IN + #{item} ) @@ -218,22 +206,22 @@ OR ( - structural_variant.SITE1_ENTREZ_GENE_ID=#{item.gene1.entrezId} + structural_variant.site1_entrez_gene_id=#{item.gene1.entrezId} - structural_variant.SITE1_ENTREZ_GENE_ID IS NULL - + structural_variant.site1_entrez_gene_id IS NULL + TRUE - + AND - + - structural_variant.SITE2_ENTREZ_GENE_ID=#{item.gene2.entrezId} + structural_variant.site2_entrez_gene_id=#{item.gene2.entrezId} - structural_variant.SITE2_ENTREZ_GENE_ID IS NULL + structural_variant.site2_entrez_gene_id IS NULL TRUE @@ -249,16 +237,15 @@ FROM structural_variant - JOIN genetic_profile ON structural_variant.GENETIC_PROFILE_ID = genetic_profile.GENETIC_PROFILE_ID - LEFT JOIN gene gene1 ON structural_variant.SITE1_ENTREZ_GENE_ID = gene1.ENTREZ_GENE_ID - LEFT JOIN gene gene2 ON structural_variant.SITE2_ENTREZ_GENE_ID = gene2.ENTREZ_GENE_ID - JOIN sample ON structural_variant.SAMPLE_ID = sample.INTERNAL_ID - JOIN patient ON sample.PATIENT_ID = patient.INTERNAL_ID - JOIN cancer_study ON patient.CANCER_STUDY_ID = cancer_study.CANCER_STUDY_ID AND genetic_profile.CANCER_STUDY_ID = cancer_study.CANCER_STUDY_ID - LEFT JOIN alteration_driver_annotation ON - structural_variant.GENETIC_PROFILE_ID = alteration_driver_annotation.GENETIC_PROFILE_ID - and structural_variant.SAMPLE_ID = alteration_driver_annotation.SAMPLE_ID - and structural_variant.INTERNAL_ID = alteration_driver_annotation.ALTERATION_EVENT_ID + JOIN genetic_profile ON structural_variant.genetic_profile_id = genetic_profile.genetic_profile_id + LEFT JOIN gene gene1 ON structural_variant.site1_entrez_gene_id = gene1.entrez_gene_id + LEFT JOIN gene gene2 ON structural_variant.site2_entrez_gene_id = gene2.entrez_gene_id + JOIN sample ON structural_variant.sample_id = sample.internal_id + JOIN patient ON sample.patient_id = patient.internal_id + JOIN cancer_study ON patient.cancer_study_id = cancer_study.cancer_study_id AND genetic_profile.cancer_study_id = cancer_study.cancer_study_id + LEFT JOIN alteration_driver_annotation ON structural_variant.genetic_profile_id = alteration_driver_annotation.genetic_profile_id + AND structural_variant.sample_id = alteration_driver_annotation.sample_id + AND structural_variant.internal_id = alteration_driver_annotation.alteration_event_id @@ -266,7 +253,7 @@ - ORDER BY gene1.HUGO_GENE_SYMBOL, gene2.HUGO_GENE_SYMBOL + ORDER BY gene1.hugo_gene_symbol, gene2.hugo_gene_symbol - + diff --git a/src/main/resources/org/cbioportal/persistence/mybatis/StudyMapper.xml b/src/main/resources/org/cbioportal/persistence/mybatis/StudyMapper.xml index 9b580a23507..9b3a2b1d761 100644 --- a/src/main/resources/org/cbioportal/persistence/mybatis/StudyMapper.xml +++ b/src/main/resources/org/cbioportal/persistence/mybatis/StudyMapper.xml @@ -4,92 +4,93 @@ - cancer_study.CANCER_STUDY_ID AS "${prefix}cancerStudyId", - cancer_study.CANCER_STUDY_IDENTIFIER AS "${prefix}cancerStudyIdentifier" + ANY_VALUE(cancer_study.cancer_study_id) AS "${prefix}cancerStudyId", + ANY_VALUE(cancer_study.cancer_study_identifier) AS "${prefix}cancerStudyIdentifier" , - cancer_study.TYPE_OF_CANCER_ID AS "${prefix}typeOfCancerId", - cancer_study.NAME AS "${prefix}name", - cancer_study.DESCRIPTION AS "${prefix}description", - cancer_study.PUBLIC AS "${prefix}publicStudy", - cancer_study.PMID AS "${prefix}pmid", - cancer_study.CITATION AS "${prefix}citation", - cancer_study.GROUPS AS "${prefix}groups", - cancer_study.STATUS AS "${prefix}status", - cancer_study.IMPORT_DATE AS "${prefix}importDate", - reference_genome.NAME AS "${prefix}referenceGenome" + ANY_VALUE(cancer_study.type_of_cancer_id) AS "${prefix}typeOfCancerId", + ANY_VALUE(cancer_study.name) AS "${prefix}name", + ANY_VALUE(cancer_study.description) AS "${prefix}description", + ANY_VALUE(cancer_study.public) AS "${prefix}publicStudy", + ANY_VALUE(cancer_study.pmid) AS "${prefix}pmid", + ANY_VALUE(cancer_study.citation) AS "${prefix}citation", + ANY_VALUE(cancer_study.groups) AS "${prefix}groups", + ANY_VALUE(cancer_study.status) AS "${prefix}status", + ANY_VALUE(cancer_study.import_date) AS "${prefix}importDate", + ANY_VALUE(reference_genome.name) AS "${prefix}referenceGenome" , - COUNT(CASE WHEN sample_list.STABLE_ID = CONCAT(cancer_study.CANCER_STUDY_IDENTIFIER,'_sequenced') THEN 1 ELSE NULL END) AS sequencedSampleCount, - COUNT(CASE WHEN sample_list.STABLE_ID = CONCAT(cancer_study.CANCER_STUDY_IDENTIFIER,'_cna') THEN 1 ELSE NULL END) AS cnaSampleCount, - COUNT(CASE WHEN sample_list.STABLE_ID = CONCAT(cancer_study.CANCER_STUDY_IDENTIFIER,'_rna_seq_mrna') THEN 1 ELSE NULL END) AS mrnaRnaSeqSampleCount, - COUNT(CASE WHEN sample_list.STABLE_ID = CONCAT(cancer_study.CANCER_STUDY_IDENTIFIER,'_rna_seq_v2_mrna') THEN 1 ELSE NULL END) AS mrnaRnaSeqV2SampleCount, - COUNT(CASE WHEN sample_list.STABLE_ID = CONCAT(cancer_study.CANCER_STUDY_IDENTIFIER,'_microrna') THEN 1 ELSE NULL END) AS miRnaSampleCount, - COUNT(CASE WHEN sample_list.STABLE_ID = CONCAT(cancer_study.CANCER_STUDY_IDENTIFIER,'_mrna') THEN 1 ELSE NULL END) AS mrnaMicroarraySampleCount, - COUNT(CASE WHEN sample_list.STABLE_ID = CONCAT(cancer_study.CANCER_STUDY_IDENTIFIER,'_methylation_hm27') THEN 1 ELSE NULL END) AS methylationHm27SampleCount, - COUNT(CASE WHEN sample_list.STABLE_ID = CONCAT(cancer_study.CANCER_STUDY_IDENTIFIER,'_rppa') THEN 1 ELSE NULL END) AS rppaSampleCount, - COUNT(CASE WHEN sample_list.STABLE_ID = CONCAT(cancer_study.CANCER_STUDY_IDENTIFIER,'_protein_quantification') THEN 1 ELSE NULL END) AS massSpectrometrySampleCount, - COUNT(CASE WHEN sample_list.STABLE_ID = CONCAT(cancer_study.CANCER_STUDY_IDENTIFIER,'_3way_complete') THEN 1 ELSE NULL END) AS completeSampleCount, - IFNULL(treatment.count, 0 ) as treatmentCount, - COALESCE(structural_variant.count, 0) as structuralVariantCount, - type_of_cancer.TYPE_OF_CANCER_ID AS "typeOfCancer.typeOfCancerId" + COUNT(CASE WHEN sample_list.stable_id = CONCAT(cancer_study.cancer_study_identifier,'_sequenced') THEN 1 ELSE NULL END) AS sequencedSampleCount, + COUNT(CASE WHEN sample_list.stable_id = CONCAT(cancer_study.cancer_study_identifier,'_cna') THEN 1 ELSE NULL END) AS cnaSampleCount, + COUNT(CASE WHEN sample_list.stable_id = CONCAT(cancer_study.cancer_study_identifier,'_rna_seq_mrna') THEN 1 ELSE NULL END) AS mrnaRnaSeqSampleCount, + COUNT(CASE WHEN sample_list.stable_id = CONCAT(cancer_study.cancer_study_identifier,'_rna_seq_v2_mrna') THEN 1 ELSE NULL END) AS mrnaRnaSeqV2SampleCount, + COUNT(CASE WHEN sample_list.stable_id = CONCAT(cancer_study.cancer_study_identifier,'_microrna') THEN 1 ELSE NULL END) AS miRnaSampleCount, + COUNT(CASE WHEN sample_list.stable_id = CONCAT(cancer_study.cancer_study_identifier,'_mrna') THEN 1 ELSE NULL END) AS mrnaMicroarraySampleCount, + COUNT(CASE WHEN sample_list.stable_id = CONCAT(cancer_study.cancer_study_identifier,'_methylation_hm27') THEN 1 ELSE NULL END) AS methylationHm27SampleCount, + COUNT(CASE WHEN sample_list.stable_id = CONCAT(cancer_study.cancer_study_identifier,'_rppa') THEN 1 ELSE NULL END) AS rppaSampleCount, + COUNT(CASE WHEN sample_list.stable_id = CONCAT(cancer_study.cancer_study_identifier,'_protein_quantification') THEN 1 ELSE NULL END) AS massSpectrometrySampleCount, + COUNT(CASE WHEN sample_list.stable_id = CONCAT(cancer_study.cancer_study_identifier,'_3way_complete') THEN 1 ELSE NULL END) AS completeSampleCount, + IFNULL(ANY_VALUE(treatment.count), 0 ) as treatmentCount, + COALESCE(ANY_VALUE(structural_variant.count), 0) as structuralVariantCount, + ANY_VALUE(type_of_cancer.type_of_cancer_id) AS "typeOfCancer.typeOfCancerId" , - type_of_cancer.NAME AS "typeOfCancer.name", - type_of_cancer.DEDICATED_COLOR AS "typeOfCancer.dedicatedColor", - type_of_cancer.SHORT_NAME AS "typeOfCancer.shortName", - type_of_cancer.PARENT AS "typeOfCancer.parent" + ANY_VALUE(type_of_cancer.name) AS "typeOfCancer.name", + ANY_VALUE(type_of_cancer.dedicated_color) AS "typeOfCancer.dedicatedColor", + ANY_VALUE(type_of_cancer.short_name) AS "typeOfCancer.shortName", + ANY_VALUE(type_of_cancer.parent) AS "typeOfCancer.parent" FROM cancer_study - INNER JOIN sample_list ON cancer_study.CANCER_STUDY_ID = sample_list.CANCER_STUDY_ID - INNER JOIN sample_list_list ON sample_list.LIST_ID = sample_list_list.LIST_ID - INNER JOIN reference_genome ON cancer_study.REFERENCE_GENOME_ID = reference_genome.REFERENCE_GENOME_ID + INNER JOIN sample_list ON cancer_study.cancer_study_id = sample_list.cancer_study_id + + INNER JOIN sample_list_list ON sample_list.list_id = sample_list_list.list_id + INNER JOIN reference_genome ON cancer_study.reference_genome_id = reference_genome.reference_genome_id - INNER JOIN type_of_cancer ON cancer_study.TYPE_OF_CANCER_ID = type_of_cancer.TYPE_OF_CANCER_ID - left JOIN + INNER JOIN type_of_cancer ON cancer_study.type_of_cancer_id = type_of_cancer.type_of_cancer_id + LEFT JOIN ( - SELECT Count(Distinct(clinical_event.PATIENT_ID)) as count, - patient.CANCER_STUDY_ID as CANCER_STUDY_ID + SELECT + COUNT(DISTINCT(clinical_event.patient_id)) as count, + patient.cancer_study_id as cancer_study_id FROM cancer_study - INNER JOIN patient on cancer_study.CANCER_STUDY_ID = patient.CANCER_STUDY_ID - Left Join clinical_event on clinical_event.PATIENT_ID = patient.INTERNAL_ID - WHERE clinical_event.EVENT_TYPE = 'Treatment' - GROUP BY patient.CANCER_STUDY_ID - ) as treatment on cancer_study.CANCER_STUDY_ID = treatment.CANCER_STUDY_ID + INNER JOIN patient ON cancer_study.cancer_study_id = patient.cancer_study_id + LEFT JOIN clinical_event on clinical_event.patient_id = patient.internal_id + WHERE clinical_event.event_type = 'Treatment' + GROUP BY patient.cancer_study_id + ) as treatment on cancer_study.cancer_study_id = treatment.cancer_study_id LEFT JOIN ( - SELECT COUNT(DISTINCT(structural_variant.SAMPLE_ID)) as count, - patient.CANCER_STUDY_ID as CANCER_STUDY_ID + SELECT + COUNT(DISTINCT(structural_variant.sample_id)) as count, + patient.cancer_study_id as cancer_study_id FROM cancer_study - INNER JOIN patient on cancer_study.CANCER_STUDY_ID = patient.CANCER_STUDY_ID - LEFT JOIN sample on patient.INTERNAL_ID = sample.PATIENT_ID - INNER JOIN structural_variant on structural_variant.SAMPLE_ID = sample.INTERNAL_ID - GROUP BY patient.CANCER_STUDY_ID - ) as structural_variant on structural_variant.CANCER_STUDY_ID = cancer_study.CANCER_STUDY_ID + INNER JOIN patient ON cancer_study.cancer_study_id = patient.cancer_study_id + LEFT JOIN sample ON patient.internal_id = sample.patient_id + INNER JOIN structural_variant on structural_variant.sample_id = sample.internal_id + GROUP BY patient.cancer_study_id + ) as structural_variant on structural_variant.cancer_study_id = cancer_study.cancer_study_id - cancer_study.CANCER_STUDY_IDENTIFIER IN - - #{item} - + cancer_study.cancer_study_identifier IN + #{item} - cancer_study.NAME like CONCAT('%', #{item}, '%') OR - cancer_study.CANCER_STUDY_IDENTIFIER like CONCAT('%', #{item}, '%') OR - type_of_cancer.NAME like CONCAT('%', #{item}, '%') OR - type_of_cancer.TYPE_OF_CANCER_ID like CONCAT('%', #{item}, '%') + cancer_study.name like CONCAT('%', #{item}, '%') OR + cancer_study.cancer_study_identifier like CONCAT('%', #{item}, '%') OR + type_of_cancer.name like CONCAT('%', #{item}, '%') OR + type_of_cancer.type_of_cancer_id like CONCAT('%', #{item}, '%') @@ -102,23 +103,25 @@ , - COUNT(CASE WHEN sample_list.STABLE_ID = CONCAT(cancer_study.CANCER_STUDY_IDENTIFIER,'_all') THEN 1 ELSE NULL END) AS allSampleCount + + + 1 AS allSampleCount - GROUP BY cancer_study.CANCER_STUDY_ID + GROUP BY cancer_study.cancer_study_id ORDER BY "${sortBy}" ${direction} - ORDER BY cancer_study.CANCER_STUDY_IDENTIFIER ASC + ORDER BY cancer_study.cancer_study_identifier ASC - ORDER BY CASE WHEN cancer_study.NAME LIKE CONCAT(#{keyword}, '%') THEN 0 ELSE 1 END, - CASE WHEN cancer_study.NAME LIKE '%tcga%' THEN 0 ELSE 1 END, cancer_study.NAME + ORDER BY CASE WHEN cancer_study.name LIKE CONCAT(#{keyword}, '%') THEN 0 ELSE 1 END, + CASE WHEN cancer_study.name LIKE '%tcga%' THEN 0 ELSE 1 END, cancer_study.name LIMIT #{limit} OFFSET #{offset} @@ -130,7 +133,7 @@ COUNT(*) AS totalCount FROM cancer_study - INNER JOIN type_of_cancer ON cancer_study.TYPE_OF_CANCER_ID = type_of_cancer.TYPE_OF_CANCER_ID + INNER JOIN type_of_cancer ON cancer_study.type_of_cancer_id = type_of_cancer.type_of_cancer_id @@ -142,38 +145,39 @@ , - COUNT(CASE WHEN sample_list.STABLE_ID = CONCAT(cancer_study.CANCER_STUDY_IDENTIFIER,'_all') THEN 1 ELSE NULL END) AS allSampleCount + + + 1 AS allSampleCount - WHERE cancer_study.CANCER_STUDY_IDENTIFIER = #{studyId} - GROUP BY cancer_study.CANCER_STUDY_ID + WHERE cancer_study.cancer_study_identifier = #{studyId} + + GROUP BY cancer_study.cancer_study_id, sample_list.list_id - + diff --git a/src/main/resources/org/cbioportal/persistence/mybatis/TreatmentMapper.xml b/src/main/resources/org/cbioportal/persistence/mybatis/TreatmentMapper.xml index 58c93613077..9658b092119 100644 --- a/src/main/resources/org/cbioportal/persistence/mybatis/TreatmentMapper.xml +++ b/src/main/resources/org/cbioportal/persistence/mybatis/TreatmentMapper.xml @@ -5,48 +5,48 @@ @@ -55,13 +55,13 @@ * FROM clinical_event - INNER JOIN clinical_event_data ON clinical_event.CLINICAL_EVENT_ID = clinical_event_data.CLINICAL_EVENT_ID - INNER JOIN patient ON clinical_event.PATIENT_ID = patient.INTERNAL_ID - INNER JOIN sample ON patient.INTERNAL_ID = sample.PATIENT_ID - INNER JOIN cancer_study ON patient.CANCER_STUDY_ID = cancer_study.CANCER_STUDY_ID + INNER JOIN clinical_event_data ON clinical_event.clinical_event_id = clinical_event_data.clinical_event_id + INNER JOIN patient ON clinical_event.patient_id = patient.internal_id + INNER JOIN sample ON patient.internal_id = sample.patient_id + INNER JOIN cancer_study ON patient.cancer_study_id = cancer_study.cancer_study_id - AND clinical_event.EVENT_TYPE = 'TREATMENT' - AND clinical_event_data.KEY = #{key} LIMIT 1 + AND clinical_event.event_type = 'TREATMENT' + AND clinical_event_data.key = #{key} LIMIT 1 ) @@ -70,47 +70,35 @@ * FROM clinical_event - INNER JOIN clinical_event_data ON clinical_event.CLINICAL_EVENT_ID = clinical_event_data.CLINICAL_EVENT_ID - INNER JOIN patient ON clinical_event.PATIENT_ID = patient.INTERNAL_ID - INNER JOIN sample ON clinical_event_data.VALUE = sample.STABLE_ID - INNER JOIN cancer_study ON patient.CANCER_STUDY_ID = cancer_study.CANCER_STUDY_ID + INNER JOIN clinical_event_data ON clinical_event.clinical_event_id = clinical_event_data.clinical_event_id + INNER JOIN patient ON clinical_event.patient_id = patient.internal_id + INNER JOIN sample ON clinical_event_data.value = sample.stable_id + INNER JOIN cancer_study ON patient.cancer_study_id = cancer_study.cancer_study_id - AND clinical_event_data.KEY = 'SAMPLE_ID' - AND (clinical_event.EVENT_TYPE LIKE 'Sample Acquisition' OR clinical_event.EVENT_TYPE LIKE 'SPECIMEN') LIMIT 1) + AND clinical_event_data.key = 'SAMPLE_ID' + AND (clinical_event.event_type LIKE 'Sample Acquisition' OR clinical_event.event_type LIKE 'SPECIMEN') LIMIT 1) - cancer_study.CANCER_STUDY_IDENTIFIER IN - - (NULL) - - - - #{item} - - + cancer_study.cancer_study_identifier IN + (NULL) + #{item} - cancer_study.CANCER_STUDY_IDENTIFIER = #{studyIds[0]} AND - sample.STABLE_ID IN - - #{item} - + cancer_study.cancer_study_identifier = #{studyIds[0]} AND + sample.stable_id IN + #{item} - cancer_study.CANCER_STUDY_IDENTIFIER IN - - #{item} - - AND (cancer_study.CANCER_STUDY_IDENTIFIER, sample.STABLE_ID) IN - - (#{studyIds[${i}]}, #{sampleIds[${i}]}) - + cancer_study.cancer_study_identifier IN + #{item} + AND (cancer_study.cancer_study_identifier,sample.stable_id) IN + (#{studyIds[${i}]},#{sampleIds[${i}]}) - \ No newline at end of file + diff --git a/src/main/resources/org/cbioportal/persistence/mybatis/VariantCountMapper.xml b/src/main/resources/org/cbioportal/persistence/mybatis/VariantCountMapper.xml index 92dcfc2788b..8540c51c86f 100644 --- a/src/main/resources/org/cbioportal/persistence/mybatis/VariantCountMapper.xml +++ b/src/main/resources/org/cbioportal/persistence/mybatis/VariantCountMapper.xml @@ -5,25 +5,25 @@