Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Support Regulatory Fusions #1176

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions client/src/app/generated/server.model.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -5026,6 +5026,7 @@ type Fusion implements Commentable & EventOriginObject & EventSubject & Flaggabl
link: String!
name: String!
openRevisionCount: Int!
regulatoryFusionType: RegulatoryFusionType

"""
List and filter revisions.
Expand Down Expand Up @@ -5221,11 +5222,17 @@ input FusionPartnerInput {
The status of the fusion partner
"""
partnerStatus: FusionPartnerStatus!

"""
If the fusion partner status is set to regulatory, what type of regulatory fusion is it?
"""
regulatoryFusionType: RegulatoryFusionType
}

enum FusionPartnerStatus {
KNOWN
MULTIPLE
REGULATORY
UNKNOWN
}

Expand Down Expand Up @@ -9804,6 +9811,35 @@ enum ReferenceBuild {
NCBI36
}

enum RegulatoryFusionType {
REG_ATTENUATOR
REG_CAAT_SIGNAL
REG_DNASE_I_HYPERSENSITIVE_SITE
REG_ENHANCER
REG_ENHANCER_BLOCKING_ELEMENT
REG_GC_SIGNAL
REG_IMPRINTING_CONTROL_REGION
REG_INSULATOR
REG_LOCUS_CONTROL_REGION
REG_MATRIX_ATTACHMENT_REGION
REG_MINUS_10_SIGNAL
REG_MINUS_35_SIGNAL
REG_OTHER
REG_POLYA_SIGNAL_SEQUENCE
REG_PROMOTER
REG_RECODING_STIMULATORY_REGION
REG_RECOMBINATION_ENHANCER
REG_REPLICATION_REGULATORY_REGION
REG_RESPONSE_ELEMENT
REG_RIBOSOME_BINDING_SITE
REG_RIBOSWITCH
REG_SILENCER
REG_TATA_BOX
REG_TERMINATOR
REG_TRANSCRIPTIONAL_CIS_REGULATORY_REGION
REG_UORF
}

type RejectRevisionsActivity implements ActivityInterface {
createdAt: ISO8601DateTime!
events: [Event!]!
Expand Down
197 changes: 197 additions & 0 deletions client/src/app/generated/server.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -23867,6 +23867,18 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "regulatoryFusionType",
"description": null,
"args": [],
"type": {
"kind": "ENUM",
"name": "RegulatoryFusionType",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "revisions",
"description": "List and filter revisions.",
Expand Down Expand Up @@ -24516,6 +24528,18 @@
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "regulatoryFusionType",
"description": "If the fusion partner status is set to regulatory, what type of regulatory fusion is it?",
"type": {
"kind": "ENUM",
"name": "RegulatoryFusionType",
"ofType": null
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
}
],
"interfaces": null,
Expand Down Expand Up @@ -24547,6 +24571,12 @@
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "REGULATORY",
"description": null,
"isDeprecated": false,
"deprecationReason": null
}
],
"possibleTypes": null
Expand Down Expand Up @@ -44531,6 +44561,173 @@
],
"possibleTypes": null
},
{
"kind": "ENUM",
"name": "RegulatoryFusionType",
"description": null,
"fields": null,
"inputFields": null,
"interfaces": null,
"enumValues": [
{
"name": "REG_ATTENUATOR",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "REG_CAAT_SIGNAL",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "REG_DNASE_I_HYPERSENSITIVE_SITE",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "REG_ENHANCER",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "REG_ENHANCER_BLOCKING_ELEMENT",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "REG_GC_SIGNAL",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "REG_IMPRINTING_CONTROL_REGION",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "REG_INSULATOR",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "REG_LOCUS_CONTROL_REGION",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "REG_MATRIX_ATTACHMENT_REGION",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "REG_MINUS_35_SIGNAL",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "REG_MINUS_10_SIGNAL",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "REG_POLYA_SIGNAL_SEQUENCE",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "REG_PROMOTER",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "REG_RECODING_STIMULATORY_REGION",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "REG_RECOMBINATION_ENHANCER",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "REG_REPLICATION_REGULATORY_REGION",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "REG_RESPONSE_ELEMENT",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "REG_RIBOSOME_BINDING_SITE",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "REG_RIBOSWITCH",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "REG_SILENCER",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "REG_TATA_BOX",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "REG_TERMINATOR",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "REG_TRANSCRIPTIONAL_CIS_REGULATORY_REGION",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "REG_UORF",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "REG_OTHER",
"description": null,
"isDeprecated": false,
"deprecationReason": null
}
],
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "RejectRevisionsActivity",
Expand Down
21 changes: 17 additions & 4 deletions server/app/graphql/mutations/create_fusion_feature.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,22 @@ def ready?(organization_id: nil, five_prime_gene:, three_prime_gene:,**kwargs)

#check that partner status matches gene_id presence
[five_prime_gene, three_prime_gene].each do |gene_input|
if gene_input.gene_id.present? && gene_input.partner_status != 'known'
raise GraphQL::ExecutionError, "Partner status needs to be 'known' if a gene_id is set"
if gene_input.gene_id.present? && (gene_input.partner_status != 'known' || gene_input.partner_status != 'regulatory')
raise GraphQL::ExecutionError, "Partner status needs to be 'known' or 'regulatory' if a gene_id is set"
end
if gene_input.gene_id.blank? && gene_input.partner_status == 'known'
raise GraphQL::ExecutionError, "Partner status can't be 'known' if a gene_id is not set"
if gene_input.gene_id.blank? && (gene_input.partner_status == 'known' && gene_input.partner_status != 'regulatory')
raise GraphQL::ExecutionError, "Partner status can't be 'known' or 'regulatory' if a gene_id is not set"
end
end

#check that maximum one gene has regulatory_fusion_type set
if five_prime_gene.partner_status == 'regulatory' && three_prime_gene.partner_status == 'regulatory'
raise GraphQL::ExecutionError, "Only one Fusion partner can be marked 'regulatory'"
end
if five_prime_gene.regulatory_fusion_type.present? && three_prime_gene.regulatory_fusion_type.present?
raise GraphQL::ExecutionError, "Only one Fusion partner can have a regulatory fusion type set."
end

return true
end

Expand All @@ -54,12 +62,16 @@ def authorized?(organization_id: nil, **kwargs)

def resolve(five_prime_gene:, three_prime_gene:, organization_id: nil)

#only one can be set
regulatory_fusion_type = five_prime_partner_status.regulatory_fusion_type || three_prime_partner_status.regulatory_fusion_type

existing_feature_instance = Features::Fusion
.find_by(
five_prime_gene_id: five_prime_gene.gene_id,
three_prime_gene_id: three_prime_gene.gene_id,
five_prime_partner_status: five_prime_gene.partner_status,
three_prime_partner_status: three_prime_gene.partner_status,
regulatory_fusion_type: regulatory_fusion_type
)

if existing_feature_instance.present?
Expand All @@ -74,6 +86,7 @@ def resolve(five_prime_gene:, three_prime_gene:, organization_id: nil)
three_prime_gene_id: three_prime_gene.gene_id,
five_prime_partner_status: five_prime_gene.partner_status,
three_prime_partner_status: three_prime_gene.partner_status,
regulatory_fusion_type: regulatory_fusion_type,
originating_user: context[:current_user],
organization_id: organization_id,
)
Expand Down
2 changes: 2 additions & 0 deletions server/app/graphql/types/entities/fusion_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ class FusionType < Types::Entities::FeatureType
field :five_prime_partner_status, Types::Fusion::FusionPartnerStatus, null: false
field :three_prime_partner_status, Types::Fusion::FusionPartnerStatus, null: false

field :regulatory_fusion_type, Types::Fusion::RegulatoryFusionTypeType, null: true

def five_prime_gene
Loaders::AssociationLoader.for(Features::Fusion, :five_prime_gene).load(object)
end
Expand Down
2 changes: 2 additions & 0 deletions server/app/graphql/types/fusion/fusion_partner_input_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@ class FusionPartnerInputType < Types::BaseInputObject
description: 'The status of the fusion partner'
argument :gene_id, Int, required: false,
description: 'The CIViC gene ID of the partner, if known'
argument :regulatory_fusion_type, Types::Fusion::RegulatoryFusionTypeType, required: false,
description: "If the fusion partner status is set to regulatory, what type of regulatory fusion is it?"
end
end
1 change: 1 addition & 0 deletions server/app/graphql/types/fusion/fusion_partner_status.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ class FusionPartnerStatus < Types::BaseEnum
value 'KNOWN', value: 'known'
value 'UNKNOWN', value: 'unknown'
value 'MULTIPLE', value: 'multiple'
value 'REGULATORY', value: 'regulatory'
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module Types::Fusion
class RegulatoryFusionTypeType < Types::BaseEnum
Constants::REGULATORY_FUSION_ENUM_TYPES.each do |(name, _)|
value name.upcase, value: name
end
end
end
Loading
Loading