From 73387e3b2ee22c06a7425263c30f22b8b6614624 Mon Sep 17 00:00:00 2001 From: Miguel C Date: Mon, 11 Mar 2019 15:14:59 +0000 Subject: [PATCH] fix: gecko builds now correctly after improve aggregation and swap tag vs index as it was confused --- app/models/Backend.scala | 17 +++++++++++++++-- app/models/Entities.scala | 4 ++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/app/models/Backend.scala b/app/models/Backend.scala index 9d6bf02..cf802ad 100644 --- a/app/models/Backend.scala +++ b/app/models/Backend.scala @@ -493,11 +493,24 @@ class Backend @Inject()(@NamedDatabase("default") protected val dbConfigProvider ((r.leadPosition >= start) && (r.leadPosition <= end)) || ((r.tagPosition >= start) && (r.tagPosition <= end)) || (r.geneId in geneIdsInLoci) - )).map(_.geckoRow).distinct + )).groupBy(r => (r.studyId, r.leadVariant, r.tagVariant, r.geneId)) + .map {case (g, q) => + g -> (q.map(_.r2).any, + q.map(_.log10Abf).any, + q.map(_.posteriorProbability).any, + q.map(_.pval).any, + q.map(_.pvalExponent).any, + q.map(_.pvalMantissa).any, + q.map(_.overallScore).any)} db.run(geneIdsInLoci.result.asTry zip assocsQ.result.asTry).map { case (Success(geneIds), Success(assocs)) => - Entities.Gecko(assocs.view, geneIds.toSet) + val geckoRows = assocs.view + .map(r => GeckoRow(r._1._4, r._1._3, r._1._2, r._1._1, + V2DAssociation(r._2._4.get, r._2._5.get, r._2._6.get, r._2._1, r._2._2, r._2._3, + None, None, None, None, None), + r._2._7.getOrElse(0D))) + Entities.Gecko(geckoRows, geneIds.toSet) case (Success(geneIds), Failure(asscsEx)) => logger.error(asscsEx.getMessage) diff --git a/app/models/Entities.scala b/app/models/Entities.scala index 70854d6..ac75325 100644 --- a/app/models/Entities.scala +++ b/app/models/Entities.scala @@ -94,8 +94,8 @@ object Entities { val lVID = line.indexVariant.id val tVID = line.tagVariant.id geneIds += line.geneId - tagVariants += lVID - indexVariants += tVID + tagVariants += tVID + indexVariants += lVID studies += line.studyId geneTagVariants += GeneTagVariant(line.geneId, tVID, line.overallScore) tagVariantIndexVariantStudies += TagVariantIndexVariantStudy(tVID, lVID,