diff --git a/app/controllers/HomeController.scala b/app/controllers/HomeController.scala
index 71b363e..4f41082 100644
--- a/app/controllers/HomeController.scala
+++ b/app/controllers/HomeController.scala
@@ -3,8 +3,9 @@ package controllers
import akka.stream.scaladsl.{Source, StreamConverters}
import akka.util.ByteString
import daos.MassSpectrometryFileDAO
-import fr.inrae.metabolomics.p2m2.format.{GenericP2M2, MassSpectrometryResultSet, MassSpectrometryResultSetFactory}
-import fr.inrae.metabolomics.p2m2.parser._
+import fr.inrae.metabolomics.p2m2.format.MassSpectrometryResultSetFactory
+import fr.inrae.metabolomics.p2m2.format.ms.{GCMS, GenericP2M2, MassSpectrometryResultSet, OpenLabCDS, QuantifyCompoundSummaryReportMassLynx, QuantifySampleSummaryReportMassLynx, Xcalibur}
+import fr.inrae.metabolomics.p2m2.parser.{GCMSParser, OpenLabCDSParser, ParserManager, QuantifySummaryReportMassLynxParser, XcaliburXlsParser}
import fr.inrae.metabolomics.p2m2.stream.ExportData
import models.MassSpectrometryFile
import play.api.http.HttpEntity
@@ -62,7 +63,7 @@ class HomeController @Inject()(
val information = s"($filename,$fileSize,$contentType)" +
"
\\n \n nGCMSParser:"+GCMSParser.sniffFile(s"/tmp/$filename") +
"
OpenLabCDSParser:"+OpenLabCDSParser.sniffFile(s"/tmp/$filename") +
- "
QuantifyCompoundSummaryReportMassLynxParser:"+QuantifyCompoundSummaryReportMassLynxParser.sniffFile(s"/tmp/$filename") +
+ "
QuantifyCompoundSummaryReportMassLynxParser:"+QuantifySummaryReportMassLynxParser.sniffFile(s"/tmp/$filename") +
"
XcaliburXlsParser:"+XcaliburXlsParser.sniffFile(s"/tmp/$filename")
val ms : Option[MassSpectrometryResultSet] = ParserManager.buildMassSpectrometryObject(s"/tmp/$filename")
@@ -125,4 +126,19 @@ class HomeController @Inject()(
}
}
+ def preview_file(idMsFile : Long) : Action[AnyContent] = Action.async {
+ msfiles.findById(idMsFile) map {
+ case Some(s) => MassSpectrometryResultSetFactory.build(s.fileContent) match {
+ case Some (obj: GCMS) => Ok (views.html.preview_GCMS (obj) )
+ case Some (obj: OpenLabCDS) => Ok (views.html.preview_OpenLabCDS(obj) )
+ case Some (obj: QuantifyCompoundSummaryReportMassLynx) =>
+ Ok (views.html.preview_QuantifyCompoundSummaryReportMassLynx(obj) )
+ case Some (obj: Xcalibur) => Ok (views.html.preview_Xcalibur(obj) )
+ case None => Ok (s"can not convert string to type [${s.fileContent}]")
+ case _ => Ok (s"can not preview file [id:$idMsFile]")
+ }
+ case None => Ok (s"Can not find Id file [id:$idMsFile]")
+ }
+ }
+
}
diff --git a/app/daos/MassSpectrometryFileDAO.scala b/app/daos/MassSpectrometryFileDAO.scala
index bd2412d..e7dfc86 100644
--- a/app/daos/MassSpectrometryFileDAO.scala
+++ b/app/daos/MassSpectrometryFileDAO.scala
@@ -1,6 +1,7 @@
package daos
-import fr.inrae.metabolomics.p2m2.format.{GenericP2M2, MassSpectrometryResultSetFactory}
+import fr.inrae.metabolomics.p2m2.format.MassSpectrometryResultSetFactory
+import fr.inrae.metabolomics.p2m2.format.ms.GenericP2M2
import scala.concurrent.{ExecutionContext, Future}
import javax.inject.Inject
@@ -18,10 +19,14 @@ class MassSpectrometryFileDAO @Inject()
import profile.api._
- def findAll(): Seq[MassSpectrometryFile] = ???
- def findById(id: String) : MassSpectrometryFile = ???
+ def findById(id: Long) : Future[Option[MassSpectrometryFile]] =
+ db.run(TableQuery[MassSpectrometryFileTable].filter(_.id === id).result).map {
+ case l if l.nonEmpty => Some(l.last)
+ case _ => None
+ }
- def all(): Future[Seq[MassSpectrometryFile]] = db.run(TableQuery[MassSpectrometryFileTable].result)
+ def all(): Future[Seq[MassSpectrometryFile]] =
+ db.run(TableQuery[MassSpectrometryFileTable].result)
def getMergeGenericP2M2() : Future[GenericP2M2] = {
all().map {
diff --git a/app/views/importMassSpectrometryFile.scala.html b/app/views/importMassSpectrometryFile.scala.html
index 419e37e..e8fd127 100644
--- a/app/views/importMassSpectrometryFile.scala.html
+++ b/app/views/importMassSpectrometryFile.scala.html
@@ -17,7 +17,7 @@
@for(msFile <- listMSFiles ) {
@msFile.id |
- @msFile.name |
+ @msFile.name |
@msFile.className |
delete |
diff --git a/app/views/preview.scala.html b/app/views/preview.scala.html
index 9e5957a..8b7d031 100644
--- a/app/views/preview.scala.html
+++ b/app/views/preview.scala.html
@@ -1,4 +1,4 @@
-@import fr.inrae.metabolomics.p2m2.format.GenericP2M2
+@import fr.inrae.metabolomics.p2m2.format.ms.GenericP2M2
@(obj : GenericP2M2)
@main("Merge all results file (preview)") {
@@ -10,7 +10,7 @@
- @for(values <- obj.values) {
+ @for(values <- obj.samples) {
@for(header <- GenericP2M2.HeaderField.values.toSeq) {
@values.get(header) |
diff --git a/app/views/preview_GCMS.scala.html b/app/views/preview_GCMS.scala.html
new file mode 100644
index 0000000..c4ae28e
--- /dev/null
+++ b/app/views/preview_GCMS.scala.html
@@ -0,0 +1,38 @@
+@**************************************
+* GCMS preview page. *
+* *
+* @ob The GCMS information to display *
+**************************************@
+
+@import fr.inrae.metabolomics.p2m2.format.ms._
+@import fr.inrae.metabolomics.p2m2.parser.ParserUtils
+
+@(obj : GCMS)
+@main("GCMS preview") {
+Header
+
+ @for(header <- GCMS.HeaderFileField.values.toSeq) {
+
+ @ParserUtils.toString(header) |
+ @obj.header.get(header) |
+
+ }
+
+
+Results
+
+
+
+ @for(header <- GCMS.HeaderField.values.toSeq) {
+ @ParserUtils.toString(header) |
+ }
+
+ @for(entry <- obj.msQuantitativeResults) {
+
+ @for(header <- GCMS.HeaderField.values.toSeq) {
+ @entry.get(header) |
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/app/views/preview_OpenLabCDS.scala.html b/app/views/preview_OpenLabCDS.scala.html
new file mode 100644
index 0000000..8d19766
--- /dev/null
+++ b/app/views/preview_OpenLabCDS.scala.html
@@ -0,0 +1,38 @@
+@********************************************
+* OpenLabCDS preview page. *
+* *
+* @ob The OpenLabCDS information to display *
+*********************************************@
+
+@import fr.inrae.metabolomics.p2m2.format.ms._
+@import fr.inrae.metabolomics.p2m2.parser.ParserUtils
+
+@(obj : OpenLabCDS)
+@main("OpenLabCDS preview") {
+Header
+
+ @for(header <- OpenLabCDS.HeaderFileField.values.toSeq) {
+
+ @ParserUtils.toString(header) |
+ @obj.header.get(header) |
+
+ }
+
+
+Results
+
+
+
+ @for(header <- OpenLabCDS.HeaderField.values.toSeq) {
+ @ParserUtils.toString(header) |
+ }
+
+ @for(entry <- obj.results) {
+
+ @for(header <- OpenLabCDS.HeaderField.values.toSeq) {
+ @entry.get(header) |
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/app/views/preview_QuantifyCompoundSummaryReportMassLynx.scala.html b/app/views/preview_QuantifyCompoundSummaryReportMassLynx.scala.html
new file mode 100644
index 0000000..42012f5
--- /dev/null
+++ b/app/views/preview_QuantifyCompoundSummaryReportMassLynx.scala.html
@@ -0,0 +1,41 @@
+@***********************************************************************
+* QuantifyCompoundSummaryReportMassLynx preview page. *
+* *
+* @ob The QuantifyCompoundSummaryReportMassLynx information to display *
+************************************************************************@
+
+@import fr.inrae.metabolomics.p2m2.format.ms._
+@import fr.inrae.metabolomics.p2m2.parser.ParserUtils
+
+@(obj : QuantifyCompoundSummaryReportMassLynx)
+@main("QuantifyCompoundSummaryReportMassLynx preview") {
+Header
+
+
+ Printed Date |
+ @obj.header.dateStr |
+
+
+
+
+Results
+
+
+ - |
+ @for(header <- QuantifyCompoundSummaryReportMassLynx.HeaderField.values.toSeq) {
+ @ParserUtils.toString(header) |
+ }
+
+ @for(entry <- obj.resultsByCompound) {
+ @for(values <- entry._2) {
+
+ @entry._1 |
+ @for(header <- QuantifyCompoundSummaryReportMassLynx.HeaderField.values.toSeq) {
+ @values.get(header) |
+ }
+
+ }
+ }
+
+
+}
\ No newline at end of file
diff --git a/app/views/preview_Xcalibur.scala.html b/app/views/preview_Xcalibur.scala.html
new file mode 100644
index 0000000..9319f40
--- /dev/null
+++ b/app/views/preview_Xcalibur.scala.html
@@ -0,0 +1,46 @@
+@********************************************
+* Xcalibur preview page. *
+* *
+* @ob The Xcalibur information to display *
+*********************************************@
+
+@import fr.inrae.metabolomics.p2m2.format.ms._
+@import fr.inrae.metabolomics.p2m2.parser.ParserUtils
+
+@(obj : Xcalibur)
+@main("Xcalibur preview") {
+Sheets
+
+ @for(sheet <- obj.results) {
+ Header
+
+ @for(header <- Xcalibur.HeaderSheetField.values.toSeq) {
+
+ @ParserUtils.toString(header) |
+ @sheet.compoundInformationHeader.get(header) |
+
+ }
+
+
+ Results
+
+
+ @for(header <- Xcalibur.HeaderField.values.toSeq) {
+ @ParserUtils.toString(header) |
+ }
+
+ @for(values <- sheet.compoundByInjection) {
+
+ @for(header <- Xcalibur.HeaderField.values.toSeq) {
+ @values.get(header) |
+ }
+
+ }
+
+
+ }
+
+
+
+
+}
\ No newline at end of file
diff --git a/build.sbt b/build.sbt
index 494c77a..ea7247c 100644
--- a/build.sbt
+++ b/build.sbt
@@ -9,9 +9,9 @@ scalaVersion := "2.13.8"
libraryDependencies ++= Seq(
guice,
- "com.github.p2m2" %% "p2m2tools" % "develop-SNAPSHOT" changing(),
- "com.typesafe.play" %% "play-slick" % "5.0.2",
- "com.typesafe.play" %% "play-slick-evolutions" % "5.0.2",
+ "com.github.p2m2" %% "p2m2tools" % "0.2.0" changing(),
+ "com.typesafe.play" %% "play-slick" % "5.1.0",
+ "com.typesafe.play" %% "play-slick-evolutions" % "5.1.0",
"com.h2database" % "h2" % "2.1.214",
"org.scalatestplus.play" %% "scalatestplus-play" % "5.1.0" % Test
)
diff --git a/conf/routes b/conf/routes
index aa322a4..4dc3a61 100644
--- a/conf/routes
+++ b/conf/routes
@@ -11,6 +11,7 @@ GET /importMSF controllers.HomeController.importMassSpectrom
POST /upload controllers.HomeController.upload()
GET /delete/:idMsFileLong controllers.HomeController.delete(idMsFileLong : Long)
GET /preview controllers.HomeController.preview()
+GET /preview_file/:idMsFileLong controllers.HomeController.preview_file(idMsFileLong : Long)
GET /clean controllers.HomeController.clean()
GET /exportXLS controllers.HomeController.exportXLS()
# Map static resources from the /public folder to the /assets URL path