From ad70d502de915e68ed64d5a2d459e9ea81fa3c33 Mon Sep 17 00:00:00 2001
From: Holger Brandl <holgerbrandl@gmail.com>
Date: Tue, 15 Mar 2016 17:25:58 +0100
Subject: [PATCH] cont pe-aligner wrapper

---
 dge_workflow/star_align.kts | 28 +++++++++++-----------------
 1 file changed, 11 insertions(+), 17 deletions(-)

diff --git a/dge_workflow/star_align.kts b/dge_workflow/star_align.kts
index dc74104..9ece376 100755
--- a/dge_workflow/star_align.kts
+++ b/dge_workflow/star_align.kts
@@ -1,28 +1,21 @@
 #!/usr/bin/env kscript
-//DEPS org.docopt:docopt:0.6.0-SNAPSHOT de.mpicbg.scicomp:joblist:0.6-SNAPSHOT de.mpicbg.scicomp.bioinfo:kutils:0.1-SNAPSHOT
+//DEPS org.docopt:docopt:0.6.0-SNAPSHOT de.mpicbg.scicomp:joblist_2.11:0.6-SNAPSHOT de.mpicbg.scicomp.bioinfo:kutils:0.1-SNAPSHOT
 
 // add docopts to local m2 index
 // git clone https://github.com/docopt/docopt.java  && cd docopt.java && mvn clean package install  -Dmaven.test.skip=true
 // kotlinc-jvm -classpath $(mvncp org.docopt:docopt:0.6.0-SNAPSHOT)
 
-// update joblist
-// cd ~/mnt/mack/bioinfo/holger/misc/Dropbox/cluster_sync/joblist/
-
-
 import joblist.JobConfiguration
 import joblist.JobList
 import kutils.bashEval
 import org.docopt.Docopt
 import java.io.File
-import java.util.*
 
 //val args = listOf("/projects/bioinfo/igenomes/Drosophila_melanogaster/Ensembl/BDGP6", "test.fastq.gz")
 
 
 // basic usage tutorial
 // http://www.homolog.us/blogs/blog/2012/11/02/star-really-kick-ass-rna-seq-aligner/
-
-
 // https://www.biostars.org/p/91020/
 
 val usage = """
@@ -30,37 +23,38 @@ Use star to align fastq files against a genome
 Usage: star_align.sh [options] <igenome> <fastq_files>...
 
 Options:
---gtf <gtfFile>     Custom gtf file instead of igenome bundled copy
---pc-only           Use protein coding genes only for mapping and quantification
+ --gtf <gtfFile>     Custom gtf file instead of igenome bundled copy
+ --pc-only           Use protein coding genes only for mapping and quantification
 """
 
 
+
 val doArgs = Docopt(usage).parse(args.toList()).map {
     it.key.removePrefix("--").replace("[<>]", "") to it.value?.toString()
 }.toMap()
 
 
-println(Objects.toString(1))
-println(Objects.nonNull(true))
-
-
 // extract all configuration parameters
 val fastqFiles = (doArgs["fastq_files"] as String).split(" ").map { File(it) }
 val igenome = File(doArgs["igenome"])
 val star_index = File(igenome, "Sequence/StarIndex")
 val gtfFile = if (doArgs["gtfFile"] != null) File(doArgs["gtfFile"]) else File(igenome, "Annotation/Genes/genes.gtf")
 
-// check if gtf file exists
-if (!gtfFile.isFile()) throw IllegalArgumentException("gtf '${gtfFile}' does not exist")
+
 
 // make sure that STAR is in the PATH
-if (bashEval("which STAR").exitCode != 0) throw IllegalArgumentException("gtf '${gtfFile}' does not exist")
+if (bashEval("which STAR").exitCode != 0) throw IllegalArgumentException("STAR aligner is not in PATH")
+
+
+// check if gtf file exists
+if (!gtfFile.isFile()) throw IllegalArgumentException("gtf '${gtfFile}' does not exist")
 
 // Check if STAR index is not present
 if (!File("${star_index}/SA").isFile())
     throw IllegalArgumentException("Missing STAR for ${star_index}/SA; use 'dge_create_star_index ${igenome}' to create it")
 //   dge_create_star_index ${igenome}'
 
+
 println("running STAR using igenome '${igenome}' for the following files")
 
 val jl = JobList(".starjobs")
-- 
GitLab