Commit ad70d502 authored by Holger Brandl's avatar Holger Brandl

cont pe-aligner wrapper

parent 53b1a7a1
#!/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")
......
Markdown is supported
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