Skip to content

Commit

Permalink
accommodate ENCODE TAR files with internal names differing from the T…
Browse files Browse the repository at this point in the history
…AR name
  • Loading branch information
hpratt committed May 25, 2020
1 parent 4348c38 commit ff913d3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
}

group = "com.genomealmanac.rnaseq"
version = "1.0.5"
version = "1.0.6"
val artifactID = "rsem"

repositories {
Expand Down
4 changes: 3 additions & 1 deletion src/main/kotlin/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class Cli : CliktCommand() {
private val cores: Int by option("--cores", help = "number of cores available to the task").int().default(1)
private val ram: Int by option("--ram-gb", help = "amount of RAM available to the task, in GB").int().default(16)
private val indexTarPrefix: String? by option("--index-tar-prefix", help = "the root directory of files in the index tar archive")
private val indexNamePrefix: String? by option("--index-name-prefix", help = "prefix of the name of the files in the index tar archive")

override fun run() {
DefaultCmdRunner().runRSEMQuant(
Expand All @@ -40,7 +41,8 @@ class Cli : CliktCommand() {
outputDirectory = outputDirectory,
cores = cores,
ram = ram,
indexTarPrefix = indexTarPrefix
indexTarPrefix = indexTarPrefix,
indexNamePrefix = indexNamePrefix
)
)
}
Expand Down
6 changes: 4 additions & 2 deletions src/main/kotlin/step/rsemquant.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ data class RSEMParameters (
val ram: Int = 16,
val outputPrefix: String = "output",
val pairedEnd: Boolean,
val indexTarPrefix: String? = null
val indexTarPrefix: String? = null,
val indexNamePrefix: String? = null
)

val FORWARD_PROB: Map<String, Float> = mapOf(
Expand All @@ -31,6 +32,7 @@ fun CmdRunner.runRSEMQuant(parameters: RSEMParameters) {
// create output directory, unpack index
this.run("tar xvf ${parameters.index} -C ${parameters.outputDirectory}")
if (parameters.indexTarPrefix !== null) this.run("mv ${parameters.outputDirectory}/${parameters.indexTarPrefix}/* ${parameters.outputDirectory}")
val indexNamePrefix = if (parameters.indexNamePrefix !== null) parameters.indexNamePrefix else parameters.index.getFileName().toString().split(".tar.gz")[0]

// run RSEM
this.run("""
Expand All @@ -45,7 +47,7 @@ fun CmdRunner.runRSEMQuant(parameters: RSEMParameters) {
--forward-prob ${FORWARD_PROB[parameters.strand]} \
${ if (parameters.pairedEnd) "--paired-end" else "" } \
${parameters.bam} \
${parameters.outputDirectory.resolve(parameters.index.getFileName().toString().split(".tar.gz")[0])} \
${parameters.outputDirectory.resolve(indexNamePrefix)} \
${parameters.outputDirectory.resolve("${parameters.outputPrefix}")}
""")

Expand Down

0 comments on commit ff913d3

Please sign in to comment.