diff --git a/client/src/app/generated/server.model.graphql b/client/src/app/generated/server.model.graphql index 4625d8e7a..1d8b04d4f 100644 --- a/client/src/app/generated/server.model.graphql +++ b/client/src/app/generated/server.model.graphql @@ -5681,6 +5681,11 @@ type Query { """ after: String + """ + Find Molecular Profiles based on the ClinGen Allele Registry ID of one of its involed Variants + """ + alleleRegistryId: String + """ Returns the elements in the list that come before the specified cursor. """ @@ -6250,6 +6255,11 @@ type Query { """ 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. """ diff --git a/client/src/app/generated/server.schema.json b/client/src/app/generated/server.schema.json index dc28873d9..905b19db8 100644 --- a/client/src/app/generated/server.schema.json +++ b/client/src/app/generated/server.schema.json @@ -25568,6 +25568,18 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "alleleRegistryId", + "description": "Find Molecular Profiles based on the ClinGen Allele Registry ID of one of its involed Variants", + "type": { + "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.", @@ -27931,6 +27943,18 @@ "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", diff --git a/server/app/graphql/mutations/create_molecular_profile.rb b/server/app/graphql/mutations/create_molecular_profile.rb index 1d80c74e3..30e490d86 100644 --- a/server/app/graphql/mutations/create_molecular_profile.rb +++ b/server/app/graphql/mutations/create_molecular_profile.rb @@ -19,7 +19,12 @@ def ready?(structure: ) if variants.size != variant_ids.size missing = variant_ids - variants.map(&:id) - raise GraphQL::ExecutionError, "Variants with ID [#{missing.join(', ')}] were not found." + raise GraphQL::ExecutionError, "Variants with ID [#{missing.join(', ')}] were not found." + end + + deprecated_variants = variants.select { |v| v.deprecated? } + if deprecated_variants.any? + raise GraphQL::ExecutionError, "Variants [#{deprecated_variants.map(&:name).join(', ')}] are Deprecated and should not be used." end return true diff --git a/server/app/graphql/resolvers/top_level_molecular_profiles.rb b/server/app/graphql/resolvers/top_level_molecular_profiles.rb index 98f615325..b831657a3 100644 --- a/server/app/graphql/resolvers/top_level_molecular_profiles.rb +++ b/server/app/graphql/resolvers/top_level_molecular_profiles.rb @@ -47,4 +47,7 @@ class Resolvers::TopLevelMolecularProfiles < GraphQL::Schema::Resolver scope.joins(:variants).where('variants.id = ?', value) end + option(:allele_registry_id, type: GraphQL::Types::String, description: 'Find Molecular Profiles based on the ClinGen Allele Registry ID of one of its involed Variants') do |scope, value| + scope.joins(:variants).where('variants.allele_registry_id = ?', value) + end end diff --git a/server/app/graphql/resolvers/top_level_variants.rb b/server/app/graphql/resolvers/top_level_variants.rb index e3f4f799b..bc79797f5 100644 --- a/server/app/graphql/resolvers/top_level_variants.rb +++ b/server/app/graphql/resolvers/top_level_variants.rb @@ -26,6 +26,10 @@ class Resolvers::TopLevelVariants < GraphQL::Schema::Resolver 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 })