Skip to content

Commit

Permalink
Fail fast if index basename not found.
Browse files Browse the repository at this point in the history
  • Loading branch information
heuermh committed Aug 26, 2019
1 parent 72ab229 commit affd146
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions core/src/main/scala/org/bdgenomics/cannoli/Bowtie2.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/
package org.bdgenomics.cannoli

import java.io.FileNotFoundException
import org.apache.spark.SparkContext
import org.bdgenomics.adam.rdd.ADAMContext._
import org.bdgenomics.adam.rdd.fragment.{ FragmentDataset, InterleavedFASTQInFormatter }
Expand Down Expand Up @@ -67,6 +68,16 @@ class Bowtie2(

override def apply(fragments: FragmentDataset): AlignmentRecordDataset = {

// fail fast if index basename not found
try {
absolute(args.indexPath)
} catch {
case e: FileNotFoundException => {
error("Basename of the index %s not found, touch an empty file at this path if it does not exist".format(args.indexPath))
throw e
}
}

val builder = CommandBuilders.create(args.useDocker, args.useSingularity)
.setExecutable(args.executable)
.add("-x")
Expand Down

0 comments on commit affd146

Please sign in to comment.