#!/bin/sh exec scalas "$0" "$@" !# /** Work in progress: Guess the species from a gtf file. By name first and then by file content. A more simplistic approach is already implementd in dge_workflow/dge_utils.sh */ import java.io.File import scala.io.Source // http://alvinalexander.com/scala/scala-shell-script-command-line-arguments-args val gtfFile = args(1) //val gtfFile="mm10_igenomes_pc.gtf" val pattern = "mm10|mm9|h19|zv9".r val genomeByName = pattern.findFirstIn(gtfFile) if (genomeByName.isEmpty) { System.exit(1) } def guessFromContent(gtfFile: File): Option[String] = { // Source.fromString(s"grep ENSMUSG $gtfFile | "!!).getLines().hasNext // Bash.evalCapture(s"grep ENSMUSG $gtfFile | wc -l") if (Source.fromFile(gtfFile).getLines().exists(_.contains("ENSMUSG"))) return Some("mouse") if (Source.fromFile(gtfFile).getLines().exists(_.contains("ENSCAFG"))) return Some("dog") None } genomeByName.get match { case "mm9" => } println(genomeByName)