From 3d67b26af3d2e2eb88d9966359df8d26d604aaf7 Mon Sep 17 00:00:00 2001 From: Adam Coffman Date: Wed, 17 Apr 2024 16:50:33 -0500 Subject: [PATCH 1/3] narrow variant types in resolvers when the feature type is known --- .../src/app/generated/civic.apollo-helpers.ts | 87 +- client/src/app/generated/civic.apollo.ts | 176 ++- client/src/app/generated/server.model.graphql | 359 ++++- client/src/app/generated/server.schema.json | 1239 ++++++++++++++--- .../app/graphql/resolvers/factor_variants.rb | 8 + server/app/graphql/resolvers/gene_variants.rb | 8 + .../app/graphql/resolvers/shared/variants.rb | 61 + .../graphql/resolvers/top_level_variants.rb | 62 +- server/app/graphql/resolvers/variants.rb | 15 +- .../app/graphql/types/entities/factor_type.rb | 1 + .../app/graphql/types/entities/gene_type.rb | 1 + 11 files changed, 1614 insertions(+), 403 deletions(-) create mode 100644 server/app/graphql/resolvers/factor_variants.rb create mode 100644 server/app/graphql/resolvers/gene_variants.rb create mode 100644 server/app/graphql/resolvers/shared/variants.rb diff --git a/client/src/app/generated/civic.apollo-helpers.ts b/client/src/app/generated/civic.apollo-helpers.ts index 691c749de..2fbc5b4ee 100644 --- a/client/src/app/generated/civic.apollo-helpers.ts +++ b/client/src/app/generated/civic.apollo-helpers.ts @@ -848,6 +848,19 @@ export type FactorFieldPolicy = { sources?: FieldPolicy | FieldReadFunction, variants?: FieldPolicy | FieldReadFunction }; +export type FactorConnectionKeySpecifier = ('edges' | 'nodes' | 'pageCount' | 'pageInfo' | 'totalCount' | FactorConnectionKeySpecifier)[]; +export type FactorConnectionFieldPolicy = { + edges?: FieldPolicy | FieldReadFunction, + nodes?: FieldPolicy | FieldReadFunction, + pageCount?: FieldPolicy | FieldReadFunction, + pageInfo?: FieldPolicy | FieldReadFunction, + totalCount?: FieldPolicy | FieldReadFunction +}; +export type FactorEdgeKeySpecifier = ('cursor' | 'node' | FactorEdgeKeySpecifier)[]; +export type FactorEdgeFieldPolicy = { + cursor?: FieldPolicy | FieldReadFunction, + node?: FieldPolicy | FieldReadFunction +}; export type FactorVariantKeySpecifier = ('comments' | 'creationActivity' | 'deprecated' | 'deprecationActivity' | 'deprecationReason' | 'events' | 'feature' | 'flagged' | 'flags' | 'id' | 'lastAcceptedRevisionEvent' | 'lastCommentEvent' | 'lastSubmittedRevisionEvent' | 'link' | 'molecularProfiles' | 'name' | 'ncitDetails' | 'ncitId' | 'revisions' | 'singleVariantMolecularProfile' | 'singleVariantMolecularProfileId' | 'variantAliases' | 'variantTypes' | FactorVariantKeySpecifier)[]; export type FactorVariantFieldPolicy = { comments?: FieldPolicy | FieldReadFunction, @@ -874,6 +887,19 @@ export type FactorVariantFieldPolicy = { variantAliases?: FieldPolicy | FieldReadFunction, variantTypes?: FieldPolicy | FieldReadFunction }; +export type FactorVariantConnectionKeySpecifier = ('edges' | 'nodes' | 'pageCount' | 'pageInfo' | 'totalCount' | FactorVariantConnectionKeySpecifier)[]; +export type FactorVariantConnectionFieldPolicy = { + edges?: FieldPolicy | FieldReadFunction, + nodes?: FieldPolicy | FieldReadFunction, + pageCount?: FieldPolicy | FieldReadFunction, + pageInfo?: FieldPolicy | FieldReadFunction, + totalCount?: FieldPolicy | FieldReadFunction +}; +export type FactorVariantEdgeKeySpecifier = ('cursor' | 'node' | FactorVariantEdgeKeySpecifier)[]; +export type FactorVariantEdgeFieldPolicy = { + cursor?: FieldPolicy | FieldReadFunction, + node?: FieldPolicy | FieldReadFunction +}; export type FdaCodeKeySpecifier = ('code' | 'description' | FdaCodeKeySpecifier)[]; export type FdaCodeFieldPolicy = { code?: FieldPolicy | FieldReadFunction, @@ -1046,6 +1072,19 @@ export type GeneVariantFieldPolicy = { variantBases?: FieldPolicy | FieldReadFunction, variantTypes?: FieldPolicy | FieldReadFunction }; +export type GeneVariantConnectionKeySpecifier = ('edges' | 'nodes' | 'pageCount' | 'pageInfo' | 'totalCount' | GeneVariantConnectionKeySpecifier)[]; +export type GeneVariantConnectionFieldPolicy = { + edges?: FieldPolicy | FieldReadFunction, + nodes?: FieldPolicy | FieldReadFunction, + pageCount?: FieldPolicy | FieldReadFunction, + pageInfo?: FieldPolicy | FieldReadFunction, + totalCount?: FieldPolicy | FieldReadFunction +}; +export type GeneVariantEdgeKeySpecifier = ('cursor' | 'node' | GeneVariantEdgeKeySpecifier)[]; +export type GeneVariantEdgeFieldPolicy = { + cursor?: FieldPolicy | FieldReadFunction, + node?: FieldPolicy | FieldReadFunction +}; export type LeaderboardOrganizationKeySpecifier = ('actionCount' | 'description' | 'eventCount' | 'events' | 'id' | 'memberCount' | 'members' | 'mostRecentActivityTimestamp' | 'name' | 'orgAndSuborgsStatsHash' | 'orgStatsHash' | 'profileImagePath' | 'rank' | 'ranks' | 'subGroups' | 'url' | LeaderboardOrganizationKeySpecifier)[]; export type LeaderboardOrganizationFieldPolicy = { actionCount?: FieldPolicy | FieldReadFunction, @@ -1536,7 +1575,7 @@ export type PhenotypePopoverFieldPolicy = { name?: FieldPolicy | FieldReadFunction, url?: FieldPolicy | FieldReadFunction }; -export type QueryKeySpecifier = ('acmgCode' | 'acmgCodesTypeahead' | 'activities' | 'activity' | 'assertion' | 'assertions' | 'browseDiseases' | 'browseFeatures' | 'browseMolecularProfiles' | 'browseSources' | 'browseVariantGroups' | 'browseVariants' | 'clingenCode' | 'clingenCodesTypeahead' | 'clinicalTrial' | 'clinicalTrials' | 'comment' | 'comments' | 'contributors' | 'countries' | 'dataReleases' | 'disease' | 'diseasePopover' | 'diseaseTypeahead' | 'entityTypeahead' | 'events' | 'evidenceItem' | 'evidenceItems' | 'feature' | 'featureTypeahead' | 'flag' | 'flags' | 'gene' | 'genes' | 'molecularProfile' | 'molecularProfiles' | 'nccnGuideline' | 'nccnGuidelinesTypeahead' | 'notifications' | 'organization' | 'organizationLeaderboards' | 'organizations' | 'phenotype' | 'phenotypePopover' | 'phenotypeTypeahead' | 'phenotypes' | 'previewCommentText' | 'previewMolecularProfileName' | 'remoteCitation' | 'revision' | 'revisions' | 'search' | 'searchByPermalink' | 'searchGenes' | 'source' | 'sourcePopover' | 'sourceSuggestionValues' | 'sourceSuggestions' | 'sourceTypeahead' | 'subscriptionForEntity' | 'therapies' | 'therapy' | 'therapyPopover' | 'therapyTypeahead' | 'timepointStats' | 'user' | 'userLeaderboards' | 'userTypeahead' | 'users' | 'validateRevisionsForAcceptance' | 'variant' | 'variantGroup' | 'variantGroups' | 'variantType' | 'variantTypePopover' | 'variantTypeTypeahead' | 'variantTypes' | 'variants' | 'variantsTypeahead' | 'viewer' | QueryKeySpecifier)[]; +export type QueryKeySpecifier = ('acmgCode' | 'acmgCodesTypeahead' | 'activities' | 'activity' | 'assertion' | 'assertions' | 'browseDiseases' | 'browseFeatures' | 'browseMolecularProfiles' | 'browseSources' | 'browseVariantGroups' | 'browseVariants' | 'clingenCode' | 'clingenCodesTypeahead' | 'clinicalTrial' | 'clinicalTrials' | 'comment' | 'comments' | 'contributors' | 'countries' | 'dataReleases' | 'disease' | 'diseasePopover' | 'diseaseTypeahead' | 'entityTypeahead' | 'events' | 'evidenceItem' | 'evidenceItems' | 'factors' | 'feature' | 'featureTypeahead' | 'flag' | 'flags' | 'gene' | 'genes' | 'molecularProfile' | 'molecularProfiles' | 'nccnGuideline' | 'nccnGuidelinesTypeahead' | 'notifications' | 'organization' | 'organizationLeaderboards' | 'organizations' | 'phenotype' | 'phenotypePopover' | 'phenotypeTypeahead' | 'phenotypes' | 'previewCommentText' | 'previewMolecularProfileName' | 'remoteCitation' | 'revision' | 'revisions' | 'search' | 'searchByPermalink' | 'searchGenes' | 'source' | 'sourcePopover' | 'sourceSuggestionValues' | 'sourceSuggestions' | 'sourceTypeahead' | 'subscriptionForEntity' | 'therapies' | 'therapy' | 'therapyPopover' | 'therapyTypeahead' | 'timepointStats' | 'user' | 'userLeaderboards' | 'userTypeahead' | 'users' | 'validateRevisionsForAcceptance' | 'variant' | 'variantGroup' | 'variantGroups' | 'variantType' | 'variantTypePopover' | 'variantTypeTypeahead' | 'variantTypes' | 'variants' | 'variantsTypeahead' | 'viewer' | QueryKeySpecifier)[]; export type QueryFieldPolicy = { acmgCode?: FieldPolicy | FieldReadFunction, acmgCodesTypeahead?: FieldPolicy | FieldReadFunction, @@ -1566,6 +1605,7 @@ export type QueryFieldPolicy = { events?: FieldPolicy | FieldReadFunction, evidenceItem?: FieldPolicy | FieldReadFunction, evidenceItems?: FieldPolicy | FieldReadFunction, + factors?: FieldPolicy | FieldReadFunction, feature?: FieldPolicy | FieldReadFunction, featureTypeahead?: FieldPolicy | FieldReadFunction, flag?: FieldPolicy | FieldReadFunction, @@ -2126,19 +2166,6 @@ export type VariantAliasKeySpecifier = ('name' | VariantAliasKeySpecifier)[]; export type VariantAliasFieldPolicy = { name?: FieldPolicy | FieldReadFunction }; -export type VariantConnectionKeySpecifier = ('edges' | 'nodes' | 'pageCount' | 'pageInfo' | 'totalCount' | VariantConnectionKeySpecifier)[]; -export type VariantConnectionFieldPolicy = { - edges?: FieldPolicy | FieldReadFunction, - nodes?: FieldPolicy | FieldReadFunction, - pageCount?: FieldPolicy | FieldReadFunction, - pageInfo?: FieldPolicy | FieldReadFunction, - totalCount?: FieldPolicy | FieldReadFunction -}; -export type VariantEdgeKeySpecifier = ('cursor' | 'node' | VariantEdgeKeySpecifier)[]; -export type VariantEdgeFieldPolicy = { - cursor?: FieldPolicy | FieldReadFunction, - node?: FieldPolicy | FieldReadFunction -}; export type VariantGroupKeySpecifier = ('comments' | 'description' | 'events' | 'flagged' | 'flags' | 'id' | 'lastAcceptedRevisionEvent' | 'lastCommentEvent' | 'lastSubmittedRevisionEvent' | 'link' | 'name' | 'revisions' | 'sources' | 'variants' | VariantGroupKeySpecifier)[]; export type VariantGroupFieldPolicy = { comments?: FieldPolicy | FieldReadFunction, @@ -2588,10 +2615,26 @@ export type StrictTypedTypePolicies = { keyFields?: false | FactorKeySpecifier | (() => undefined | FactorKeySpecifier), fields?: FactorFieldPolicy, }, + FactorConnection?: Omit & { + keyFields?: false | FactorConnectionKeySpecifier | (() => undefined | FactorConnectionKeySpecifier), + fields?: FactorConnectionFieldPolicy, + }, + FactorEdge?: Omit & { + keyFields?: false | FactorEdgeKeySpecifier | (() => undefined | FactorEdgeKeySpecifier), + fields?: FactorEdgeFieldPolicy, + }, FactorVariant?: Omit & { keyFields?: false | FactorVariantKeySpecifier | (() => undefined | FactorVariantKeySpecifier), fields?: FactorVariantFieldPolicy, }, + FactorVariantConnection?: Omit & { + keyFields?: false | FactorVariantConnectionKeySpecifier | (() => undefined | FactorVariantConnectionKeySpecifier), + fields?: FactorVariantConnectionFieldPolicy, + }, + FactorVariantEdge?: Omit & { + keyFields?: false | FactorVariantEdgeKeySpecifier | (() => undefined | FactorVariantEdgeKeySpecifier), + fields?: FactorVariantEdgeFieldPolicy, + }, FdaCode?: Omit & { keyFields?: false | FdaCodeKeySpecifier | (() => undefined | FdaCodeKeySpecifier), fields?: FdaCodeFieldPolicy, @@ -2648,6 +2691,14 @@ export type StrictTypedTypePolicies = { keyFields?: false | GeneVariantKeySpecifier | (() => undefined | GeneVariantKeySpecifier), fields?: GeneVariantFieldPolicy, }, + GeneVariantConnection?: Omit & { + keyFields?: false | GeneVariantConnectionKeySpecifier | (() => undefined | GeneVariantConnectionKeySpecifier), + fields?: GeneVariantConnectionFieldPolicy, + }, + GeneVariantEdge?: Omit & { + keyFields?: false | GeneVariantEdgeKeySpecifier | (() => undefined | GeneVariantEdgeKeySpecifier), + fields?: GeneVariantEdgeFieldPolicy, + }, LeaderboardOrganization?: Omit & { keyFields?: false | LeaderboardOrganizationKeySpecifier | (() => undefined | LeaderboardOrganizationKeySpecifier), fields?: LeaderboardOrganizationFieldPolicy, @@ -3052,14 +3103,6 @@ export type StrictTypedTypePolicies = { keyFields?: false | VariantAliasKeySpecifier | (() => undefined | VariantAliasKeySpecifier), fields?: VariantAliasFieldPolicy, }, - VariantConnection?: Omit & { - keyFields?: false | VariantConnectionKeySpecifier | (() => undefined | VariantConnectionKeySpecifier), - fields?: VariantConnectionFieldPolicy, - }, - VariantEdge?: Omit & { - keyFields?: false | VariantEdgeKeySpecifier | (() => undefined | VariantEdgeKeySpecifier), - fields?: VariantEdgeFieldPolicy, - }, VariantGroup?: Omit & { keyFields?: false | VariantGroupKeySpecifier | (() => undefined | VariantGroupKeySpecifier), fields?: VariantGroupFieldPolicy, diff --git a/client/src/app/generated/civic.apollo.ts b/client/src/app/generated/civic.apollo.ts index f756d3a1f..fddac1228 100644 --- a/client/src/app/generated/civic.apollo.ts +++ b/client/src/app/generated/civic.apollo.ts @@ -1951,8 +1951,8 @@ export type Factor = Commentable & EventOriginObject & EventSubject & Flaggable /** List and filter revisions. */ revisions: RevisionConnection; sources: Array; - /** List and filter variants. */ - variants: VariantConnection; + /** List and filter Gene variants. */ + variants: FactorVariantConnection; }; @@ -2013,10 +2013,42 @@ export type FactorRevisionsArgs = { /** The Feature that a Variant can belong to */ export type FactorVariantsArgs = { after?: InputMaybe; + alleleRegistryId?: InputMaybe; before?: InputMaybe; + category?: InputMaybe; + factorId?: InputMaybe; + featureId?: InputMaybe; first?: InputMaybe; + geneId?: InputMaybe; + hasNoVariantType?: InputMaybe; last?: InputMaybe; name?: InputMaybe; + sortBy?: InputMaybe; + variantTypeIds?: InputMaybe>; +}; + +/** The connection type for Factor. */ +export type FactorConnection = { + __typename: 'FactorConnection'; + /** A list of edges. */ + edges: Array; + /** A list of nodes. */ + nodes: Array; + /** Total number of pages, based on filtered count and pagesize. */ + pageCount: Scalars['Int']; + /** Information to aid in pagination. */ + pageInfo: PageInfo; + /** The total number of records in this filtered collection. */ + totalCount: Scalars['Int']; +}; + +/** An edge in a connection. */ +export type FactorEdge = { + __typename: 'FactorEdge'; + /** A cursor for use in pagination. */ + cursor: Scalars['String']; + /** The item at the end of the edge. */ + node?: Maybe; }; /** Fields on a Factor that curators may propose revisions to. */ @@ -2124,6 +2156,30 @@ export type FactorVariantRevisionsArgs = { status?: InputMaybe; }; +/** The connection type for FactorVariant. */ +export type FactorVariantConnection = { + __typename: 'FactorVariantConnection'; + /** A list of edges. */ + edges: Array; + /** A list of nodes. */ + nodes: Array; + /** Total number of pages, based on filtered count and pagesize. */ + pageCount: Scalars['Int']; + /** Information to aid in pagination. */ + pageInfo: PageInfo; + /** The total number of records in this filtered collection. */ + totalCount: Scalars['Int']; +}; + +/** An edge in a connection. */ +export type FactorVariantEdge = { + __typename: 'FactorVariantEdge'; + /** A cursor for use in pagination. */ + cursor: Scalars['String']; + /** The item at the end of the edge. */ + node?: Maybe; +}; + /** Fields on a FactorVariant that curators may propose revisions to. */ export type FactorVariantFields = { /** List of aliases or alternate names for the Variant. */ @@ -2171,8 +2227,8 @@ export type Feature = Commentable & EventOriginObject & EventSubject & Flaggable /** List and filter revisions. */ revisions: RevisionConnection; sources: Array; - /** List and filter variants. */ - variants: VariantConnection; + /** List and filter Gene variants. */ + variants: VariantInterfaceConnection; }; @@ -2233,10 +2289,18 @@ export type FeatureRevisionsArgs = { /** The Feature that a Variant can belong to */ export type FeatureVariantsArgs = { after?: InputMaybe; + alleleRegistryId?: InputMaybe; before?: InputMaybe; + category?: InputMaybe; + factorId?: InputMaybe; + featureId?: InputMaybe; first?: InputMaybe; + geneId?: InputMaybe; + hasNoVariantType?: InputMaybe; last?: InputMaybe; name?: InputMaybe; + sortBy?: InputMaybe; + variantTypeIds?: InputMaybe>; }; export enum FeatureDeprecationReason { @@ -2477,8 +2541,8 @@ export type Gene = Commentable & EventOriginObject & EventSubject & Flaggable & /** List and filter revisions. */ revisions: RevisionConnection; sources: Array; - /** List and filter variants. */ - variants: VariantConnection; + /** List and filter Gene variants. */ + variants: GeneVariantConnection; }; @@ -2539,10 +2603,18 @@ export type GeneRevisionsArgs = { /** The Feature that a Variant can belong to */ export type GeneVariantsArgs = { after?: InputMaybe; + alleleRegistryId?: InputMaybe; before?: InputMaybe; + category?: InputMaybe; + factorId?: InputMaybe; + featureId?: InputMaybe; first?: InputMaybe; + geneId?: InputMaybe; + hasNoVariantType?: InputMaybe; last?: InputMaybe; name?: InputMaybe; + sortBy?: InputMaybe; + variantTypeIds?: InputMaybe>; }; /** The connection type for Gene. */ @@ -2688,6 +2760,30 @@ export type GeneVariantRevisionsArgs = { status?: InputMaybe; }; +/** The connection type for GeneVariant. */ +export type GeneVariantConnection = { + __typename: 'GeneVariantConnection'; + /** A list of edges. */ + edges: Array; + /** A list of nodes. */ + nodes: Array; + /** Total number of pages, based on filtered count and pagesize. */ + pageCount: Scalars['Int']; + /** Information to aid in pagination. */ + pageInfo: PageInfo; + /** The total number of records in this filtered collection. */ + totalCount: Scalars['Int']; +}; + +/** An edge in a connection. */ +export type GeneVariantEdge = { + __typename: 'GeneVariantEdge'; + /** A cursor for use in pagination. */ + cursor: Scalars['String']; + /** The item at the end of the edge. */ + node?: Maybe; +}; + /** Fields on a GeneVariant that curators may propose revisions to. */ export type GeneVariantFields = { /** List of aliases or alternate names for the Variant. */ @@ -4056,6 +4152,8 @@ export type Query = { evidenceItem?: Maybe; /** List and filter evidence items. */ evidenceItems: EvidenceItemConnection; + /** List and filter factors. */ + factors: FactorConnection; /** Find a single feature by CIViC ID */ feature?: Maybe; /** Retrieve Features of a specific instance type for a search term. */ @@ -4427,6 +4525,16 @@ export type QueryEvidenceItemsArgs = { }; +export type QueryFactorsArgs = { + after?: InputMaybe; + before?: InputMaybe; + first?: InputMaybe; + last?: InputMaybe; + name?: InputMaybe>; + ncitIt?: InputMaybe>; +}; + + export type QueryFeatureArgs = { id?: InputMaybe; }; @@ -6290,21 +6398,6 @@ export type VariantComponent = { variantId: Scalars['Int']; }; -/** The connection type for Variant. */ -export type VariantConnection = { - __typename: 'VariantConnection'; - /** A list of edges. */ - edges: Array; - /** A list of nodes. */ - nodes: Array; - /** Total number of pages, based on filtered count and pagesize. */ - pageCount: Scalars['Int']; - /** Information to aid in pagination. */ - pageInfo: PageInfo; - /** The total number of records in this filtered collection. */ - totalCount: Scalars['Int']; -}; - export enum VariantDeprecationReason { Duplicate = 'DUPLICATE', FeatureDeprecated = 'FEATURE_DEPRECATED', @@ -6312,15 +6405,6 @@ export enum VariantDeprecationReason { Other = 'OTHER' } -/** An edge in a connection. */ -export type VariantEdge = { - __typename: 'VariantEdge'; - /** A cursor for use in pagination. */ - cursor: Scalars['String']; - /** The item at the end of the edge. */ - node?: Maybe; -}; - export type VariantGroup = Commentable & EventSubject & Flaggable & WithRevisions & { __typename: 'VariantGroup'; /** List and filter comments. */ @@ -6340,8 +6424,8 @@ export type VariantGroup = Commentable & EventSubject & Flaggable & WithRevision /** List and filter revisions. */ revisions: RevisionConnection; sources: Array; - /** List and filter variants. */ - variants: VariantConnection; + /** List and filter Gene variants. */ + variants: VariantInterfaceConnection; }; @@ -6397,10 +6481,18 @@ export type VariantGroupRevisionsArgs = { export type VariantGroupVariantsArgs = { after?: InputMaybe; + alleleRegistryId?: InputMaybe; before?: InputMaybe; + category?: InputMaybe; + factorId?: InputMaybe; + featureId?: InputMaybe; first?: InputMaybe; + geneId?: InputMaybe; + hasNoVariantType?: InputMaybe; last?: InputMaybe; name?: InputMaybe; + sortBy?: InputMaybe; + variantTypeIds?: InputMaybe>; }; /** The connection type for VariantGroup. */ @@ -6966,9 +7058,9 @@ export type FeaturePopoverQueryVariables = Exact<{ }>; -export type FeaturePopoverQuery = { __typename: 'Query', feature?: { __typename: 'Feature', id: number, name: string, fullName?: string | undefined, featureAliases: Array, featureInstance: { __typename: 'Factor' } | { __typename: 'Gene' }, variants: { __typename: 'VariantConnection', totalCount: number }, flags: { __typename: 'FlagConnection', totalCount: number } } | undefined }; +export type FeaturePopoverQuery = { __typename: 'Query', feature?: { __typename: 'Feature', id: number, name: string, fullName?: string | undefined, featureAliases: Array, featureInstance: { __typename: 'Factor' } | { __typename: 'Gene' }, variants: { __typename: 'VariantInterfaceConnection', totalCount: number }, flags: { __typename: 'FlagConnection', totalCount: number } } | undefined }; -export type FeaturePopoverFragment = { __typename: 'Feature', id: number, name: string, fullName?: string | undefined, featureAliases: Array, featureInstance: { __typename: 'Factor' } | { __typename: 'Gene' }, variants: { __typename: 'VariantConnection', totalCount: number }, flags: { __typename: 'FlagConnection', totalCount: number } }; +export type FeaturePopoverFragment = { __typename: 'Feature', id: number, name: string, fullName?: string | undefined, featureAliases: Array, featureInstance: { __typename: 'Factor' } | { __typename: 'Gene' }, variants: { __typename: 'VariantInterfaceConnection', totalCount: number }, flags: { __typename: 'FlagConnection', totalCount: number } }; export type BrowseFeaturesQueryVariables = Exact<{ featureName?: InputMaybe; @@ -7411,9 +7503,9 @@ export type VariantGroupPopoverQueryVariables = Exact<{ }>; -export type VariantGroupPopoverQuery = { __typename: 'Query', variantGroup?: { __typename: 'VariantGroup', id: number, name: string, description: string, variants: { __typename: 'VariantConnection', edges: Array<{ __typename: 'VariantEdge', node?: { __typename: 'Variant', id: number, name: string, link: string, deprecated: boolean, feature: { __typename: 'Feature', id: number, name: string, link: string } } | undefined }> }, sources: Array<{ __typename: 'Source', id: number, citation?: string | undefined, sourceType: SourceSource, link: string }> } | undefined }; +export type VariantGroupPopoverQuery = { __typename: 'Query', variantGroup?: { __typename: 'VariantGroup', id: number, name: string, description: string, variants: { __typename: 'VariantInterfaceConnection', edges: Array<{ __typename: 'VariantInterfaceEdge', node?: { __typename: 'FactorVariant', id: number, name: string, link: string, deprecated: boolean, feature: { __typename: 'Feature', id: number, name: string, link: string } } | { __typename: 'GeneVariant', id: number, name: string, link: string, deprecated: boolean, feature: { __typename: 'Feature', id: number, name: string, link: string } } | { __typename: 'Variant', id: number, name: string, link: string, deprecated: boolean, feature: { __typename: 'Feature', id: number, name: string, link: string } } | undefined }> }, sources: Array<{ __typename: 'Source', id: number, citation?: string | undefined, sourceType: SourceSource, link: string }> } | undefined }; -export type VariantGroupPopoverFieldsFragment = { __typename: 'VariantGroup', id: number, name: string, description: string, variants: { __typename: 'VariantConnection', edges: Array<{ __typename: 'VariantEdge', node?: { __typename: 'Variant', id: number, name: string, link: string, deprecated: boolean, feature: { __typename: 'Feature', id: number, name: string, link: string } } | undefined }> }, sources: Array<{ __typename: 'Source', id: number, citation?: string | undefined, sourceType: SourceSource, link: string }> }; +export type VariantGroupPopoverFieldsFragment = { __typename: 'VariantGroup', id: number, name: string, description: string, variants: { __typename: 'VariantInterfaceConnection', edges: Array<{ __typename: 'VariantInterfaceEdge', node?: { __typename: 'FactorVariant', id: number, name: string, link: string, deprecated: boolean, feature: { __typename: 'Feature', id: number, name: string, link: string } } | { __typename: 'GeneVariant', id: number, name: string, link: string, deprecated: boolean, feature: { __typename: 'Feature', id: number, name: string, link: string } } | { __typename: 'Variant', id: number, name: string, link: string, deprecated: boolean, feature: { __typename: 'Feature', id: number, name: string, link: string } } | undefined }> }, sources: Array<{ __typename: 'Source', id: number, citation?: string | undefined, sourceType: SourceSource, link: string }> }; export type BrowseVariantGroupsQueryVariables = Exact<{ first?: InputMaybe; @@ -7860,9 +7952,9 @@ export type VariantGroupRevisableFieldsQueryVariables = Exact<{ }>; -export type VariantGroupRevisableFieldsQuery = { __typename: 'Query', variantGroup?: { __typename: 'VariantGroup', id: number, name: string, description: string, variants: { __typename: 'VariantConnection', totalCount: number, edges: Array<{ __typename: 'VariantEdge', cursor: string, node?: { __typename: 'Variant', id: number, name: string, link: string } | undefined }>, nodes: Array<{ __typename: 'Variant', id: number, name: string, link: string }> }, sources: Array<{ __typename: 'Source', id: number, name: string, link: string }> } | undefined }; +export type VariantGroupRevisableFieldsQuery = { __typename: 'Query', variantGroup?: { __typename: 'VariantGroup', id: number, name: string, description: string, variants: { __typename: 'VariantInterfaceConnection', totalCount: number, edges: Array<{ __typename: 'VariantInterfaceEdge', cursor: string, node?: { __typename: 'FactorVariant', id: number, name: string, link: string } | { __typename: 'GeneVariant', id: number, name: string, link: string } | { __typename: 'Variant', id: number, name: string, link: string } | undefined }>, nodes: Array<{ __typename: 'FactorVariant', id: number, name: string, link: string } | { __typename: 'GeneVariant', id: number, name: string, link: string } | { __typename: 'Variant', id: number, name: string, link: string }> }, sources: Array<{ __typename: 'Source', id: number, name: string, link: string }> } | undefined }; -export type VariantGroupRevisableFieldsFragment = { __typename: 'VariantGroup', id: number, name: string, description: string, variants: { __typename: 'VariantConnection', totalCount: number, edges: Array<{ __typename: 'VariantEdge', cursor: string, node?: { __typename: 'Variant', id: number, name: string, link: string } | undefined }>, nodes: Array<{ __typename: 'Variant', id: number, name: string, link: string }> }, sources: Array<{ __typename: 'Source', id: number, name: string, link: string }> }; +export type VariantGroupRevisableFieldsFragment = { __typename: 'VariantGroup', id: number, name: string, description: string, variants: { __typename: 'VariantInterfaceConnection', totalCount: number, edges: Array<{ __typename: 'VariantInterfaceEdge', cursor: string, node?: { __typename: 'FactorVariant', id: number, name: string, link: string } | { __typename: 'GeneVariant', id: number, name: string, link: string } | { __typename: 'Variant', id: number, name: string, link: string } | undefined }>, nodes: Array<{ __typename: 'FactorVariant', id: number, name: string, link: string } | { __typename: 'GeneVariant', id: number, name: string, link: string } | { __typename: 'Variant', id: number, name: string, link: string }> }, sources: Array<{ __typename: 'Source', id: number, name: string, link: string }> }; export type SuggestVariantGroupRevisionMutationVariables = Exact<{ input: SuggestVariantGroupRevisionInput; @@ -7876,9 +7968,9 @@ export type VariantGroupSubmittableFieldsQueryVariables = Exact<{ }>; -export type VariantGroupSubmittableFieldsQuery = { __typename: 'Query', variantGroup?: { __typename: 'VariantGroup', id: number, name: string, description: string, variants: { __typename: 'VariantConnection', nodes: Array<{ __typename: 'Variant', id: number, name: string, link: string, singleVariantMolecularProfile: { __typename: 'MolecularProfile', id: number, name: string, link: string } }> }, sources: Array<{ __typename: 'Source', id: number, link: string, citation?: string | undefined, sourceType: SourceSource }> } | undefined }; +export type VariantGroupSubmittableFieldsQuery = { __typename: 'Query', variantGroup?: { __typename: 'VariantGroup', id: number, name: string, description: string, variants: { __typename: 'VariantInterfaceConnection', nodes: Array<{ __typename: 'FactorVariant', id: number, name: string, link: string, singleVariantMolecularProfile: { __typename: 'MolecularProfile', id: number, name: string, link: string } } | { __typename: 'GeneVariant', id: number, name: string, link: string, singleVariantMolecularProfile: { __typename: 'MolecularProfile', id: number, name: string, link: string } } | { __typename: 'Variant', id: number, name: string, link: string, singleVariantMolecularProfile: { __typename: 'MolecularProfile', id: number, name: string, link: string } }> }, sources: Array<{ __typename: 'Source', id: number, link: string, citation?: string | undefined, sourceType: SourceSource }> } | undefined }; -export type SubmittableVariantGroupFieldsFragment = { __typename: 'VariantGroup', id: number, name: string, description: string, variants: { __typename: 'VariantConnection', nodes: Array<{ __typename: 'Variant', id: number, name: string, link: string, singleVariantMolecularProfile: { __typename: 'MolecularProfile', id: number, name: string, link: string } }> }, sources: Array<{ __typename: 'Source', id: number, link: string, citation?: string | undefined, sourceType: SourceSource }> }; +export type SubmittableVariantGroupFieldsFragment = { __typename: 'VariantGroup', id: number, name: string, description: string, variants: { __typename: 'VariantInterfaceConnection', nodes: Array<{ __typename: 'FactorVariant', id: number, name: string, link: string, singleVariantMolecularProfile: { __typename: 'MolecularProfile', id: number, name: string, link: string } } | { __typename: 'GeneVariant', id: number, name: string, link: string, singleVariantMolecularProfile: { __typename: 'MolecularProfile', id: number, name: string, link: string } } | { __typename: 'Variant', id: number, name: string, link: string, singleVariantMolecularProfile: { __typename: 'MolecularProfile', id: number, name: string, link: string } }> }, sources: Array<{ __typename: 'Source', id: number, link: string, citation?: string | undefined, sourceType: SourceSource }> }; export type SubmitVariantGroupMutationVariables = Exact<{ input: SubmitVariantGroupInput; @@ -8516,9 +8608,9 @@ export type VariantGroupDetailQueryVariables = Exact<{ }>; -export type VariantGroupDetailQuery = { __typename: 'Query', variantGroup?: { __typename: 'VariantGroup', id: number, name: string, variants: { __typename: 'VariantConnection', totalCount: number }, flags: { __typename: 'FlagConnection', totalCount: number }, revisions: { __typename: 'RevisionConnection', totalCount: number }, comments: { __typename: 'CommentConnection', totalCount: number } } | undefined }; +export type VariantGroupDetailQuery = { __typename: 'Query', variantGroup?: { __typename: 'VariantGroup', id: number, name: string, variants: { __typename: 'VariantInterfaceConnection', totalCount: number }, flags: { __typename: 'FlagConnection', totalCount: number }, revisions: { __typename: 'RevisionConnection', totalCount: number }, comments: { __typename: 'CommentConnection', totalCount: number } } | undefined }; -export type VariantGroupDetailFieldsFragment = { __typename: 'VariantGroup', id: number, name: string, variants: { __typename: 'VariantConnection', totalCount: number }, flags: { __typename: 'FlagConnection', totalCount: number }, revisions: { __typename: 'RevisionConnection', totalCount: number }, comments: { __typename: 'CommentConnection', totalCount: number } }; +export type VariantGroupDetailFieldsFragment = { __typename: 'VariantGroup', id: number, name: string, variants: { __typename: 'VariantInterfaceConnection', totalCount: number }, flags: { __typename: 'FlagConnection', totalCount: number }, revisions: { __typename: 'RevisionConnection', totalCount: number }, comments: { __typename: 'CommentConnection', totalCount: number } }; export type VariantGroupsSummaryQueryVariables = Exact<{ variantGroupId: Scalars['Int']; diff --git a/client/src/app/generated/server.model.graphql b/client/src/app/generated/server.model.graphql index 3fd2a0b6b..8bcf48d22 100644 --- a/client/src/app/generated/server.model.graphql +++ b/client/src/app/generated/server.model.graphql @@ -3193,7 +3193,7 @@ type Factor implements Commentable & EventOriginObject & EventSubject & Flaggabl sources: [Source!]! """ - List and filter variants. + List and filter Gene variants. """ variants( """ @@ -3201,16 +3201,42 @@ type Factor implements Commentable & EventOriginObject & EventSubject & Flaggabl """ after: String + """ + Find a CIViC Variant based on its ClinGen Allele Registry ID + """ + alleleRegistryId: String + """ Returns the elements in the list that come before the specified cursor. """ before: String + category: VariantCategories + + """ + Feature that the variants are associated with, limited to only Factor type features. + """ + factorId: Int + + """ + Feature that the variants are associated with. + """ + featureId: Int """ Returns the first _n_ elements from the list. """ first: Int + """ + Feature that the variants are associated with, limited to only Gene type features. + """ + geneId: Int + + """ + Return Variants lacking an assigned VariantType + """ + hasNoVariantType: Boolean + """ Returns the last _n_ elements from the list. """ @@ -3220,7 +3246,58 @@ type Factor implements Commentable & EventOriginObject & EventSubject & Flaggabl Left anchored filtering for variant name and aliases. """ name: String - ): VariantConnection! + sortBy: VariantMenuSort + + """ + A list of CIViC identifiers for variant types + """ + variantTypeIds: [Int!] + ): FactorVariantConnection! +} + +""" +The connection type for Factor. +""" +type FactorConnection { + """ + A list of edges. + """ + edges: [FactorEdge!]! + + """ + A list of nodes. + """ + nodes: [Factor!]! + + """ + Total number of pages, based on filtered count and pagesize. + """ + pageCount: Int! + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + The total number of records in this filtered collection. + """ + totalCount: Int! +} + +""" +An edge in a connection. +""" +type FactorEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: Factor } """ @@ -3477,6 +3554,51 @@ type FactorVariant implements Commentable & EventOriginObject & EventSubject & F variantTypes: [VariantType!]! } +""" +The connection type for FactorVariant. +""" +type FactorVariantConnection { + """ + A list of edges. + """ + edges: [FactorVariantEdge!]! + + """ + A list of nodes. + """ + nodes: [FactorVariant!]! + + """ + Total number of pages, based on filtered count and pagesize. + """ + pageCount: Int! + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + The total number of records in this filtered collection. + """ + totalCount: Int! +} + +""" +An edge in a connection. +""" +type FactorVariantEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: FactorVariant +} + """ Fields on a FactorVariant that curators may propose revisions to. """ @@ -3711,7 +3833,7 @@ type Feature implements Commentable & EventOriginObject & EventSubject & Flaggab sources: [Source!]! """ - List and filter variants. + List and filter Gene variants. """ variants( """ @@ -3719,16 +3841,42 @@ type Feature implements Commentable & EventOriginObject & EventSubject & Flaggab """ after: String + """ + Find a CIViC Variant based on its ClinGen Allele Registry ID + """ + alleleRegistryId: String + """ Returns the elements in the list that come before the specified cursor. """ before: String + category: VariantCategories + + """ + Feature that the variants are associated with, limited to only Factor type features. + """ + factorId: Int + + """ + Feature that the variants are associated with. + """ + featureId: Int """ Returns the first _n_ elements from the list. """ first: Int + """ + Feature that the variants are associated with, limited to only Gene type features. + """ + geneId: Int + + """ + Return Variants lacking an assigned VariantType + """ + hasNoVariantType: Boolean + """ Returns the last _n_ elements from the list. """ @@ -3738,7 +3886,13 @@ type Feature implements Commentable & EventOriginObject & EventSubject & Flaggab Left anchored filtering for variant name and aliases. """ name: String - ): VariantConnection! + sortBy: VariantMenuSort + + """ + A list of CIViC identifiers for variant types + """ + variantTypeIds: [Int!] + ): VariantInterfaceConnection! } enum FeatureDeprecationReason { @@ -4298,7 +4452,7 @@ type Gene implements Commentable & EventOriginObject & EventSubject & Flaggable sources: [Source!]! """ - List and filter variants. + List and filter Gene variants. """ variants( """ @@ -4306,16 +4460,42 @@ type Gene implements Commentable & EventOriginObject & EventSubject & Flaggable """ after: String + """ + Find a CIViC Variant based on its ClinGen Allele Registry ID + """ + alleleRegistryId: String + """ Returns the elements in the list that come before the specified cursor. """ before: String + category: VariantCategories + + """ + Feature that the variants are associated with, limited to only Factor type features. + """ + factorId: Int + + """ + Feature that the variants are associated with. + """ + featureId: Int """ Returns the first _n_ elements from the list. """ first: Int + """ + Feature that the variants are associated with, limited to only Gene type features. + """ + geneId: Int + + """ + Return Variants lacking an assigned VariantType + """ + hasNoVariantType: Boolean + """ Returns the last _n_ elements from the list. """ @@ -4325,7 +4505,13 @@ type Gene implements Commentable & EventOriginObject & EventSubject & Flaggable Left anchored filtering for variant name and aliases. """ name: String - ): VariantConnection! + sortBy: VariantMenuSort + + """ + A list of CIViC identifiers for variant types + """ + variantTypeIds: [Int!] + ): GeneVariantConnection! } """ @@ -4630,6 +4816,51 @@ type GeneVariant implements Commentable & EventOriginObject & EventSubject & Fla variantTypes: [VariantType!]! } +""" +The connection type for GeneVariant. +""" +type GeneVariantConnection { + """ + A list of edges. + """ + edges: [GeneVariantEdge!]! + + """ + A list of nodes. + """ + nodes: [GeneVariant!]! + + """ + Total number of pages, based on filtered count and pagesize. + """ + pageCount: Int! + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + The total number of records in this filtered collection. + """ + totalCount: Int! +} + +""" +An edge in a connection. +""" +type GeneVariantEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: GeneVariant +} + """ Fields on a GeneVariant that curators may propose revisions to. """ @@ -7307,6 +7538,41 @@ type Query { variantOrigin: VariantOrigin ): EvidenceItemConnection! + """ + List and filter factors. + """ + factors( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + List of Factor names to return + """ + name: [String!] + + """ + List of NCIt Codes to return Factors for + """ + ncitIt: [String!] + ): FactorConnection! + """ Find a single feature by CIViC ID """ @@ -10435,36 +10701,6 @@ input VariantComponent { variantId: Int! } -""" -The connection type for Variant. -""" -type VariantConnection { - """ - A list of edges. - """ - edges: [VariantEdge!]! - - """ - A list of nodes. - """ - nodes: [Variant!]! - - """ - Total number of pages, based on filtered count and pagesize. - """ - pageCount: Int! - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - - """ - The total number of records in this filtered collection. - """ - totalCount: Int! -} - enum VariantDeprecationReason { DUPLICATE FEATURE_DEPRECATED @@ -10472,21 +10708,6 @@ enum VariantDeprecationReason { OTHER } -""" -An edge in a connection. -""" -type VariantEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: Variant -} - type VariantGroup implements Commentable & EventSubject & Flaggable & WithRevisions { """ List and filter comments. @@ -10676,7 +10897,7 @@ type VariantGroup implements Commentable & EventSubject & Flaggable & WithRevisi sources: [Source!]! """ - List and filter variants. + List and filter Gene variants. """ variants( """ @@ -10684,16 +10905,42 @@ type VariantGroup implements Commentable & EventSubject & Flaggable & WithRevisi """ after: String + """ + Find a CIViC Variant based on its ClinGen Allele Registry ID + """ + alleleRegistryId: String + """ Returns the elements in the list that come before the specified cursor. """ before: String + category: VariantCategories + + """ + Feature that the variants are associated with, limited to only Factor type features. + """ + factorId: Int + + """ + Feature that the variants are associated with. + """ + featureId: Int """ Returns the first _n_ elements from the list. """ first: Int + """ + Feature that the variants are associated with, limited to only Gene type features. + """ + geneId: Int + + """ + Return Variants lacking an assigned VariantType + """ + hasNoVariantType: Boolean + """ Returns the last _n_ elements from the list. """ @@ -10703,7 +10950,13 @@ type VariantGroup implements Commentable & EventSubject & Flaggable & WithRevisi Left anchored filtering for variant name and aliases. """ name: String - ): VariantConnection! + sortBy: VariantMenuSort + + """ + A list of CIViC identifiers for variant types + """ + variantTypeIds: [Int!] + ): VariantInterfaceConnection! } """ diff --git a/client/src/app/generated/server.schema.json b/client/src/app/generated/server.schema.json index 331c9c2a9..3627d3e04 100644 --- a/client/src/app/generated/server.schema.json +++ b/client/src/app/generated/server.schema.json @@ -15906,7 +15906,7 @@ }, { "name": "variants", - "description": "List and filter variants.", + "description": "List and filter Gene variants.", "args": [ { "name": "name", @@ -15920,6 +15920,110 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "featureId", + "description": "Feature that the variants are associated with.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "geneId", + "description": "Feature that the variants are associated with, limited to only Gene type features.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "factorId", + "description": "Feature that the variants are associated with, limited to only Factor type features.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "variantTypeIds", + "description": "A list of CIViC identifiers for variant types", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "alleleRegistryId", + "description": "Find a CIViC Variant based on its ClinGen Allele Registry ID", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "hasNoVariantType", + "description": "Return Variants lacking an assigned VariantType", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "sortBy", + "description": null, + "type": { + "kind": "INPUT_OBJECT", + "name": "VariantMenuSort", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "category", + "description": null, + "type": { + "kind": "ENUM", + "name": "VariantCategories", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "after", "description": "Returns the elements in the list that come after the specified cursor.", @@ -15974,7 +16078,7 @@ "name": null, "ofType": { "kind": "OBJECT", - "name": "VariantConnection", + "name": "FactorVariantConnection", "ofType": null } }, @@ -16018,6 +16122,152 @@ "enumValues": null, "possibleTypes": null }, + { + "kind": "OBJECT", + "name": "FactorConnection", + "description": "The connection type for Factor.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "FactorEdge", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Factor", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageCount", + "description": "Total number of pages, based on filtered count and pagesize.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "The total number of records in this filtered collection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "FactorEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Factor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, { "kind": "INPUT_OBJECT", "name": "FactorFields", @@ -16936,68 +17186,214 @@ "deprecationReason": null }, { - "name": "variantTypes", - "description": null, + "name": "variantTypes", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "VariantType", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Commentable", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "EventOriginObject", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "EventSubject", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Flaggable", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "MolecularProfileComponent", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "VariantInterface", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "WithRevisions", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "FactorVariantConnection", + "description": "The connection type for FactorVariant.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "FactorVariantEdge", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "FactorVariant", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageCount", + "description": "Total number of pages, based on filtered count and pagesize.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "The total number of records in this filtered collection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "FactorVariantEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", "args": [], "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "VariantType", - "ofType": null - } - } - } + "kind": "OBJECT", + "name": "FactorVariant", + "ofType": null }, "isDeprecated": false, "deprecationReason": null } ], "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Commentable", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "EventOriginObject", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "EventSubject", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "Flaggable", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "MolecularProfileComponent", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "VariantInterface", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "WithRevisions", - "ofType": null - } - ], + "interfaces": [], "enumValues": null, "possibleTypes": null }, @@ -17874,7 +18270,7 @@ }, { "name": "variants", - "description": "List and filter variants.", + "description": "List and filter Gene variants.", "args": [ { "name": "name", @@ -17888,6 +18284,110 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "featureId", + "description": "Feature that the variants are associated with.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "geneId", + "description": "Feature that the variants are associated with, limited to only Gene type features.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "factorId", + "description": "Feature that the variants are associated with, limited to only Factor type features.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "variantTypeIds", + "description": "A list of CIViC identifiers for variant types", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "alleleRegistryId", + "description": "Find a CIViC Variant based on its ClinGen Allele Registry ID", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "hasNoVariantType", + "description": "Return Variants lacking an assigned VariantType", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "sortBy", + "description": null, + "type": { + "kind": "INPUT_OBJECT", + "name": "VariantMenuSort", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "category", + "description": null, + "type": { + "kind": "ENUM", + "name": "VariantCategories", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "after", "description": "Returns the elements in the list that come after the specified cursor.", @@ -17942,7 +18442,7 @@ "name": null, "ofType": { "kind": "OBJECT", - "name": "VariantConnection", + "name": "VariantInterfaceConnection", "ofType": null } }, @@ -20298,14 +20798,118 @@ }, { "name": "variants", - "description": "List and filter variants.", + "description": "List and filter Gene variants.", "args": [ { - "name": "name", - "description": "Left anchored filtering for variant name and aliases.", + "name": "name", + "description": "Left anchored filtering for variant name and aliases.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "featureId", + "description": "Feature that the variants are associated with.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "geneId", + "description": "Feature that the variants are associated with, limited to only Gene type features.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "factorId", + "description": "Feature that the variants are associated with, limited to only Factor type features.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "variantTypeIds", + "description": "A list of CIViC identifiers for variant types", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "alleleRegistryId", + "description": "Find a CIViC Variant based on its ClinGen Allele Registry ID", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "hasNoVariantType", + "description": "Return Variants lacking an assigned VariantType", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "sortBy", + "description": null, "type": { - "kind": "SCALAR", - "name": "String", + "kind": "INPUT_OBJECT", + "name": "VariantMenuSort", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "category", + "description": null, + "type": { + "kind": "ENUM", + "name": "VariantCategories", "ofType": null }, "defaultValue": null, @@ -20366,7 +20970,7 @@ "name": null, "ofType": { "kind": "OBJECT", - "name": "VariantConnection", + "name": "GeneVariantConnection", "ofType": null } }, @@ -21738,6 +22342,152 @@ "enumValues": null, "possibleTypes": null }, + { + "kind": "OBJECT", + "name": "GeneVariantConnection", + "description": "The connection type for GeneVariant.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "GeneVariantEdge", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "GeneVariant", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageCount", + "description": "Total number of pages, based on filtered count and pagesize.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "The total number of records in this filtered collection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "GeneVariantEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "GeneVariant", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, { "kind": "INPUT_OBJECT", "name": "GeneVariantFields", @@ -33872,7 +34622,112 @@ "name": null, "ofType": { "kind": "OBJECT", - "name": "EvidenceItemConnection", + "name": "EvidenceItemConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "factors", + "description": "List and filter factors.", + "args": [ + { + "name": "ncitIt", + "description": "List of NCIt Codes to return Factors 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": "name", + "description": "List of Factor names to return", + "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": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "FactorConnection", "ofType": null } }, @@ -47321,113 +48176,6 @@ "enumValues": null, "possibleTypes": null }, - { - "kind": "OBJECT", - "name": "VariantConnection", - "description": "The connection type for Variant.", - "fields": [ - { - "name": "edges", - "description": "A list of edges.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "VariantEdge", - "ofType": null - } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nodes", - "description": "A list of nodes.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Variant", - "ofType": null - } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageCount", - "description": "Total number of pages, based on filtered count and pagesize.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageInfo", - "description": "Information to aid in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PageInfo", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "totalCount", - "description": "The total number of records in this filtered collection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, { "kind": "ENUM", "name": "VariantDeprecationReason", @@ -47463,45 +48211,6 @@ ], "possibleTypes": null }, - { - "kind": "OBJECT", - "name": "VariantEdge", - "description": "An edge in a connection.", - "fields": [ - { - "name": "cursor", - "description": "A cursor for use in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "node", - "description": "The item at the end of the edge.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "Variant", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, { "kind": "OBJECT", "name": "VariantGroup", @@ -48125,7 +48834,7 @@ }, { "name": "variants", - "description": "List and filter variants.", + "description": "List and filter Gene variants.", "args": [ { "name": "name", @@ -48139,6 +48848,110 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "featureId", + "description": "Feature that the variants are associated with.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "geneId", + "description": "Feature that the variants are associated with, limited to only Gene type features.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "factorId", + "description": "Feature that the variants are associated with, limited to only Factor type features.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "variantTypeIds", + "description": "A list of CIViC identifiers for variant types", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "alleleRegistryId", + "description": "Find a CIViC Variant based on its ClinGen Allele Registry ID", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "hasNoVariantType", + "description": "Return Variants lacking an assigned VariantType", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "sortBy", + "description": null, + "type": { + "kind": "INPUT_OBJECT", + "name": "VariantMenuSort", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "category", + "description": null, + "type": { + "kind": "ENUM", + "name": "VariantCategories", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "after", "description": "Returns the elements in the list that come after the specified cursor.", @@ -48193,7 +49006,7 @@ "name": null, "ofType": { "kind": "OBJECT", - "name": "VariantConnection", + "name": "VariantInterfaceConnection", "ofType": null } }, diff --git a/server/app/graphql/resolvers/factor_variants.rb b/server/app/graphql/resolvers/factor_variants.rb new file mode 100644 index 000000000..b8605ed47 --- /dev/null +++ b/server/app/graphql/resolvers/factor_variants.rb @@ -0,0 +1,8 @@ +class Resolvers::FactorVariants < Resolvers::Shared::Variants + + type Types::Variants::FactorVariantType.connection_type, null: false + + description 'List and filter Gene variants.' + + scope { object.variants.where(deprecated: false).order('variants.name ASC').distinct } +end diff --git a/server/app/graphql/resolvers/gene_variants.rb b/server/app/graphql/resolvers/gene_variants.rb new file mode 100644 index 000000000..c03473457 --- /dev/null +++ b/server/app/graphql/resolvers/gene_variants.rb @@ -0,0 +1,8 @@ +class Resolvers::GeneVariants < Resolvers::Shared::Variants + + type Types::Variants::GeneVariantType.connection_type, null: false + + description 'List and filter Gene variants.' + + scope { object.variants.where(deprecated: false).order('variants.name ASC').distinct } +end diff --git a/server/app/graphql/resolvers/shared/variants.rb b/server/app/graphql/resolvers/shared/variants.rb new file mode 100644 index 000000000..155497b7e --- /dev/null +++ b/server/app/graphql/resolvers/shared/variants.rb @@ -0,0 +1,61 @@ +require 'search_object/plugin/graphql' + +class Resolvers::Shared::Variants < GraphQL::Schema::Resolver + include SearchObject.module(:graphql) + + option(:name, type: GraphQL::Types::String, description: 'Left anchored filtering for variant name and aliases.') do |scope, value| + scope.left_joins(:variant_aliases) + .where('variants.name ILIKE :query OR variant_aliases.name ILIKE :query', { query: "%#{value}%" }) + end + + option(:feature_id, type: GraphQL::Types::Int, description: 'Feature that the variants are associated with.') do |scope, value| + scope.where(feature_id: value) + end + + option(:gene_id, type: GraphQL::Types::Int, description: 'Feature that the variants are associated with, limited to only Gene type features.') do |scope, value| + scope.joins(:feature).where(feature_id: value, feature: { feature_instance_type: 'Features::Gene' }) + end + + option(:factor_id, type: GraphQL::Types::Int, description: 'Feature that the variants are associated with, limited to only Factor type features.') do |scope, value| + scope.joins(:feature).where(feature_id: value, feature: { feature_instance_type: 'Features::Factor' }) + end + + option(:variant_type_ids, type: [GraphQL::Types::Int], description: 'A list of CIViC identifiers for variant types') do |scope, value| + if value.size > 0 + scope.joins(:variant_types).where(variant_types: { id: value }) + else + scope + end + end + + option(:allele_registry_id, type: GraphQL::Types::String, description: 'Find a CIViC Variant based on its ClinGen Allele Registry ID') do |scope, value| + scope.where(allele_registry_id: value) + end + + option(:has_no_variant_type, type: GraphQL::Types::Boolean, description: "Return Variants lacking an assigned VariantType") do |scope, value| + if(value) + scope.left_joins(:variant_types).where(variant_types: { id: nil }) + else + scope + end + end + + option :sort_by, type: Types::VariantMenuSortType do |scope, value| + case value.column + when 'NAME' + scope.reorder("variants.name #{value.direction}") + when 'COORDINATE_START' + scope.reorder("variants.start #{value.direction} NULLS LAST") + when 'COORDINATE_END' + scope.reorder("variants.stop #{value.direction} NULLS LAST") + end + end + + option(:category, type: Types::VariantCategories) do |scope, value| + if value + scope.where(category: value) + else + scope + end + end +end diff --git a/server/app/graphql/resolvers/top_level_variants.rb b/server/app/graphql/resolvers/top_level_variants.rb index 97e9004c9..3131ee61a 100644 --- a/server/app/graphql/resolvers/top_level_variants.rb +++ b/server/app/graphql/resolvers/top_level_variants.rb @@ -1,67 +1,7 @@ -require 'search_object/plugin/graphql' - -class Resolvers::TopLevelVariants < GraphQL::Schema::Resolver - include SearchObject.module(:graphql) - +class Resolvers::TopLevelVariants < Resolvers::Shared::Variants type Types::Interfaces::VariantInterface.connection_type, null: false description 'List and filter variants.' scope { Variant.where(deprecated: false).order('variants.name ASC').distinct } - - option(:name, type: GraphQL::Types::String, description: 'Left anchored filtering for variant name and aliases.') do |scope, value| - scope.left_joins(:variant_aliases) - .where('variants.name ILIKE :query OR variant_aliases.name ILIKE :query', { query: "%#{value}%" }) - end - - option(:feature_id, type: GraphQL::Types::Int, description: 'Feature that the variants are associated with.') do |scope, value| - scope.where(feature_id: value) - end - - option(:gene_id, type: GraphQL::Types::Int, description: 'Feature that the variants are associated with, limited to only Gene type features.') do |scope, value| - scope.joins(:feature).where(feature_id: value, feature: { feature_instance_type: 'Features::Gene' }) - end - - option(:factor_id, type: GraphQL::Types::Int, description: 'Feature that the variants are associated with, limited to only Factor type features.') do |scope, value| - scope.joins(:feature).where(feature_id: value, feature: { feature_instance_type: 'Features::Factor' }) - end - - option(:variant_type_ids, type: [GraphQL::Types::Int], description: 'A list of CIViC identifiers for variant types') do |scope, value| - if value.size > 0 - scope.joins(:variant_types).where(variant_types: { id: value }) - else - scope - end - end - - option(:allele_registry_id, type: GraphQL::Types::String, description: 'Find a CIViC Variant based on its ClinGen Allele Registry ID') do |scope, value| - scope.where(allele_registry_id: value) - end - - option(:has_no_variant_type, type: GraphQL::Types::Boolean, description: "Return Variants lacking an assigned VariantType") do |scope, value| - if(value) - scope.left_joins(:variant_types).where(variant_types: { id: nil }) - else - scope - end - end - - option :sort_by, type: Types::VariantMenuSortType do |scope, value| - case value.column - when 'NAME' - scope.reorder("variants.name #{value.direction}") - when 'COORDINATE_START' - scope.reorder("variants.start #{value.direction} NULLS LAST") - when 'COORDINATE_END' - scope.reorder("variants.stop #{value.direction} NULLS LAST") - end - end - - option(:category, type: Types::VariantCategories) do |scope, value| - if value - scope.where(category: value) - else - scope - end - end end diff --git a/server/app/graphql/resolvers/variants.rb b/server/app/graphql/resolvers/variants.rb index ccf042021..5dee49937 100644 --- a/server/app/graphql/resolvers/variants.rb +++ b/server/app/graphql/resolvers/variants.rb @@ -1,17 +1,8 @@ -require 'search_object' -require 'search_object/plugin/graphql' +class Resolvers::Variants < Resolvers::Shared::Variants -class Resolvers::Variants < GraphQL::Schema::Resolver - include SearchObject.module(:graphql) + type Types::Interfaces::VariantInterface.connection_type, null: false - type Types::Entities::VariantType.connection_type, null: false - - description 'List and filter variants.' + description 'List and filter Gene variants.' scope { object.variants.where(deprecated: false).order('variants.name ASC').distinct } - - option(:name, type: GraphQL::Types::String, description: 'Left anchored filtering for variant name and aliases.') do |scope, value| - scope.left_joins(:variant_aliases) - .where('variants.name ILIKE :query OR variant_aliases.name ILIKE :query', { query: "%#{value}%" }) - end end diff --git a/server/app/graphql/types/entities/factor_type.rb b/server/app/graphql/types/entities/factor_type.rb index a02f0bbb6..b540b97d0 100644 --- a/server/app/graphql/types/entities/factor_type.rb +++ b/server/app/graphql/types/entities/factor_type.rb @@ -3,6 +3,7 @@ class FactorType < Types::Entities::FeatureType field :ncit_id, String, null: true field :ncit_details, Types::Entities::NcitDetailsType, null: true + field :variants, resolver: Resolvers::FactorVariants def ncit_details NcitDetails.new(object).response diff --git a/server/app/graphql/types/entities/gene_type.rb b/server/app/graphql/types/entities/gene_type.rb index d9a9be0ca..8f7c998d7 100644 --- a/server/app/graphql/types/entities/gene_type.rb +++ b/server/app/graphql/types/entities/gene_type.rb @@ -3,6 +3,7 @@ class GeneType < Types::Entities::FeatureType field :entrez_id, Int, null: false field :my_gene_info_details, GraphQL::Types::JSON, null: true + field :variants, resolver: Resolvers::GeneVariants def my_gene_info_details MyGeneInfo.get_by_gene_id(object.id) From f9ed97f5e8627ccd5b87dcd0c68ef3d4b6daef94 Mon Sep 17 00:00:00 2001 From: Adam Coffman Date: Wed, 17 Apr 2024 16:53:09 -0500 Subject: [PATCH 2/3] add a new example query that demonstrates differentiated variant types --- .../query_examples/factor_mp_variants.yml | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 server/config/query_examples/factor_mp_variants.yml diff --git a/server/config/query_examples/factor_mp_variants.yml b/server/config/query_examples/factor_mp_variants.yml new file mode 100644 index 000000000..8eb2780bc --- /dev/null +++ b/server/config/query_examples/factor_mp_variants.yml @@ -0,0 +1,38 @@ +name: Get Variants for MP +description: Query for Molecular Profiles by name, pulling back their variants. Retrieve different fields based on underlying Variant type +order: 4 +query: | + { + molecularProfiles(name: "MSI") { + totalCount + pageInfo { + hasNextPage + endCursor + } + nodes { + name + evidenceCountsByStatus { + acceptedCount + submittedCount + } + molecularProfileAliases + variants { + id + name + link + ... on FactorVariant { + ncitId + } + ... on GeneVariant { + alleleRegistryId + } + feature { + id + name + link + } + } + } + } + } + From 065acf0f7932d03bdd8aeb176fd7fa4c21a8cfd9 Mon Sep 17 00:00:00 2001 From: Adam Coffman Date: Thu, 18 Apr 2024 10:40:29 -0500 Subject: [PATCH 3/3] fix column name --- server/app/graphql/resolvers/shared/variants.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/app/graphql/resolvers/shared/variants.rb b/server/app/graphql/resolvers/shared/variants.rb index 155497b7e..c9fe401ef 100644 --- a/server/app/graphql/resolvers/shared/variants.rb +++ b/server/app/graphql/resolvers/shared/variants.rb @@ -53,7 +53,7 @@ class Resolvers::Shared::Variants < GraphQL::Schema::Resolver option(:category, type: Types::VariantCategories) do |scope, value| if value - scope.where(category: value) + scope.where(type: value) else scope end