Commit 190b961c authored by bow's avatar bow
Browse files

Merge branch 'patch-sampletsvtojson' into 'develop'

Patch sampletsvtojson

Fix for #117

See merge request !102
parents ce4d4d49 768b11d5
......@@ -21,6 +21,9 @@ import scala.io.Source
import nl.lumc.sasc.biopet.core.config.Config
import nl.lumc.sasc.biopet.utils.ConfigUtils._
/**
* This tool can convert a tsv to a json file
*/
object SamplesTsvToJson extends ToolCommand {
case class Args(inputFiles: List[File] = Nil) extends AbstractArgs
......@@ -29,13 +32,18 @@ object SamplesTsvToJson extends ToolCommand {
c.copy(inputFiles = x :: c.inputFiles)
} text ("Input must be a tsv file, first line is seen as header and must at least have a 'sample' column, 'library' column is optional, multiple files allowed")
}
/**
* Executes SamplesTsvToJson
* @param args
*/
def main(args: Array[String]): Unit = {
val argsParser = new OptParser
val commandArgs: Args = argsParser.parse(args, Args()) getOrElse sys.exit(1)
val fileMaps = for (inputFile <- commandArgs.inputFiles) yield {
val reader = Source.fromFile(inputFile)
val lines = reader.getLines.toList
val lines = reader.getLines.toList.filter(!_.isEmpty)
val header = lines.head.split("\t")
val sampleColumn = header.indexOf("sample")
val libraryColumn = header.indexOf("library")
......
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