Commit 459d68dc authored by Wai Yi Leung's avatar Wai Yi Leung
Browse files

Merge branch 'feature-docs-0.6.0' of into feature-docs-0.6.0

parents d1df33e7 5103109c
......@@ -155,4 +155,46 @@ Since our pipeline is called `HelloPipeline`, the root of the configoptions will
### Summary output
Any pipeline that mixes in `SummaryQscript` will produce a summary json.
This summary json usually contains statistics and some output results.
By mixing in `SummaryQscript`, the new pipeline needs to implement three functions:
1. `summaryFile: File`
2. `summaryFiles: Map[String, File]`
3. `summarySettings: Map[String, Any]`
Of those three, `summaryFile` is the most important one, and should point to the file where the summary will be written to.
The `summaryFiles` function should contain any extra files one would like to add to the summary.
Files are listed in a separate `files` JSON object, and will by default include any executables used in the pipelines.
The `summarySettings` function should contain any extra settings one would like to add to the summary.
Settings are listed in a separate `settings` JSON object.
Apart from these fields, the summary JSON will be populated with statistics from tool extensions that mix in `Summarizable`.
To populate these statistics, one has to call `addSummarizable` on the tool.
For instance, let's go back to the `fastqc` example. The original declaration was:
val fastqc = new Fastqc(this)
fastqc.fastqfile = config("fastqc_input")
fastqc.output = new File(outputDir, "fastqc.txt")
// change kmers settings to 9, wrap with `Some()` because `fastqc.kmers` is a `Option` value.
fastqc.kmers = Some(9)
To add the fastqc summary to our summary JSON all we have to do is write the following line afterwards:
Summary statistics for fastqc will then end up in a `stats` JSON object in the summary.
See the [tool tutorial]( for how to make a tool extension produce any summary output.
### Reporting output (optional)
\ No newline at end of file
......@@ -210,4 +210,30 @@ object SimpleTool {
### Summary setup (for reporting results to JSON)
Any tool extension can create summary output for use within a larger pipeline.
To accomplish this, it first has to mix in the `Summarizable` trait.
Once that its done, it must implement the following functions:
1. `summaryFiles: Map[String, File]`
2. `summaryStats: Map[String, Any]`
The first of these can contain any files one wishes to include into the summary, but can be just an empty map.
The second function, `summaryStats`, should create a map of statistics.
This function is only executed after the tool has completed running, and it is therefore possible to extract values from the output.
Suppose, that our tool simply creates a file that lists the amount of lines in the input file.
We could then extract this value, and store it in the summary through the `summaryStats` function.
This would look like the following:
def summaryStats: Map[String, Any] = {
Map("count" -> Source.fromFile(output).getLines.head.toInt)
See the [pipeline tutorial]( for how to use these statistics in a pipeline.
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