Commit e63a296e authored by Romain Reuillon's avatar Romain Reuillon
Browse files

Merge branch '9-dev' of github.com:openmole/openmole into 9-dev

parents 637da3eb b3bb94e6
......@@ -342,7 +342,7 @@ object TreeNodeTab {
def toView(newMode: PlotMode) = {
val (seqs, ax) = newMode match {
case SplomMode (initialSequence, axis)
case SplomMode (initialSequence, axis.take(5))
case HeatMapMode=> (sequence.now, 0 to sequence.now.header.size -1)
case _ (sequence.now, axis.take(2))
}
......
......@@ -15,11 +15,10 @@ object HeatMapPlot {
lazy val plotDiv = Plot.baseDiv
val dims = serie.values
val nbDims = dims.length
val dims = serie.values.map { _.values.reverse }.transpose
val data = PlotData
.z(dims.map { _.values.toJSArray }.toJSArray)
.z(dims.map { _.toJSArray }.toJSArray)
.set(plotlytype.heatmap)
val layout = Layout
......
......@@ -194,8 +194,8 @@ object BatchEnvironment extends JavaLogger {
serializerService.serialize(job.runnableTasks, jobFile)
val plugins = new TreeSet[File]()(fileOrdering) ++ job.plugins -- job.environment.plugins
val files = (new TreeSet[File]()(fileOrdering) ++ job.files) diff plugins
val plugins = new TreeSet[File]()(fileOrdering) ++ job.plugins -- job.environment.plugins ++ (job.files.toSet & job.environment.plugins.toSet)
val files = (new TreeSet[File]()(fileOrdering) ++ job.files) -- plugins
val runtime = replicateTheRuntime(job.job, job.environment, replicate)
......
......@@ -38,6 +38,7 @@ class Activator extends PluginInfoActivator {
Hook(classOf[AppendToFileHook]),
Hook(classOf[CopyFileHook]),
Hook(classOf[SaveHook]),
Hook(classOf[MatrixHook]),
Hook("CSVHook")
)
......
package org.openmole.plugin.hook.file
import monocle.macros.Lenses
import org.openmole.core.context.Context
import org.openmole.core.dsl._
import org.openmole.core.expansion._
import org.openmole.core.workflow.builder._
import org.openmole.core.workflow.mole._
import org.openmole.core.workflow.validation._
import scala.annotation.implicitNotFound
object MatrixHook {
implicit def isIO: InputOutputBuilder[MatrixHook] = InputOutputBuilder(MatrixHook.config)
implicit def isInfo = InfoBuilder(info)
object ToMatrix {
def apply[T](f: T Iterator[String]) = new ToMatrix[T] {
def apply(t: T) = f(t)
}
implicit def arrayInt = ToMatrix[Array[Int]] { a a.toIterator.map(_.toString) }
implicit def arrayDouble = ToMatrix[Array[Double]] { a a.toIterator.map(_.toString) }
implicit def arrayLong = ToMatrix[Array[Long]] { a a.toIterator.map(_.toString) }
implicit def arrayArrayInt = ToMatrix[Array[Array[Int]]] { a a.toIterator.map(_.mkString(",")) }
implicit def arrayArrayLong = ToMatrix[Array[Array[Long]]] { a a.toIterator.map(_.mkString(",")) }
implicit def arrayArrayDouble = ToMatrix[Array[Array[Double]]] { a a.toIterator.map(_.mkString(",")) }
}
@implicitNotFound("${T} is not a matrix")
trait ToMatrix[T] {
def apply(t: T): Iterator[String]
}
case class MatrixObject[T](prototype: Val[T], toMatrix: ToMatrix[T]) {
def apply(context: Context) = toMatrix(context(prototype))
}
def apply[T](file: FromContext[File], matrix: Val[T])(implicit name: sourcecode.Name, definitionScope: DefinitionScope, toMatrix: ToMatrix[T]) =
new MatrixHook(
file = file,
matrix = MatrixObject[T](matrix, toMatrix),
config = InputOutputConfig(),
info = InfoConfig()
)
}
@Lenses case class MatrixHook(
file: FromContext[File],
matrix: MatrixHook.MatrixObject[_],
config: InputOutputConfig,
info: InfoConfig) extends Hook with ValidateHook {
override def validate(inputs: Seq[Val[_]]) = Validate { p
import p._
file.validate(inputs)
}
override protected def process(executionContext: MoleExecutionContext) = FromContext { parameters
import parameters._
val f = file.from(context)
f.createParentDir
f.content = ""
for {
line matrix(context)
} f.append(line + "\n")
context
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment