diff --git a/app/components/Backend.scala b/app/components/Backend.scala index f323dff..8f40d58 100644 --- a/app/components/Backend.scala +++ b/app/components/Backend.scala @@ -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) @@ -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) @@ -261,7 +261,7 @@ class Backend @Inject() ( def qtlRegionalFromSumstats( studyId: String, bioFeature: String, - phenotypeId: String, + geneId: String, chromosome: String, startPos: Long, endPos: Long @@ -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) diff --git a/app/models/database/FRM.scala b/app/models/database/FRM.scala index fd8c51b..bea8d44 100644 --- a/app/models/database/FRM.scala +++ b/app/models/database/FRM.scala @@ -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") @@ -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") { diff --git a/app/models/entities/Entities.scala b/app/models/entities/Entities.scala index 13f0233..3d1446c 100644 --- a/app/models/entities/Entities.scala +++ b/app/models/entities/Entities.scala @@ -636,6 +636,7 @@ object Entities { stats: CredSetRowStats, bioFeature: Option[String], pehotypeId: Option[String], + geneId: Option[String], dataType: String ) diff --git a/app/models/gql/GQLSchema.scala b/app/models/gql/GQLSchema.scala index 3773e4b..daf16cc 100644 --- a/app/models/gql/GQLSchema.scala +++ b/app/models/gql/GQLSchema.scala @@ -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, @@ -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) @@ -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) ) ), diff --git a/example_queries.txt b/example_queries.txt index 673116f..1cb1c06 100644 --- a/example_queries.txt +++ b/example_queries.txt @@ -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 @@ -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