diff --git a/app/models/Backend.scala b/app/models/Backend.scala index 217db14f..5773d9c0 100644 --- a/app/models/Backend.scala +++ b/app/models/Backend.scala @@ -673,14 +673,6 @@ class Backend @Inject() (implicit dbRetriever.executeQuery[OtarProjects, Query](query.query) } - def getExpressions(ids: Seq[String]): Future[IndexedSeq[Expressions]] = { - val tableName = getTableWithPrefixOrDefault(defaultOTSettings.clickhouse.expression.name) - val localMarkerContext = markerContext.fromExistingContext(append("table", tableName)) - logger.debug(s"querying expressions for the ids ${ids.mkString(",")}")(localMarkerContext) - val expressionQuery = IdsQuery(ids, "id", tableName, 0, Pagination.sizeMax) - dbRetriever.executeQuery[Expressions, Query](expressionQuery.query) - } - def getBaselineExpression(targetId: String, pagination: Option[Pagination] ): Future[BaselineExpression] = { diff --git a/app/models/entities/Expressions.scala b/app/models/entities/Expressions.scala index 004dee3c..50d80ce7 100644 --- a/app/models/entities/Expressions.scala +++ b/app/models/entities/Expressions.scala @@ -14,44 +14,6 @@ case class CellType(reliability: Boolean, name: String, level: Int) case class ProteinExpression(reliability: Boolean, level: Int, cellType: Seq[CellType]) -case class Expression(tissue: Tissue, rna: RNAExpression, protein: ProteinExpression) - -case class Expressions(id: String, rows: Seq[Expression]) - -object Expressions { - implicit val getExpressionsResult: GetResult[Expressions] = - GetResult(fromPositionedResult[Expressions]) - implicit val tissueW: OWrites[Tissue] = Json.writes[Tissue] - implicit val rnaExpressionW: OWrites[RNAExpression] = Json.writes[RNAExpression] - implicit val cellTypeW: OWrites[CellType] = Json.writes[CellType] - implicit val proteinExpressionW: OWrites[ProteinExpression] = Json.writes[ProteinExpression] - implicit val expressionW: OWrites[Expression] = Json.writes[Expression] - implicit val expressionsW: OWrites[Expressions] = Json.writes[Expressions] - - implicit val tissueR: Reads[Tissue] = ( - (__ \ "efo_code").read[String] and - (__ \ "label").read[String] and - (__ \ "anatomical_systems").read[Seq[String]] and - (__ \ "organs").read[Seq[String]] - )(Tissue.apply) - - implicit val rnaExpressionR: Reads[RNAExpression] = Json.reads[RNAExpression] - implicit val cellTypeR: Reads[CellType] = Json.reads[CellType] - implicit val proteinExpressionR: Reads[ProteinExpression] = Json.reads[ProteinExpression] - - implicit val expressionR: Reads[Expression] = ( - __.read[Tissue] and - (__ \ "rna").read[RNAExpression] and - (__ \ "protein").read[ProteinExpression] - )(Expression.apply) - - implicit val expressionsR: Reads[Expressions] = - ( - (__ \ "id").read[String] and - (__ \ "tissues").readWithDefault[Seq[Expression]](Seq.empty) - )(Expressions.apply) -} - case class BaselineExpressionRow( targetId: String, targetFromSourceId: Option[String], diff --git a/app/models/gql/DeferredResolvers.scala b/app/models/gql/DeferredResolvers.scala index 97f546f7..c10adda8 100644 --- a/app/models/gql/DeferredResolvers.scala +++ b/app/models/gql/DeferredResolvers.scala @@ -286,7 +286,6 @@ object DeferredResolvers extends OTLogging { Fetchers.drugWarningsFetcher, Fetchers.diseasesFetcher, Fetchers.hposFetcher, - Fetchers.expressionFetcher, Fetchers.mechanismsOfActionFetcher, Fetchers.mousePhenotypesFetcher, Fetchers.otarProjectsFetcher, diff --git a/app/models/gql/Fetchers.scala b/app/models/gql/Fetchers.scala index 025e6ecc..01a49903 100644 --- a/app/models/gql/Fetchers.scala +++ b/app/models/gql/Fetchers.scala @@ -7,7 +7,6 @@ import models.entities.{ Disease, Drug, DrugWarnings, - Expressions, GeneOntologyTerm, HPO, MechanismsOfAction, @@ -103,13 +102,6 @@ object Fetchers extends OTLogging { fetch = (ctx: Backend, ids: Seq[String]) => ctx.getDiseases(ids) ) - implicit val expressionHasId: HasId[Expressions, String] = HasId[Expressions, String](_.id) - val expressionFetcher: Fetcher[Backend, Expressions, Expressions, String] = Fetcher( - config = - FetcherConfig.maxBatchSize(entities.Configuration.batchSize).caching(cacheFor("expression")), - fetch = (ctx: Backend, ids: Seq[String]) => ctx.getExpressions(ids) - ) - implicit val mechanismsOfActionHasId: HasId[MechanismsOfAction, String] = HasId[MechanismsOfAction, String](_.chemblId) val mechanismsOfActionFetcher: Fetcher[Backend, MechanismsOfAction, MechanismsOfAction, String] = diff --git a/app/models/gql/Objects.scala b/app/models/gql/Objects.scala index a9aff4d9..b3217fe3 100644 --- a/app/models/gql/Objects.scala +++ b/app/models/gql/Objects.scala @@ -321,18 +321,6 @@ object Objects extends OTLogging { case None => Seq.empty } ), - Field( - "expressions", - ListType(expressionImp), - description = Some( - "Baseline RNA and protein expression data across tissues for this target. Expression data shows how targets are selectively expressed across different tissues and biosamples, combining values from multiple sources including Expression Atlas and Human Protein Atlas." - ), - resolve = r => - DeferredValue(expressionFetcher.deferOpt(r.value.id)).map { - case Some(expressions) => expressions.rows - case None => Seq.empty - } - ), Field( "baselineExpression", baselineExpressionImp, @@ -912,25 +900,6 @@ object Objects extends OTLogging { DocumentField("level", "Level of protein expression normalised to 0-5 or -1 if absent"), DocumentField("cellType", "List of cell types were protein levels were measured") ) - implicit val expressionImp: ObjectType[Backend, Expression] = - deriveObjectType[Backend, Expression]( - ObjectTypeDescription( - "Array of structs containing expression data relevant to a particular gene and biosample combination" - ), - DocumentField("tissue", "Tissue/biosample information for the expression data"), - DocumentField("rna", "RNA expression values for the biosample and gene combination"), - DocumentField("protein", "Protein expression values for the biosample and gene combination") - ) - implicit val expressionsImp: ObjectType[Backend, Expressions] = - deriveObjectType[Backend, Expressions]( - ObjectTypeDescription( - "Baseline RNA and protein expression data across tissues for a target gene" - ), - ExcludeFields("id"), - DocumentField("rows", - "Array of structs containing expression data relevant to a particular gene" - ) - ) implicit lazy val baselineExpressionRowImp: ObjectType[Backend, BaselineExpressionRow] = deriveObjectType[Backend, BaselineExpressionRow]( ReplaceField(