Skip to content

Commit

Permalink
Merge pull request #71 from opentargets/rm-credset-add-geneid
Browse files Browse the repository at this point in the history
Add geneid to credset
  • Loading branch information
remo87 authored Aug 16, 2022
2 parents 7ff4ff2 + 9401cec commit 9959bc4
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 12 deletions.
8 changes: 4 additions & 4 deletions app/components/Backend.scala
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ class Backend @Inject() (

def qtlCredibleSet(studyId: String,
variantId: String,
phenotypeId: String,
geneId: String,
bioFeatureId: String
): Future[Seq[(SimpleVariant, CredSetRowStats)]] = {
val variant = Variant.fromString(variantId)
Expand All @@ -221,7 +221,7 @@ class Backend @Inject() (
(r.leadAltAllele === v.altAllele) &&
(r.studyId === studyId) &&
(r.dataType =!= GWASLiteral) &&
(r.phenotypeId === phenotypeId) &&
(r.geneId === geneId) &&
(r.bioFeature === bioFeatureId)
)
.map(_.tagVariantWithStats)
Expand Down Expand Up @@ -261,7 +261,7 @@ class Backend @Inject() (
def qtlRegionalFromSumstats(
studyId: String,
bioFeature: String,
phenotypeId: String,
geneId: String,
chromosome: String,
startPos: Long,
endPos: Long
Expand All @@ -274,7 +274,7 @@ class Backend @Inject() (
(r.pos >= startPos) &&
(r.pos <= endPos) &&
(r.bioFeature === bioFeature) &&
(r.phenotypeId === phenotypeId) &&
(r.geneId === geneId) &&
(r.studyId === studyId)
)
.map(_.variantAndPVal)
Expand Down
5 changes: 4 additions & 1 deletion app/models/database/FRM.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1042,6 +1042,8 @@ object FRM {

def phenotypeId = column[Option[String]]("phenotype_id")

def geneId = column[Option[String]]("gene_id")

def dataType = column[String]("data_type")

def tagChromosome = column[String]("tag_chrom")
Expand Down Expand Up @@ -1094,7 +1096,8 @@ object FRM {
) = (tagVariant, stats)

def * =
(studyId, leadVariant, tagVariant, stats, bioFeature, phenotypeId, dataType).mapTo[CredSetRow]
(studyId, leadVariant, tagVariant, stats, bioFeature, phenotypeId, geneId, dataType)
.mapTo[CredSetRow]
}

class SumStatsGWAS(tag: Tag) extends Table[SumStatsGWASRow](tag, "v2d_sa_gwas") {
Expand Down
1 change: 1 addition & 0 deletions app/models/entities/Entities.scala
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,7 @@ object Entities {
stats: CredSetRowStats,
bioFeature: Option[String],
pehotypeId: Option[String],
geneId: Option[String],
dataType: String
)

Expand Down
10 changes: 5 additions & 5 deletions app/models/gql/GQLSchema.scala
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ object GQLSchema

val credSetTagElement: ObjectType[Backend, (SimpleVariant, CredSetRowStats)] = ObjectType(
"CredSetTagElement",
"Thsi element represents the tag variant with its associated statistics",
"This element represents the tag variant with its associated statistics",
fields[Backend, (SimpleVariant, CredSetRowStats)](
Field("tagVariant",
variant,
Expand Down Expand Up @@ -613,11 +613,11 @@ object GQLSchema
"qtlRegional",
ListType(regionalAssociation),
arguments =
studyId :: bioFeature :: phenotypeId :: chromosome :: dnaPosStart :: dnaPosEnd :: Nil,
studyId :: bioFeature :: geneId :: chromosome :: dnaPosStart :: dnaPosEnd :: Nil,
resolve = ctx =>
ctx.ctx.qtlRegionalFromSumstats(ctx.arg(studyId),
ctx.arg(bioFeature),
ctx.arg(phenotypeId),
ctx.arg(geneId),
ctx.arg(chromosome),
ctx.arg(dnaPosStart),
ctx.arg(dnaPosEnd)
Expand All @@ -639,11 +639,11 @@ object GQLSchema
Field(
"qtlCredibleSet",
ListType(credSetTagElement),
arguments = studyId :: variantId :: phenotypeId :: bioFeature :: Nil,
arguments = studyId :: variantId :: geneId :: bioFeature :: Nil,
resolve = ctx =>
ctx.ctx.qtlCredibleSet(ctx.arg(studyId),
ctx.arg(variantId),
ctx.arg(phenotypeId),
ctx.arg(geneId),
ctx.arg(bioFeature)
)
),
Expand Down
4 changes: 2 additions & 2 deletions example_queries.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ query exmaple {
se
}
}
qtlCredibleSet(studyId: "TWINSUK", variantId: "1_1280044_T_C", phenotypeId: "ENSG00000127054", bioFeature: "LCL") {
qtlCredibleSet(studyId: "TWINSUK", variantId: "1_1280044_T_C", geneId: "ENSG00000127054", bioFeature: "LCL") {
tagVariant {
id
rsId
Expand Down Expand Up @@ -112,7 +112,7 @@ query exmaple {
nearestGeneDistance
}
}
qtlRegional(studyId: "TWINSUK", bioFeature: "FAT", phenotypeId: "ENSG00000224969", chromosome: "1", start: 1000000, end: 1500000) {
qtlRegional(studyId: "TWINSUK", bioFeature: "FAT", geneId: "ENSG00000224969", chromosome: "1", start: 1000000, end: 1500000) {
variant {
id
rsId
Expand Down

0 comments on commit 9959bc4

Please sign in to comment.