From e9f3ccca6fb4e88a9d5caff9a6c442fa169e609e Mon Sep 17 00:00:00 2001 From: Susanna Kiwala Date: Tue, 29 Oct 2024 15:29:33 -0500 Subject: [PATCH 1/5] Change top level genes/fusions/factors resolver to add configurable status filter --- .../molecular-profiles-menu.component.ts | 8 +- .../molecular-profiles-menu.gql | 2 +- client/src/app/generated/civic.apollo.ts | 33 ++-- client/src/app/generated/server.model.graphql | 65 ++++---- client/src/app/generated/server.schema.json | 142 +++++++++--------- .../graphql/resolvers/top_level_factors.rb | 25 ++- .../graphql/resolvers/top_level_fusions.rb | 28 ++-- .../app/graphql/resolvers/top_level_genes.rb | 20 ++- .../resolvers/top_level_molecular_profiles.rb | 2 +- ...associated_evidence_status_filter_type.rb} | 2 +- 10 files changed, 186 insertions(+), 141 deletions(-) rename server/app/graphql/types/{molecular_profile_display_filter_type.rb => associated_evidence_status_filter_type.rb} (89%) diff --git a/client/src/app/components/molecular-profiles/molecular-profiles-menu/molecular-profiles-menu.component.ts b/client/src/app/components/molecular-profiles/molecular-profiles-menu/molecular-profiles-menu.component.ts index 6517b5ac2..33276afdf 100644 --- a/client/src/app/components/molecular-profiles/molecular-profiles-menu/molecular-profiles-menu.component.ts +++ b/client/src/app/components/molecular-profiles/molecular-profiles-menu/molecular-profiles-menu.component.ts @@ -7,7 +7,7 @@ import { MolecularProfileConnection, MolecularProfileMenuQueryVariables, MolecularProfileMenuGQL, - MolecularProfileDisplayFilter, + AssociatedEvidenceStatusFilter, } from '@app/generated/civic.apollo' import { map, debounceTime, filter, startWith } from 'rxjs/operators' import { Observable, Subject } from 'rxjs' @@ -32,8 +32,8 @@ export class CvcMolecularProfilesMenuComponent implements OnInit { loading$?: Observable; mpNameFilter: Maybe - statusFilter: MolecularProfileDisplayFilter = - MolecularProfileDisplayFilter.All + statusFilter: AssociatedEvidenceStatusFilter = + AssociatedEvidenceStatusFilter.All private debouncedQuery = new Subject() private result$!: Observable> @@ -91,7 +91,7 @@ export class CvcMolecularProfilesMenuComponent implements OnInit { this.debouncedQuery.next() } - onMolecularProfileStatusFilterChanged(filter: MolecularProfileDisplayFilter) { + onMolecularProfileStatusFilterChanged(filter: AssociatedEvidenceStatusFilter) { this.queryRef$.refetch({ first: this.pageSize, evidenceStatusFilter: filter diff --git a/client/src/app/components/molecular-profiles/molecular-profiles-menu/molecular-profiles-menu.gql b/client/src/app/components/molecular-profiles/molecular-profiles-menu/molecular-profiles-menu.gql index 9d4075285..4722120af 100644 --- a/client/src/app/components/molecular-profiles/molecular-profiles-menu/molecular-profiles-menu.gql +++ b/client/src/app/components/molecular-profiles/molecular-profiles-menu/molecular-profiles-menu.gql @@ -6,7 +6,7 @@ query MolecularProfileMenu( $last: Int $before: String $after: String - $evidenceStatusFilter: MolecularProfileDisplayFilter + $evidenceStatusFilter: AssociatedEvidenceStatusFilter ) { molecularProfiles( geneId: $geneId diff --git a/client/src/app/generated/civic.apollo.ts b/client/src/app/generated/civic.apollo.ts index 3db9875b9..36647c994 100644 --- a/client/src/app/generated/civic.apollo.ts +++ b/client/src/app/generated/civic.apollo.ts @@ -488,6 +488,17 @@ export enum AssertionType { Prognostic = 'PROGNOSTIC' } +export enum AssociatedEvidenceStatusFilter { + /** Display all molecular profiles regardless of attached evidence status. */ + All = 'ALL', + /** Display only molecular profiles which have at least one accepted evidence item. */ + WithAccepted = 'WITH_ACCEPTED', + /** Display only molecular profiles which have evidence in either an accepted or submitted state. */ + WithAcceptedOrSubmitted = 'WITH_ACCEPTED_OR_SUBMITTED', + /** Display molecular profiles which have at least one submitted evidence item. */ + WithSubmitted = 'WITH_SUBMITTED' +} + export enum BooleanOperator { And = 'AND', Or = 'OR' @@ -3963,17 +3974,6 @@ export enum MolecularProfileDeprecationReasonMutationInput { Other = 'OTHER' } -export enum MolecularProfileDisplayFilter { - /** Display all molecular profiles regardless of attached evidence status. */ - All = 'ALL', - /** Display only molecular profiles which have at least one accepted evidence item. */ - WithAccepted = 'WITH_ACCEPTED', - /** Display only molecular profiles which have evidence in either an accepted or submitted state. */ - WithAcceptedOrSubmitted = 'WITH_ACCEPTED_OR_SUBMITTED', - /** Display molecular profiles which have at least one submitted evidence item. */ - WithSubmitted = 'WITH_SUBMITTED' -} - /** An edge in a connection. */ export type MolecularProfileEdge = { __typename: 'MolecularProfileEdge'; @@ -5277,6 +5277,7 @@ export type QueryFactorArgs = { export type QueryFactorsArgs = { after?: InputMaybe; before?: InputMaybe; + evidenceStatusFilter?: InputMaybe; first?: InputMaybe; last?: InputMaybe; name?: InputMaybe>; @@ -5321,8 +5322,7 @@ export type QueryFusionArgs = { export type QueryFusionsArgs = { after?: InputMaybe; before?: InputMaybe; - entrezIds?: InputMaybe>; - entrezSymbols?: InputMaybe>; + evidenceStatusFilter?: InputMaybe; first?: InputMaybe; genePartnerId?: InputMaybe; last?: InputMaybe; @@ -5340,6 +5340,7 @@ export type QueryGenesArgs = { before?: InputMaybe; entrezIds?: InputMaybe>; entrezSymbols?: InputMaybe>; + evidenceStatusFilter?: InputMaybe; first?: InputMaybe; last?: InputMaybe; }; @@ -5354,7 +5355,7 @@ export type QueryMolecularProfilesArgs = { after?: InputMaybe; alleleRegistryId?: InputMaybe; before?: InputMaybe; - evidenceStatusFilter?: InputMaybe; + evidenceStatusFilter?: InputMaybe; featureId?: InputMaybe; first?: InputMaybe; geneId?: InputMaybe; @@ -8270,7 +8271,7 @@ export type MolecularProfileMenuQueryVariables = Exact<{ last?: InputMaybe; before?: InputMaybe; after?: InputMaybe; - evidenceStatusFilter?: InputMaybe; + evidenceStatusFilter?: InputMaybe; }>; @@ -14394,7 +14395,7 @@ export const BrowseMolecularProfilesDocument = gql` } } export const MolecularProfileMenuDocument = gql` - query MolecularProfileMenu($geneId: Int, $featureId: Int, $mpName: String, $first: Int, $last: Int, $before: String, $after: String, $evidenceStatusFilter: MolecularProfileDisplayFilter) { + query MolecularProfileMenu($geneId: Int, $featureId: Int, $mpName: String, $first: Int, $last: Int, $before: String, $after: String, $evidenceStatusFilter: AssociatedEvidenceStatusFilter) { molecularProfiles( geneId: $geneId featureId: $featureId diff --git a/client/src/app/generated/server.model.graphql b/client/src/app/generated/server.model.graphql index 5f6103bf0..936452fd5 100644 --- a/client/src/app/generated/server.model.graphql +++ b/client/src/app/generated/server.model.graphql @@ -794,6 +794,28 @@ enum AssertionType { PROGNOSTIC } +enum AssociatedEvidenceStatusFilter { + """ + Display all molecular profiles regardless of attached evidence status. + """ + ALL + + """ + Display only molecular profiles which have at least one accepted evidence item. + """ + WITH_ACCEPTED + + """ + Display only molecular profiles which have evidence in either an accepted or submitted state. + """ + WITH_ACCEPTED_OR_SUBMITTED + + """ + Display molecular profiles which have at least one submitted evidence item. + """ + WITH_SUBMITTED +} + enum BooleanOperator { AND OR @@ -6976,28 +6998,6 @@ enum MolecularProfileDeprecationReasonMutationInput { OTHER } -enum MolecularProfileDisplayFilter { - """ - Display all molecular profiles regardless of attached evidence status. - """ - ALL - - """ - Display only molecular profiles which have at least one accepted evidence item. - """ - WITH_ACCEPTED - - """ - Display only molecular profiles which have evidence in either an accepted or submitted state. - """ - WITH_ACCEPTED_OR_SUBMITTED - - """ - Display molecular profiles which have at least one submitted evidence item. - """ - WITH_SUBMITTED -} - """ An edge in a connection. """ @@ -8944,6 +8944,11 @@ type Query { """ before: String + """ + Limit genes by the status of attached evidence. + """ + evidenceStatusFilter: AssociatedEvidenceStatusFilter + """ Returns the first _n_ elements from the list. """ @@ -9046,14 +9051,9 @@ type Query { before: String """ - List of Entrez Gene IDs to return results for + Limit genes by the status of attached evidence. """ - entrezIds: [Int!] - - """ - List of Entrez Gene symbols to return results for - """ - entrezSymbols: [String!] + evidenceStatusFilter: AssociatedEvidenceStatusFilter """ Returns the first _n_ elements from the list. @@ -9100,6 +9100,11 @@ type Query { """ entrezSymbols: [String!] + """ + Limit genes by the status of attached evidence. + """ + evidenceStatusFilter: AssociatedEvidenceStatusFilter + """ Returns the first _n_ elements from the list. """ @@ -9138,7 +9143,7 @@ type Query { """ Limit molecular profiles by the status of attached evidence. """ - evidenceStatusFilter: MolecularProfileDisplayFilter + evidenceStatusFilter: AssociatedEvidenceStatusFilter """ Filter molecular profiles to the CIViC ID of the feature(s) involved. diff --git a/client/src/app/generated/server.schema.json b/client/src/app/generated/server.schema.json index 7b899f155..89b47ce82 100644 --- a/client/src/app/generated/server.schema.json +++ b/client/src/app/generated/server.schema.json @@ -3594,6 +3594,41 @@ ], "possibleTypes": null }, + { + "kind": "ENUM", + "name": "AssociatedEvidenceStatusFilter", + "description": null, + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "WITH_ACCEPTED", + "description": "Display only molecular profiles which have at least one accepted evidence item.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "WITH_ACCEPTED_OR_SUBMITTED", + "description": "Display only molecular profiles which have evidence in either an accepted or submitted state.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "WITH_SUBMITTED", + "description": "Display molecular profiles which have at least one submitted evidence item.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ALL", + "description": "Display all molecular profiles regardless of attached evidence status.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, { "kind": "SCALAR", "name": "Boolean", @@ -32541,41 +32576,6 @@ ], "possibleTypes": null }, - { - "kind": "ENUM", - "name": "MolecularProfileDisplayFilter", - "description": null, - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "WITH_ACCEPTED", - "description": "Display only molecular profiles which have at least one accepted evidence item.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "WITH_ACCEPTED_OR_SUBMITTED", - "description": "Display only molecular profiles which have evidence in either an accepted or submitted state.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "WITH_SUBMITTED", - "description": "Display molecular profiles which have at least one submitted evidence item.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "ALL", - "description": "Display all molecular profiles regardless of attached evidence status.", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, { "kind": "OBJECT", "name": "MolecularProfileEdge", @@ -41062,6 +41062,18 @@ "name": "factors", "description": "List and filter factors.", "args": [ + { + "name": "evidenceStatusFilter", + "description": "Limit genes by the status of attached evidence.", + "type": { + "kind": "ENUM", + "name": "AssociatedEvidenceStatusFilter", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "ncitIt", "description": "List of NCIt Codes to return Factors for", @@ -41425,11 +41437,11 @@ "description": "List and filter fusions.", "args": [ { - "name": "genePartnerId", - "description": "CIViC ID of one of the Gene partners", + "name": "evidenceStatusFilter", + "description": "Limit genes by the status of attached evidence.", "type": { - "kind": "SCALAR", - "name": "Int", + "kind": "ENUM", + "name": "AssociatedEvidenceStatusFilter", "ofType": null }, "defaultValue": null, @@ -41437,40 +41449,12 @@ "deprecationReason": null }, { - "name": "entrezSymbols", - "description": "List of Entrez Gene symbols to return results for", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - } - }, - "defaultValue": null, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "entrezIds", - "description": "List of Entrez Gene IDs to return results for", + "name": "genePartnerId", + "description": "CIViC ID of one of the Gene partners", "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - } + "kind": "SCALAR", + "name": "Int", + "ofType": null }, "defaultValue": null, "isDeprecated": false, @@ -41578,6 +41562,18 @@ "name": "genes", "description": "List and filter genes.", "args": [ + { + "name": "evidenceStatusFilter", + "description": "Limit genes by the status of attached evidence.", + "type": { + "kind": "ENUM", + "name": "AssociatedEvidenceStatusFilter", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "entrezSymbols", "description": "List of Entrez Gene symbols to return results for", @@ -41717,7 +41713,7 @@ "description": "Limit molecular profiles by the status of attached evidence.", "type": { "kind": "ENUM", - "name": "MolecularProfileDisplayFilter", + "name": "AssociatedEvidenceStatusFilter", "ofType": null }, "defaultValue": null, diff --git a/server/app/graphql/resolvers/top_level_factors.rb b/server/app/graphql/resolvers/top_level_factors.rb index 670156507..6a2e037d5 100644 --- a/server/app/graphql/resolvers/top_level_factors.rb +++ b/server/app/graphql/resolvers/top_level_factors.rb @@ -8,10 +8,27 @@ class Resolvers::TopLevelFactors < GraphQL::Schema::Resolver description 'List and filter factors.' scope do - Features::Factor - .eager_load(:feature) - .joins(feature: {variants: [molecular_profiles: [:evidence_items]]}) - .order('features.name ASC').where("evidence_items.status != 'rejected'").distinct + Features::Factor.joins(feature: { variants: [:molecular_profiles]}) + .where("variants.deprecated = 'f'") + .order('features.name ASC') + .select("factors.*, features.name") + .distinct + end + + option(:evidence_status_filter, default_value: 'WITH_ACCEPTED_OR_SUBMITTED', type: Types::AssociatedEvidenceStatusFilterType , description: 'Limit genes by the status of attached evidence.') do |scope, value| + case value + when 'WITH_ACCEPTED' + scope.joins(:evidence_items_by_status) + .where('evidence_items_by_statuses.accepted_count >= 1') + when 'WITH_ACCEPTED_OR_SUBMITTED' + scope.joins(:evidence_items_by_status) + .where('evidence_items_by_statuses.accepted_count >= 1 OR evidence_items_by_statuses.submitted_count >= 1') + when 'WITH_SUBMITTED' + scope.joins(:evidence_items_by_status) + .where('evidence_items_by_statuses.submitted_count >= 1') + when 'ALL' + scope + end end option(:ncit_it, type: [GraphQL::Types::String], description: 'List of NCIt Codes to return Factors for') do |scope, value| diff --git a/server/app/graphql/resolvers/top_level_fusions.rb b/server/app/graphql/resolvers/top_level_fusions.rb index 407a745a3..fa7a20d2b 100644 --- a/server/app/graphql/resolvers/top_level_fusions.rb +++ b/server/app/graphql/resolvers/top_level_fusions.rb @@ -10,20 +10,30 @@ class Resolvers::TopLevelFusions < GraphQL::Schema::Resolver @@cols = Features::Fusion.column_names.map { |col| "fusions.#{col}" }.join(",") scope do - Features::Fusion.joins(feature: { variants: [:molecular_profiles ]}) + Features::Fusion.joins(feature: { variants: [:molecular_profiles]}) .where("variants.deprecated = 'f'") + .order('features.name ASC') + .select("fusions.*, features.name") .distinct end - option(:gene_partner_id, type: Int, description: 'CIViC ID of one of the Gene partners') do |scope, value| - scope.where('fusions.five_prime_gene_id = ? OR fusions.three_prime_gene_id = ?', value, value) - end - - option(:entrez_symbols, type: [GraphQL::Types::String], description: 'List of Entrez Gene symbols to return results for') do |scope, value| - scope.where('genes.name IN (?)', value.map(&:upcase)) + option(:evidence_status_filter, default_value: 'WITH_ACCEPTED_OR_SUBMITTED', type: Types::AssociatedEvidenceStatusFilterType , description: 'Limit genes by the status of attached evidence.') do |scope, value| + case value + when 'WITH_ACCEPTED' + scope.joins(:evidence_items_by_status) + .where('evidence_items_by_statuses.accepted_count >= 1') + when 'WITH_ACCEPTED_OR_SUBMITTED' + scope.joins(:evidence_items_by_status) + .where('evidence_items_by_statuses.accepted_count >= 1 OR evidence_items_by_statuses.submitted_count >= 1') + when 'WITH_SUBMITTED' + scope.joins(:evidence_items_by_status) + .where('evidence_items_by_statuses.submitted_count >= 1') + when 'ALL' + scope + end end - option(:entrez_ids, type: [GraphQL::Types::Int], description: 'List of Entrez Gene IDs to return results for') do |scope, value| - scope.where('genes.entrez_id IN (?)', value) + option(:gene_partner_id, type: Int, description: 'CIViC ID of one of the Gene partners') do |scope, value| + scope.where('fusions.five_prime_gene_id = ? OR fusions.three_prime_gene_id = ?', value, value) end end diff --git a/server/app/graphql/resolvers/top_level_genes.rb b/server/app/graphql/resolvers/top_level_genes.rb index 6a202b4bf..b61865784 100644 --- a/server/app/graphql/resolvers/top_level_genes.rb +++ b/server/app/graphql/resolvers/top_level_genes.rb @@ -8,13 +8,29 @@ class Resolvers::TopLevelGenes < GraphQL::Schema::Resolver description 'List and filter genes.' scope do - Features::Gene.joins(feature: { variants: [molecular_profiles: [:evidence_items]]}) + Features::Gene.joins(feature: { variants: [:molecular_profiles]}) + .where("variants.deprecated = 'f'") .order('features.name ASC') - .where("evidence_items.status != 'rejected'") .select("genes.*, features.name") .distinct end + option(:evidence_status_filter, default_value: 'WITH_ACCEPTED_OR_SUBMITTED', type: Types::AssociatedEvidenceStatusFilterType , description: 'Limit genes by the status of attached evidence.') do |scope, value| + case value + when 'WITH_ACCEPTED' + scope.joins(:evidence_items_by_status) + .where('evidence_items_by_statuses.accepted_count >= 1') + when 'WITH_ACCEPTED_OR_SUBMITTED' + scope.joins(:evidence_items_by_status) + .where('evidence_items_by_statuses.accepted_count >= 1 OR evidence_items_by_statuses.submitted_count >= 1') + when 'WITH_SUBMITTED' + scope.joins(:evidence_items_by_status) + .where('evidence_items_by_statuses.submitted_count >= 1') + when 'ALL' + scope + end + end + option(:entrez_symbols, type: [GraphQL::Types::String], description: 'List of Entrez Gene symbols to return results for') do |scope, value| scope.where('features.name IN (?)', value.map(&:upcase)) end diff --git a/server/app/graphql/resolvers/top_level_molecular_profiles.rb b/server/app/graphql/resolvers/top_level_molecular_profiles.rb index 315e064c3..6fbab8f30 100644 --- a/server/app/graphql/resolvers/top_level_molecular_profiles.rb +++ b/server/app/graphql/resolvers/top_level_molecular_profiles.rb @@ -9,7 +9,7 @@ class Resolvers::TopLevelMolecularProfiles < GraphQL::Schema::Resolver scope { MolecularProfile.where(deprecated: false).order('molecular_profiles.evidence_score DESC').distinct } - option(:evidence_status_filter, default_value: 'WITH_ACCEPTED_OR_SUBMITTED', type: Types::MolecularProfileDisplayFilterType , description: 'Limit molecular profiles by the status of attached evidence.') do |scope, value| + option(:evidence_status_filter, default_value: 'WITH_ACCEPTED_OR_SUBMITTED', type: Types::AssociatedEvidenceStatusFilterType , description: 'Limit molecular profiles by the status of attached evidence.') do |scope, value| case value when 'WITH_ACCEPTED' scope.joins(:evidence_items_by_status) diff --git a/server/app/graphql/types/molecular_profile_display_filter_type.rb b/server/app/graphql/types/associated_evidence_status_filter_type.rb similarity index 89% rename from server/app/graphql/types/molecular_profile_display_filter_type.rb rename to server/app/graphql/types/associated_evidence_status_filter_type.rb index 1fde9f7fd..cb949da44 100644 --- a/server/app/graphql/types/molecular_profile_display_filter_type.rb +++ b/server/app/graphql/types/associated_evidence_status_filter_type.rb @@ -1,5 +1,5 @@ module Types - class MolecularProfileDisplayFilterType < Types::BaseEnum + class AssociatedEvidenceStatusFilterType < Types::BaseEnum value 'WITH_ACCEPTED', description: 'Display only molecular profiles which have at least one accepted evidence item.' value 'WITH_ACCEPTED_OR_SUBMITTED', From 0c618b79ace37311d345b69cd2865ba4261c00af Mon Sep 17 00:00:00 2001 From: Susanna Kiwala Date: Tue, 29 Oct 2024 16:28:31 -0500 Subject: [PATCH 2/5] Update associated_evidence_status_filter_type.rb enum descriptions --- .../types/associated_evidence_status_filter_type.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/app/graphql/types/associated_evidence_status_filter_type.rb b/server/app/graphql/types/associated_evidence_status_filter_type.rb index cb949da44..c3261ba48 100644 --- a/server/app/graphql/types/associated_evidence_status_filter_type.rb +++ b/server/app/graphql/types/associated_evidence_status_filter_type.rb @@ -1,12 +1,12 @@ module Types class AssociatedEvidenceStatusFilterType < Types::BaseEnum value 'WITH_ACCEPTED', - description: 'Display only molecular profiles which have at least one accepted evidence item.' + description: 'Apply filter to an entity to display only those which have at least one accepted associated evidence item.' value 'WITH_ACCEPTED_OR_SUBMITTED', - description: 'Display only molecular profiles which have evidence in either an accepted or submitted state.' + description: 'Apply filter to an entity to display only those which have at least one accepted or submitted associated evidence item.' value 'WITH_SUBMITTED', - description: 'Display molecular profiles which have at least one submitted evidence item.' + description: 'Apply filter to an entity to display only those which have at least one submitted associated evidence item.' value 'ALL', - description: 'Display all molecular profiles regardless of attached evidence status.' + description: 'Apply no status filter to an entity in order to display all entities regardless of attached evidence status.' end end From deee4b704edcd842854113ca354b74bd58e5d76c Mon Sep 17 00:00:00 2001 From: Susanna Kiwala Date: Tue, 29 Oct 2024 16:29:14 -0500 Subject: [PATCH 3/5] Fix filter descriptions --- server/app/graphql/resolvers/top_level_factors.rb | 2 +- server/app/graphql/resolvers/top_level_fusions.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server/app/graphql/resolvers/top_level_factors.rb b/server/app/graphql/resolvers/top_level_factors.rb index 6a2e037d5..20612abe2 100644 --- a/server/app/graphql/resolvers/top_level_factors.rb +++ b/server/app/graphql/resolvers/top_level_factors.rb @@ -15,7 +15,7 @@ class Resolvers::TopLevelFactors < GraphQL::Schema::Resolver .distinct end - option(:evidence_status_filter, default_value: 'WITH_ACCEPTED_OR_SUBMITTED', type: Types::AssociatedEvidenceStatusFilterType , description: 'Limit genes by the status of attached evidence.') do |scope, value| + option(:evidence_status_filter, default_value: 'WITH_ACCEPTED_OR_SUBMITTED', type: Types::AssociatedEvidenceStatusFilterType , description: 'Limit factors by the status of attached evidence.') do |scope, value| case value when 'WITH_ACCEPTED' scope.joins(:evidence_items_by_status) diff --git a/server/app/graphql/resolvers/top_level_fusions.rb b/server/app/graphql/resolvers/top_level_fusions.rb index fa7a20d2b..c669b9533 100644 --- a/server/app/graphql/resolvers/top_level_fusions.rb +++ b/server/app/graphql/resolvers/top_level_fusions.rb @@ -17,7 +17,7 @@ class Resolvers::TopLevelFusions < GraphQL::Schema::Resolver .distinct end - option(:evidence_status_filter, default_value: 'WITH_ACCEPTED_OR_SUBMITTED', type: Types::AssociatedEvidenceStatusFilterType , description: 'Limit genes by the status of attached evidence.') do |scope, value| + option(:evidence_status_filter, default_value: 'WITH_ACCEPTED_OR_SUBMITTED', type: Types::AssociatedEvidenceStatusFilterType , description: 'Limit fusions by the status of attached evidence.') do |scope, value| case value when 'WITH_ACCEPTED' scope.joins(:evidence_items_by_status) From f43ca85ef746f6e6318e9440f0d4dba1266dd4c3 Mon Sep 17 00:00:00 2001 From: Susanna Kiwala Date: Tue, 29 Oct 2024 16:38:50 -0500 Subject: [PATCH 4/5] Fix scoping --- server/app/graphql/resolvers/top_level_factors.rb | 6 +++--- server/app/graphql/resolvers/top_level_fusions.rb | 6 +++--- server/app/graphql/resolvers/top_level_genes.rb | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/server/app/graphql/resolvers/top_level_factors.rb b/server/app/graphql/resolvers/top_level_factors.rb index 20612abe2..e5fc53636 100644 --- a/server/app/graphql/resolvers/top_level_factors.rb +++ b/server/app/graphql/resolvers/top_level_factors.rb @@ -18,13 +18,13 @@ class Resolvers::TopLevelFactors < GraphQL::Schema::Resolver option(:evidence_status_filter, default_value: 'WITH_ACCEPTED_OR_SUBMITTED', type: Types::AssociatedEvidenceStatusFilterType , description: 'Limit factors by the status of attached evidence.') do |scope, value| case value when 'WITH_ACCEPTED' - scope.joins(:evidence_items_by_status) + scope.joins(feature: { variants: { molecular_profiles: [:evidence_items_by_status] } }) .where('evidence_items_by_statuses.accepted_count >= 1') when 'WITH_ACCEPTED_OR_SUBMITTED' - scope.joins(:evidence_items_by_status) + scope.joins(feature: { variants: { molecular_profiles: [:evidence_items_by_status] } }) .where('evidence_items_by_statuses.accepted_count >= 1 OR evidence_items_by_statuses.submitted_count >= 1') when 'WITH_SUBMITTED' - scope.joins(:evidence_items_by_status) + scope.joins(feature: { variants: { molecular_profiles: [:evidence_items_by_status] } }) .where('evidence_items_by_statuses.submitted_count >= 1') when 'ALL' scope diff --git a/server/app/graphql/resolvers/top_level_fusions.rb b/server/app/graphql/resolvers/top_level_fusions.rb index c669b9533..f6fce847e 100644 --- a/server/app/graphql/resolvers/top_level_fusions.rb +++ b/server/app/graphql/resolvers/top_level_fusions.rb @@ -20,13 +20,13 @@ class Resolvers::TopLevelFusions < GraphQL::Schema::Resolver option(:evidence_status_filter, default_value: 'WITH_ACCEPTED_OR_SUBMITTED', type: Types::AssociatedEvidenceStatusFilterType , description: 'Limit fusions by the status of attached evidence.') do |scope, value| case value when 'WITH_ACCEPTED' - scope.joins(:evidence_items_by_status) + scope.joins(feature: { variants: { molecular_profiles: [:evidence_items_by_status] } }) .where('evidence_items_by_statuses.accepted_count >= 1') when 'WITH_ACCEPTED_OR_SUBMITTED' - scope.joins(:evidence_items_by_status) + scope.joins(feature: { variants: { molecular_profiles: [:evidence_items_by_status] } }) .where('evidence_items_by_statuses.accepted_count >= 1 OR evidence_items_by_statuses.submitted_count >= 1') when 'WITH_SUBMITTED' - scope.joins(:evidence_items_by_status) + scope.joins(feature: { variants: { molecular_profiles: [:evidence_items_by_status] } }) .where('evidence_items_by_statuses.submitted_count >= 1') when 'ALL' scope diff --git a/server/app/graphql/resolvers/top_level_genes.rb b/server/app/graphql/resolvers/top_level_genes.rb index b61865784..38ba9ffc1 100644 --- a/server/app/graphql/resolvers/top_level_genes.rb +++ b/server/app/graphql/resolvers/top_level_genes.rb @@ -18,13 +18,13 @@ class Resolvers::TopLevelGenes < GraphQL::Schema::Resolver option(:evidence_status_filter, default_value: 'WITH_ACCEPTED_OR_SUBMITTED', type: Types::AssociatedEvidenceStatusFilterType , description: 'Limit genes by the status of attached evidence.') do |scope, value| case value when 'WITH_ACCEPTED' - scope.joins(:evidence_items_by_status) + scope.joins(feature: { variants: { molecular_profiles: [:evidence_items_by_status] } }) .where('evidence_items_by_statuses.accepted_count >= 1') when 'WITH_ACCEPTED_OR_SUBMITTED' - scope.joins(:evidence_items_by_status) + scope.joins(feature: { variants: { molecular_profiles: [:evidence_items_by_status] } }) .where('evidence_items_by_statuses.accepted_count >= 1 OR evidence_items_by_statuses.submitted_count >= 1') when 'WITH_SUBMITTED' - scope.joins(:evidence_items_by_status) + scope.joins(feature: { variants: { molecular_profiles: [:evidence_items_by_status] } }) .where('evidence_items_by_statuses.submitted_count >= 1') when 'ALL' scope From 7286038dcb2556c34d3b06250765b8ea3c2870d7 Mon Sep 17 00:00:00 2001 From: Susanna Kiwala Date: Tue, 29 Oct 2024 16:40:54 -0500 Subject: [PATCH 5/5] Update schemas --- client/src/app/generated/civic.apollo.ts | 8 ++++---- client/src/app/generated/server.model.graphql | 12 ++++++------ client/src/app/generated/server.schema.json | 12 ++++++------ 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/client/src/app/generated/civic.apollo.ts b/client/src/app/generated/civic.apollo.ts index 7df933ae8..6ae116e61 100644 --- a/client/src/app/generated/civic.apollo.ts +++ b/client/src/app/generated/civic.apollo.ts @@ -491,13 +491,13 @@ export enum AssertionType { } export enum AssociatedEvidenceStatusFilter { - /** Display all molecular profiles regardless of attached evidence status. */ + /** Apply no status filter to an entity in order to display all entities regardless of attached evidence status. */ All = 'ALL', - /** Display only molecular profiles which have at least one accepted evidence item. */ + /** Apply filter to an entity to display only those which have at least one accepted associated evidence item. */ WithAccepted = 'WITH_ACCEPTED', - /** Display only molecular profiles which have evidence in either an accepted or submitted state. */ + /** Apply filter to an entity to display only those which have at least one accepted or submitted associated evidence item. */ WithAcceptedOrSubmitted = 'WITH_ACCEPTED_OR_SUBMITTED', - /** Display molecular profiles which have at least one submitted evidence item. */ + /** Apply filter to an entity to display only those which have at least one submitted associated evidence item. */ WithSubmitted = 'WITH_SUBMITTED' } diff --git a/client/src/app/generated/server.model.graphql b/client/src/app/generated/server.model.graphql index fa048baa6..46613e4e1 100644 --- a/client/src/app/generated/server.model.graphql +++ b/client/src/app/generated/server.model.graphql @@ -798,22 +798,22 @@ enum AssertionType { enum AssociatedEvidenceStatusFilter { """ - Display all molecular profiles regardless of attached evidence status. + Apply no status filter to an entity in order to display all entities regardless of attached evidence status. """ ALL """ - Display only molecular profiles which have at least one accepted evidence item. + Apply filter to an entity to display only those which have at least one accepted associated evidence item. """ WITH_ACCEPTED """ - Display only molecular profiles which have evidence in either an accepted or submitted state. + Apply filter to an entity to display only those which have at least one accepted or submitted associated evidence item. """ WITH_ACCEPTED_OR_SUBMITTED """ - Display molecular profiles which have at least one submitted evidence item. + Apply filter to an entity to display only those which have at least one submitted associated evidence item. """ WITH_SUBMITTED } @@ -8947,7 +8947,7 @@ type Query { before: String """ - Limit genes by the status of attached evidence. + Limit factors by the status of attached evidence. """ evidenceStatusFilter: AssociatedEvidenceStatusFilter @@ -9053,7 +9053,7 @@ type Query { before: String """ - Limit genes by the status of attached evidence. + Limit fusions by the status of attached evidence. """ evidenceStatusFilter: AssociatedEvidenceStatusFilter diff --git a/client/src/app/generated/server.schema.json b/client/src/app/generated/server.schema.json index f123f9322..c901fe208 100644 --- a/client/src/app/generated/server.schema.json +++ b/client/src/app/generated/server.schema.json @@ -3616,25 +3616,25 @@ "enumValues": [ { "name": "WITH_ACCEPTED", - "description": "Display only molecular profiles which have at least one accepted evidence item.", + "description": "Apply filter to an entity to display only those which have at least one accepted associated evidence item.", "isDeprecated": false, "deprecationReason": null }, { "name": "WITH_ACCEPTED_OR_SUBMITTED", - "description": "Display only molecular profiles which have evidence in either an accepted or submitted state.", + "description": "Apply filter to an entity to display only those which have at least one accepted or submitted associated evidence item.", "isDeprecated": false, "deprecationReason": null }, { "name": "WITH_SUBMITTED", - "description": "Display molecular profiles which have at least one submitted evidence item.", + "description": "Apply filter to an entity to display only those which have at least one submitted associated evidence item.", "isDeprecated": false, "deprecationReason": null }, { "name": "ALL", - "description": "Display all molecular profiles regardless of attached evidence status.", + "description": "Apply no status filter to an entity in order to display all entities regardless of attached evidence status.", "isDeprecated": false, "deprecationReason": null } @@ -41076,7 +41076,7 @@ "args": [ { "name": "evidenceStatusFilter", - "description": "Limit genes by the status of attached evidence.", + "description": "Limit factors by the status of attached evidence.", "type": { "kind": "ENUM", "name": "AssociatedEvidenceStatusFilter", @@ -41450,7 +41450,7 @@ "args": [ { "name": "evidenceStatusFilter", - "description": "Limit genes by the status of attached evidence.", + "description": "Limit fusions by the status of attached evidence.", "type": { "kind": "ENUM", "name": "AssociatedEvidenceStatusFilter",