diff --git a/client/src/app/forms/variant-revise/variant-revise.form.ts b/client/src/app/forms/variant-revise/variant-revise.form.ts index 4bfc5d42c..5f341a69a 100644 --- a/client/src/app/forms/variant-revise/variant-revise.form.ts +++ b/client/src/app/forms/variant-revise/variant-revise.form.ts @@ -70,8 +70,8 @@ interface FormModel { ensemblVersion?: number; hgvsDescriptions: string[]; variantTypes: FormVariantType[]; - fivePrimeCoordinates?: CoordinateFieldsFragment; - threePrimeCoordinates?: CoordinateFieldsFragment; + primaryCoordinates?: CoordinateFieldsFragment; + secondaryCoordinates?: CoordinateFieldsFragment; referenceBases: Maybe; variantBases: Maybe; comment?: string; @@ -286,7 +286,7 @@ export class VariantReviseForm implements AfterViewInit, OnDestroy { type: 'cvc-ensembl-input', }, { - key: 'threePrimeCoordinates.referenceBases', + key: 'referenceBases', type: 'input', defaultValue: undefined, templateOptions: { @@ -299,7 +299,7 @@ export class VariantReviseForm implements AfterViewInit, OnDestroy { } }, { - key: 'threePrimeCoordinates.variantBases', + key: 'variantBases', type: 'input', defaultValue: undefined, templateOptions: { @@ -312,7 +312,7 @@ export class VariantReviseForm implements AfterViewInit, OnDestroy { } }, { - key: 'threePrimeCoordinates.chromosome', + key: 'primaryCoordinates.chromosome', type: 'select', defaultValue: undefined, templateOptions: { @@ -323,7 +323,7 @@ export class VariantReviseForm implements AfterViewInit, OnDestroy { }, }, { - key: 'threePrimeCoordinates.start', + key: 'primaryCoordinates.start', type: 'input', templateOptions: { label: 'Start', @@ -335,7 +335,7 @@ export class VariantReviseForm implements AfterViewInit, OnDestroy { } }, { - key: 'threePrimeCoordinates.stop', + key: 'primaryCoordinates.stop', type: 'input', templateOptions: { label: 'Stop', @@ -347,7 +347,7 @@ export class VariantReviseForm implements AfterViewInit, OnDestroy { } }, { - key: 'threePrimeCoordinates.representativeTranscript', + key: 'primaryCoordinates.representativeTranscript', type: 'input', templateOptions: { label: 'Representative Transcript', @@ -358,7 +358,7 @@ export class VariantReviseForm implements AfterViewInit, OnDestroy { template: '

Secondary Coordinates

', }, { - key: 'fivePrimeCoordinates.chromosome', + key: 'secondaryCoordinates.chromosome', type: 'select', defaultValue: undefined, templateOptions: { @@ -370,7 +370,7 @@ export class VariantReviseForm implements AfterViewInit, OnDestroy { }, }, { - key: 'fivePrimeCoordinates.start', + key: 'secondaryCoordinates.start', type: 'input', templateOptions: { label: 'Start', @@ -381,7 +381,7 @@ export class VariantReviseForm implements AfterViewInit, OnDestroy { } }, { - key: 'fivePrimeCoordinates.stop', + key: 'secondaryCoordinates.stop', type: 'input', templateOptions: { label: 'Stop', @@ -392,7 +392,7 @@ export class VariantReviseForm implements AfterViewInit, OnDestroy { } }, { - key: 'fivePrimeCoordinates.representativeTranscript', + key: 'secondaryCoordinates.representativeTranscript', type: 'input', templateOptions: { label: 'Representative Transcript', @@ -487,8 +487,8 @@ export class VariantReviseForm implements AfterViewInit, OnDestroy { ...variant, clinvarStatus: this.getClinvarStatus(variant.clinvarIds), clinvarIds: this.getClinvarIds(variant.clinvarIds), - referenceBases: variant.fivePrimeCoordinates?.referenceBases, - variantBases: variant.fivePrimeCoordinates?.variantBases, + referenceBases: variant.referenceBases, + variantBases: variant.variantBases, comment: this.formModel?.fields.comment, organization: this.formModel?.fields.organization, }, @@ -534,8 +534,8 @@ export class VariantReviseForm implements AfterViewInit, OnDestroy { ensemblVersion: fmt.toNullableInput(fields.ensemblVersion), description: fmt.toNullableString(fields.description), clinvarIds: fmt.toClinvarInput(fields.clinvarIds, fields.clinvarStatus), - primaryCoordinates: fmt.toCoordinateInput(fields.threePrimeCoordinates), - secondaryCoordinates: fmt.toCoordinateInput(fields.fivePrimeCoordinates), + primaryCoordinates: fmt.toCoordinateInput(fields.primaryCoordinates), + secondaryCoordinates: fmt.toCoordinateInput(fields.secondaryCoordinates), referenceBases: fmt.toNullableString(fields.referenceBases), variantBases: fmt.toNullableString(fields.variantBases), referenceBuild: fmt.toNullableReferenceBuildInput(fields.referenceBuild), diff --git a/client/src/app/forms/variant-revise/variant-revise.query.gql b/client/src/app/forms/variant-revise/variant-revise.query.gql index 4336bda83..1bbf65f4a 100644 --- a/client/src/app/forms/variant-revise/variant-revise.query.gql +++ b/client/src/app/forms/variant-revise/variant-revise.query.gql @@ -29,21 +29,21 @@ fragment RevisableVariantFields on Variant { name soid } - fivePrimeCoordinates { + primaryCoordinates { ... CoordinateFields } - threePrimeCoordinates { + secondaryCoordinates { ... CoordinateFields } + referenceBases + variantBases } fragment CoordinateFields on Coordinate { chromosome - referenceBases representativeTranscript start stop - variantBases } mutation SuggestVariantRevision($input: SuggestVariantRevisionInput!) { diff --git a/client/src/app/generated/civic.apollo.ts b/client/src/app/generated/civic.apollo.ts index bff784a47..35674d1bd 100644 --- a/client/src/app/generated/civic.apollo.ts +++ b/client/src/app/generated/civic.apollo.ts @@ -963,11 +963,9 @@ export type Contribution = { export type Coordinate = { __typename: 'Coordinate'; chromosome?: Maybe; - referenceBases?: Maybe; representativeTranscript?: Maybe; start?: Maybe; stop?: Maybe; - variantBases?: Maybe; }; export type CoordinateInput = { @@ -4096,7 +4094,6 @@ export type Variant = Commentable & EventOriginObject & EventSubject & Flaggable events: EventConnection; evidenceItems: EvidenceItemConnection; evidenceScore: Scalars['Float']; - fivePrimeCoordinates?: Maybe; flagged: Scalars['Boolean']; /** List and filter flags. */ flags: FlagConnection; @@ -4109,12 +4106,15 @@ export type Variant = Commentable & EventOriginObject & EventSubject & Flaggable link: Scalars['String']; myVariantInfo?: Maybe; name: Scalars['String']; + primaryCoordinates?: Maybe; + referenceBases: Scalars['String']; referenceBuild?: Maybe; /** List and filter revisions. */ revisions: RevisionConnection; + secondaryCoordinates?: Maybe; sources: Array; - threePrimeCoordinates?: Maybe; variantAliases: Array; + variantBases: Scalars['String']; variantTypes: Array; }; @@ -6961,7 +6961,7 @@ export type VariantRevisableFieldsQuery = ( export type RevisableVariantFieldsFragment = ( { __typename: 'Variant' } - & Pick + & Pick & { sources: Array<( { __typename: 'Source' } & Pick @@ -6971,10 +6971,10 @@ export type RevisableVariantFieldsFragment = ( ), variantTypes: Array<( { __typename: 'VariantType' } & Pick - )>, fivePrimeCoordinates?: Maybe<( + )>, primaryCoordinates?: Maybe<( { __typename: 'Coordinate' } & CoordinateFieldsFragment - )>, threePrimeCoordinates?: Maybe<( + )>, secondaryCoordinates?: Maybe<( { __typename: 'Coordinate' } & CoordinateFieldsFragment )> } @@ -6982,7 +6982,7 @@ export type RevisableVariantFieldsFragment = ( export type CoordinateFieldsFragment = ( { __typename: 'Coordinate' } - & Pick + & Pick ); export type SuggestVariantRevisionMutationVariables = Exact<{ @@ -7936,7 +7936,7 @@ export type VariantSummaryQuery = ( export type VariantSummaryFieldsFragment = ( { __typename: 'Variant' } - & Pick + & Pick & { gene: ( { __typename: 'Gene' } & Pick @@ -7946,12 +7946,12 @@ export type VariantSummaryFieldsFragment = ( )>, variantTypes: Array<( { __typename: 'VariantType' } & Pick - )>, fivePrimeCoordinates?: Maybe<( + )>, primaryCoordinates?: Maybe<( { __typename: 'Coordinate' } - & Pick - )>, threePrimeCoordinates?: Maybe<( + & Pick + )>, secondaryCoordinates?: Maybe<( { __typename: 'Coordinate' } - & Pick + & Pick )>, flags: ( { __typename: 'FlagConnection' } & Pick @@ -9146,11 +9146,9 @@ export const SubmittableVariantGroupFieldsFragmentDoc = gql` export const CoordinateFieldsFragmentDoc = gql` fragment CoordinateFields on Coordinate { chromosome - referenceBases representativeTranscript start stop - variantBases } `; export const RevisableVariantFieldsFragmentDoc = gql` @@ -9179,12 +9177,14 @@ export const RevisableVariantFieldsFragmentDoc = gql` name soid } - fivePrimeCoordinates { + primaryCoordinates { ...CoordinateFields } - threePrimeCoordinates { + secondaryCoordinates { ...CoordinateFields } + referenceBases + variantBases } ${CoordinateFieldsFragmentDoc}`; export const AssertionDetailFieldsFragmentDoc = gql` @@ -9878,22 +9878,20 @@ export const VariantSummaryFieldsFragmentDoc = gql` evidenceScore referenceBuild ensemblVersion - fivePrimeCoordinates { + primaryCoordinates { representativeTranscript chromosome start stop - referenceBases - variantBases } - threePrimeCoordinates { + secondaryCoordinates { representativeTranscript chromosome start stop - referenceBases - variantBases } + referenceBases + variantBases flags(state: OPEN) { totalCount } diff --git a/client/src/app/generated/server.field-policies.ts b/client/src/app/generated/server.field-policies.ts index 140ac18c5..b0f1fe699 100644 --- a/client/src/app/generated/server.field-policies.ts +++ b/client/src/app/generated/server.field-policies.ts @@ -431,14 +431,12 @@ export type ContributionFieldPolicy = { action?: FieldPolicy | FieldReadFunction, count?: FieldPolicy | FieldReadFunction }; -export type CoordinateKeySpecifier = ('chromosome' | 'referenceBases' | 'representativeTranscript' | 'start' | 'stop' | 'variantBases' | CoordinateKeySpecifier)[]; +export type CoordinateKeySpecifier = ('chromosome' | 'representativeTranscript' | 'start' | 'stop' | CoordinateKeySpecifier)[]; export type CoordinateFieldPolicy = { chromosome?: FieldPolicy | FieldReadFunction, - referenceBases?: FieldPolicy | FieldReadFunction, representativeTranscript?: FieldPolicy | FieldReadFunction, start?: FieldPolicy | FieldReadFunction, - stop?: FieldPolicy | FieldReadFunction, - variantBases?: FieldPolicy | FieldReadFunction + stop?: FieldPolicy | FieldReadFunction }; export type CountryKeySpecifier = ('id' | 'iso' | 'name' | CountryKeySpecifier)[]; export type CountryFieldPolicy = { @@ -1274,7 +1272,7 @@ export type ValidationErrorsFieldPolicy = { genericErrors?: FieldPolicy | FieldReadFunction, validationErrors?: FieldPolicy | FieldReadFunction }; -export type VariantKeySpecifier = ('alleleRegistryId' | 'clinvarIds' | 'comments' | 'description' | 'ensemblVersion' | 'events' | 'evidenceItems' | 'evidenceScore' | 'fivePrimeCoordinates' | 'flagged' | 'flags' | 'gene' | 'hgvsDescriptions' | 'id' | 'lastAcceptedRevisionEvent' | 'lastCommentEvent' | 'lastSubmittedRevisionEvent' | 'link' | 'myVariantInfo' | 'name' | 'referenceBuild' | 'revisions' | 'sources' | 'threePrimeCoordinates' | 'variantAliases' | 'variantTypes' | VariantKeySpecifier)[]; +export type VariantKeySpecifier = ('alleleRegistryId' | 'clinvarIds' | 'comments' | 'description' | 'ensemblVersion' | 'events' | 'evidenceItems' | 'evidenceScore' | 'flagged' | 'flags' | 'gene' | 'hgvsDescriptions' | 'id' | 'lastAcceptedRevisionEvent' | 'lastCommentEvent' | 'lastSubmittedRevisionEvent' | 'link' | 'myVariantInfo' | 'name' | 'primaryCoordinates' | 'referenceBases' | 'referenceBuild' | 'revisions' | 'secondaryCoordinates' | 'sources' | 'variantAliases' | 'variantBases' | 'variantTypes' | VariantKeySpecifier)[]; export type VariantFieldPolicy = { alleleRegistryId?: FieldPolicy | FieldReadFunction, clinvarIds?: FieldPolicy | FieldReadFunction, @@ -1284,7 +1282,6 @@ export type VariantFieldPolicy = { events?: FieldPolicy | FieldReadFunction, evidenceItems?: FieldPolicy | FieldReadFunction, evidenceScore?: FieldPolicy | FieldReadFunction, - fivePrimeCoordinates?: FieldPolicy | FieldReadFunction, flagged?: FieldPolicy | FieldReadFunction, flags?: FieldPolicy | FieldReadFunction, gene?: FieldPolicy | FieldReadFunction, @@ -1296,11 +1293,14 @@ export type VariantFieldPolicy = { link?: FieldPolicy | FieldReadFunction, myVariantInfo?: FieldPolicy | FieldReadFunction, name?: FieldPolicy | FieldReadFunction, + primaryCoordinates?: FieldPolicy | FieldReadFunction, + referenceBases?: FieldPolicy | FieldReadFunction, referenceBuild?: FieldPolicy | FieldReadFunction, revisions?: FieldPolicy | FieldReadFunction, + secondaryCoordinates?: FieldPolicy | FieldReadFunction, sources?: FieldPolicy | FieldReadFunction, - threePrimeCoordinates?: FieldPolicy | FieldReadFunction, variantAliases?: FieldPolicy | FieldReadFunction, + variantBases?: FieldPolicy | FieldReadFunction, variantTypes?: FieldPolicy | FieldReadFunction }; export type VariantAliasKeySpecifier = ('name' | VariantAliasKeySpecifier)[]; diff --git a/client/src/app/generated/server.model.graphql b/client/src/app/generated/server.model.graphql index 23231ec1f..4cc106503 100644 --- a/client/src/app/generated/server.model.graphql +++ b/client/src/app/generated/server.model.graphql @@ -1543,11 +1543,9 @@ type Contribution { type Coordinate { chromosome: String - referenceBases: String representativeTranscript: String start: Int stop: Int - variantBases: String } input CoordinateInput { @@ -3094,7 +3092,7 @@ type Mutation { ): AddDrugPayload """ - Add a stub record for an external source that is not yet in CiVIC. + Add a stub record for an external source that is not yet in CIViC. This is for adding a new Source inline while performing other curation activities such as adding new evidence items and is distinct from suggesting a source for curation. """ @@ -6760,7 +6758,6 @@ type Variant implements Commentable & EventOriginObject & EventSubject & Flaggab last: Int ): EvidenceItemConnection! evidenceScore: Float! - fivePrimeCoordinates: Coordinate flagged: Boolean! """ @@ -6816,6 +6813,8 @@ type Variant implements Commentable & EventOriginObject & EventSubject & Flaggab link: String! myVariantInfo: MyVariantInfo name: String! + primaryCoordinates: Coordinate + referenceBases: String! referenceBuild: ReferenceBuild """ @@ -6867,9 +6866,10 @@ type Variant implements Commentable & EventOriginObject & EventSubject & Flaggab """ status: RevisionStatus ): RevisionConnection! + secondaryCoordinates: Coordinate sources: [Source!]! - threePrimeCoordinates: Coordinate variantAliases: [String!]! + variantBases: String! variantTypes: [VariantType!]! } diff --git a/client/src/app/generated/server.schema.json b/client/src/app/generated/server.schema.json index aec02762b..ee6f31853 100644 --- a/client/src/app/generated/server.schema.json +++ b/client/src/app/generated/server.schema.json @@ -7277,18 +7277,6 @@ "isDeprecated": false, "deprecationReason": null }, - { - "name": "referenceBases", - "description": null, - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, { "name": "representativeTranscript", "description": null, @@ -7324,18 +7312,6 @@ }, "isDeprecated": false, "deprecationReason": null - }, - { - "name": "variantBases", - "description": null, - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null } ], "inputFields": null, @@ -14116,7 +14092,7 @@ }, { "name": "addRemoteCitation", - "description": "Add a stub record for an external source that is not yet in CiVIC.\nThis is for adding a new Source inline while performing other curation activities\nsuch as adding new evidence items and is distinct from suggesting a source for curation.\n", + "description": "Add a stub record for an external source that is not yet in CIViC.\nThis is for adding a new Source inline while performing other curation activities\nsuch as adding new evidence items and is distinct from suggesting a source for curation.\n", "args": [ { "name": "input", @@ -28967,18 +28943,6 @@ "isDeprecated": false, "deprecationReason": null }, - { - "name": "fivePrimeCoordinates", - "description": null, - "args": [], - "type": { - "kind": "OBJECT", - "name": "Coordinate", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, { "name": "flagged", "description": null, @@ -29244,6 +29208,34 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "primaryCoordinates", + "description": null, + "args": [], + "type": { + "kind": "OBJECT", + "name": "Coordinate", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "referenceBases", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "referenceBuild", "description": null, @@ -29381,6 +29373,18 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "secondaryCoordinates", + "description": null, + "args": [], + "type": { + "kind": "OBJECT", + "name": "Coordinate", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "sources", "description": null, @@ -29405,18 +29409,6 @@ "isDeprecated": false, "deprecationReason": null }, - { - "name": "threePrimeCoordinates", - "description": null, - "args": [], - "type": { - "kind": "OBJECT", - "name": "Coordinate", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, { "name": "variantAliases", "description": null, @@ -29441,6 +29433,22 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "variantBases", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "variantTypes", "description": null, diff --git a/client/src/app/views/pages/pages-help/pages-help.page.html b/client/src/app/views/pages/pages-help/pages-help.page.html index 8d9c2405f..bc8c9dde4 100644 --- a/client/src/app/views/pages/pages-help/pages-help.page.html +++ b/client/src/app/views/pages/pages-help/pages-help.page.html @@ -56,8 +56,8 @@ - Please follow our twitter account @CIVICdb. + Please follow our Twitter account @CIViCdb. diff --git a/client/src/app/views/variants/variants-detail/variants-summary/variants-summary.page.html b/client/src/app/views/variants/variants-detail/variants-summary/variants-summary.page.html index 5562bad19..1837a4eaa 100644 --- a/client/src/app/views/variants/variants-detail/variants-summary/variants-summary.page.html +++ b/client/src/app/views/variants/variants-detail/variants-summary/variants-summary.page.html @@ -194,10 +194,10 @@ - - - + + - - - {{ coords.referenceBases | ifEmpty: '--'}} - - - - - {{ coords.variantBases | ifEmpty: '--'}} - + + + + {{ variant.referenceBases | ifEmpty: '--'}} + + + + + {{ variant.variantBases | ifEmpty: '--'}} + + - {{ coords.representativeTranscript }} @@ -245,11 +247,10 @@ - - - - + + - - - {{ coords.referenceBases | ifEmpty: '--'}} - - - - - {{ coords.variantBases | ifEmpty: '--'}} - - - {{ coords.representativeTranscript }} diff --git a/client/src/app/views/variants/variants-detail/variants-summary/variants-summary.query.gql b/client/src/app/views/variants/variants-detail/variants-summary/variants-summary.query.gql index e8b91fabd..f7876d963 100644 --- a/client/src/app/views/variants/variants-detail/variants-summary/variants-summary.query.gql +++ b/client/src/app/views/variants/variants-detail/variants-summary/variants-summary.query.gql @@ -35,22 +35,20 @@ fragment VariantSummaryFields on Variant { evidenceScore referenceBuild ensemblVersion - fivePrimeCoordinates { + primaryCoordinates { representativeTranscript chromosome start stop - referenceBases - variantBases } - threePrimeCoordinates { + secondaryCoordinates { representativeTranscript chromosome start stop - referenceBases - variantBases } + referenceBases + variantBases flags(state: OPEN) { totalCount } diff --git a/docs/config.yml b/docs/config.yml index 32f9cb818..16de6680c 100644 --- a/docs/config.yml +++ b/docs/config.yml @@ -4,7 +4,7 @@ introspection: schemaFile: ./client/src/app/generated/server.model.graphql info: - title: CiVIC 2 API Documentation + title: CIViC 2 API Documentation description: Documentation for the CIViC GraphQL API contact: name: The CIViC Development Team diff --git a/server/app/graphql/mutations/add_remote_citation.rb b/server/app/graphql/mutations/add_remote_citation.rb index 291716511..56695d0b8 100644 --- a/server/app/graphql/mutations/add_remote_citation.rb +++ b/server/app/graphql/mutations/add_remote_citation.rb @@ -1,6 +1,6 @@ class Mutations::AddRemoteCitation < Mutations::BaseMutation description <<~DOC - Add a stub record for an external source that is not yet in CiVIC. + Add a stub record for an external source that is not yet in CIViC. This is for adding a new Source inline while performing other curation activities such as adding new evidence items and is distinct from suggesting a source for curation. DOC diff --git a/server/app/graphql/mutations/reject_revisions.rb b/server/app/graphql/mutations/reject_revisions.rb index 911e7cf78..75b81e567 100644 --- a/server/app/graphql/mutations/reject_revisions.rb +++ b/server/app/graphql/mutations/reject_revisions.rb @@ -39,11 +39,10 @@ def ready?(organization_id: nil, ids: nil, revision_set_id: nil, **_) @revisions = Revision.where(revisionset_id: revision_set_id, status: 'new') if revisions.count == 0 raise GraphQL::ExecutionError, "Revisions with status 'new' in revision_set_id #{revision_set_id} don't exist." - else end - - return true end + + return true end def authorized?(organization_id: nil, **_) diff --git a/server/app/graphql/resolvers/validate_revisions_for_acceptance.rb b/server/app/graphql/resolvers/validate_revisions_for_acceptance.rb index 0c04ba4bf..57df18533 100644 --- a/server/app/graphql/resolvers/validate_revisions_for_acceptance.rb +++ b/server/app/graphql/resolvers/validate_revisions_for_acceptance.rb @@ -69,6 +69,7 @@ def resolve(revision_ids:) end if !subject.valid? subject.errors.each do |attribute, message| + attribute = attribute.to_s if attribute.ends_with?("_ids") formatted_attribute = attribute.singularize.humanize.pluralize else diff --git a/server/app/graphql/types/entities/coordinate_type.rb b/server/app/graphql/types/entities/coordinate_type.rb index 9ecffccf1..969e3612f 100644 --- a/server/app/graphql/types/entities/coordinate_type.rb +++ b/server/app/graphql/types/entities/coordinate_type.rb @@ -4,7 +4,5 @@ class CoordinateType < Types::BaseObject field :chromosome, String, null: true field :start, Int, null: true field :stop, Int, null: true - field :reference_bases, String, null: true - field :variant_bases, String, null: true end end diff --git a/server/app/graphql/types/entities/variant_type.rb b/server/app/graphql/types/entities/variant_type.rb index fe906a261..3cfe492c5 100644 --- a/server/app/graphql/types/entities/variant_type.rb +++ b/server/app/graphql/types/entities/variant_type.rb @@ -16,8 +16,10 @@ class VariantType < Types::BaseObject field :sources, [Types::Entities::SourceType], null: false field :reference_build, Types::ReferenceBuildType, null: true field :ensembl_version, Int, null: true - field :five_prime_coordinates, Types::Entities::CoordinateType, null: true - field :three_prime_coordinates, Types::Entities::CoordinateType, null: true + field :primary_coordinates, Types::Entities::CoordinateType, null: true + field :secondary_coordinates, Types::Entities::CoordinateType, null: true + field :reference_bases, String, null: false + field :variant_bases, String, null: false field :allele_registry_id, String, null: true field :evidence_score, Float, null: false field :variant_aliases, [String], null: false @@ -35,26 +37,30 @@ def evidence_items Loaders::AssociationLoader.for(Variant, :evidence_items).load(object) end - def three_prime_coordinates - { - representative_transcript: object.representative_transcript, - chromosome: object.chromosome, - start: object.start, - stop: object.stop, - reference_bases: object.reference_bases, - variant_bases: object.variant_bases - } + def primary_coordinates + if (object.representative_transcript.blank? && object.chromosome.blank? && object.start.blank? && object.stop.blank?) + return nil + else + return { + representative_transcript: object.representative_transcript, + chromosome: object.chromosome, + start: object.start, + stop: object.stop, + } + end end - def five_prime_coordinates - { - representative_transcript: object.representative_transcript2, - chromosome: object.chromosome2, - start: object.start2, - stop: object.stop2, - reference_bases: nil, - variant_bases: nil, - } + def secondary_coordinates + if (object.representative_transcript2.blank? && object.chromosome2.blank? && object.start2.blank? && object.stop2.blank?) + return nil + else + return { + representative_transcript: object.representative_transcript2, + chromosome: object.chromosome2, + start: object.start2, + stop: object.stop2, + } + end end def evidence_score