22<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
33
44<mapper namespace =" org.cbioportal.infrastructure.repository.clickhouse.mutation.ClickhouseMutationDataMapper" >
5-
5+
6+ <!-- <sql id="select">-->
7+ <!-- genomic_event_derived.genetic_profile_stable_id AS "molecularProfileId",-->
8+ <!-- genomic_event_derived.sample_unique_id AS "sampleId",-->
9+ <!-- genomic_event_derived.patient_unique_id AS "patientId",-->
10+ <!-- genomic_event_derived.entrez_gene_id AS "entrezGeneId",-->
11+ <!-- genomic_event_derived.cancer_study_identifier AS "studyId"-->
12+ <!-- <if test="projection == 'SUMMARY' || projection == 'DETAILED'">-->
13+ <!-- ,-->
14+ <!-- mutation.CENTER AS "center",-->
15+ <!-- genomic_event_derived.mutation_status AS "mutationStatus",-->
16+ <!-- mutation.VALIDATION_STATUS AS "validationStatus",-->
17+ <!-- mutation.TUMOR_ALT_COUNT AS "tumorAltCount",-->
18+ <!-- mutation.TUMOR_REF_COUNT AS "tumorRefCount",-->
19+ <!-- mutation.NORMAL_ALT_COUNT AS "normalAltCount",-->
20+ <!-- mutation.NORMAL_REF_COUNT AS "normalRefCount",-->
21+ <!-- mutation.AMINO_ACID_CHANGE AS "aminoAcidChange",-->
22+ <!-- mutation_event.CHR AS "chr",-->
23+ <!-- mutation_event.START_POSITION AS "startPosition",-->
24+ <!-- mutation_event.END_POSITION AS "endPosition",-->
25+ <!-- mutation_event.REFERENCE_ALLELE AS "referenceAllele",-->
26+ <!-- mutation_event.TUMOR_SEQ_ALLELE AS "tumorSeqAllele",-->
27+ <!-- mutation_event.PROTEIN_CHANGE AS "proteinChange",-->
28+ <!-- genomic_event_derived.mutation_type AS "mutationType",-->
29+ <!-- mutation_event.NCBI_BUILD AS "ncbiBuild",-->
30+ <!-- genomic_event_derived.mutation_variant AS "variantType",-->
31+ <!-- mutation_event.REFSEQ_MRNA_ID AS "refseqMrnaId",-->
32+ <!-- mutation_event.PROTEIN_POS_START AS "proteinPosStart",-->
33+ <!-- mutation_event.PROTEIN_POS_END AS "proteinPosEnd",-->
34+ <!-- mutation_event.KEYWORD AS "keyword",-->
35+ <!-- mutation.ANNOTATION_JSON AS "annotationJSON",-->
36+ <!-- genomic_event_derived.driver_filter AS "driverFilter",-->
37+ <!-- alteration_driver_annotation.DRIVER_FILTER_ANNOTATION AS "driverFilterAnnotation",-->
38+ <!-- genomic_event_derived.driver_tiers_filter AS "driverTiersFilter",-->
39+ <!-- alteration_driver_annotation.DRIVER_TIERS_FILTER_ANNOTATION as "driverTiersFilterAnnotation"-->
40+ <!-- -->
41+ <!-- </if>-->
42+ <!-- <if test="projection == 'DETAILED'">-->
43+ <!-- ,-->
44+ <!-- <include refid="org.cbioportal.legacy.persistence.mybatis.GeneMapper.select">-->
45+ <!-- <property name="prefix" value="gene."/>-->
46+ <!-- </include>-->
47+ <!-- ,-->
48+ <!-- <include refid="getAlleleSpecificCopyNumber">-->
49+ <!-- <property name="prefix" value="alleleSpecificCopyNumber."/>-->
50+ <!-- </include>-->
51+ <!-- </if>-->
52+ <!-- </sql>-->
53+
54+ <sql id =" projectionAndLimitFilter" >
55+ <if test =" sortBy != null and projection != 'ID'" >
56+ ORDER BY "${sortBy}" ${direction}
57+ </if >
58+ <if test =" projection == 'ID'" >
59+ ORDER BY genomic_event_derived.genetic_profile_stable_id ASC,
60+ genomic_event_derived.sample_unique_id ASC,
61+ genomic_event_derived.entrez_gene_id ASC
62+ </if >
63+ <if test =" limit != null and limit != 0" >
64+ LIMIT #{limit} OFFSET #{offset}
65+ </if >
66+ </sql >
67+
68+ <sql id =" derivedTableWhereFilter" >
69+ <where >
70+ <if test =" molecularProfileIds != null and !molecularProfileIds.isEmpty()" >
71+ genetic_profile_stable_id IN
72+ <foreach item =" item" collection =" molecularProfileIds" open =" (" separator =" ," close =" )" >
73+ #{item}
74+ </foreach >
75+ </if >
76+
77+ <if test =" sampleIds != null and !sampleIds.isEmpty()" >
78+ AND sample_unique_id IN
79+ <foreach item =" item" collection =" sampleIds" open =" (" separator =" ," close =" )" >
80+ #{item}
81+ </foreach >
82+ </if >
83+
84+ <if test =" entrezGeneIds != null and !entrezGeneIds.isEmpty()" >
85+ AND entrez_gene_id IN
86+ <foreach item =" item" collection =" entrezGeneIds" open =" (" separator =" ," close =" )" >
87+ #{item}
88+ </foreach >
89+ </if >
90+ </where >
91+ </sql >
92+
93+
94+
95+
96+ <select id =" getMetaMutationsInMultipleMolecularProfiles"
97+ resultType =" org.cbioportal.legacy.model.meta.MutationMeta" >
98+ SELECT
99+ COUNT(*) AS "totalCount",
100+ COUNT(DISTINCT sample_unique_id) AS "sampleCount"
101+ FROM genomic_event_derived
102+ <include refid =" derivedTableWhereFilter" />
103+ </select >
104+
6105</mapper >
0 commit comments