Commit 53ab6faa authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Added AssignTaxonomy step

parent 988be674
package nl.lumc.sasc.biopet.extensions.qiime
import java.io.File
import nl.lumc.sasc.biopet.core.{ Version, BiopetCommandLineFunction }
import nl.lumc.sasc.biopet.utils.config.Configurable
import org.broadinstitute.gatk.utils.commandline.Input
/**
* Created by pjvan_thof on 12/4/15.
*/
class AssignTaxonomy(val root: Configurable) extends BiopetCommandLineFunction with Version {
executable = config("exe", default = "assign_taxonomy.py")
@Input(required = true)
var inputFasta: File = _
@Input(required = false)
var read_1_seqs_fp: Option[File] = None
@Input(required = false)
var read_2_seqs_fp: Option[File] = None
@Input(required = false)
var id_to_taxonomy_fp: Option[File] = config("id_to_taxonomy_fp")
@Input(required = false)
var reference_seqs_fp: Option[File] = config("reference_seqs_fp")
@Input(required = false)
var training_data_properties_fp: Option[File] = config("training_data_properties_fp")
var single_ok: Boolean = config("single_ok", default = false)
var no_single_ok_generic: Boolean = config("no_single_ok_generic", default = false)
var amplicon_id_regex: Option[String] = config("amplicon_id_regex")
var header_id_regex: Option[String] = config("header_id_regex")
var assignment_method: Option[String] = config("assignment_method")
var sortmerna_db: Option[String] = config("sortmerna_db")
var sortmerna_e_value: Option[String] = config("sortmerna_e_value")
var sortmerna_coverage: Option[String] = config("sortmerna_coverage")
var sortmerna_best_N_alignments: Option[String] = config("sortmerna_best_N_alignments")
var sortmerna_threads: Option[String] = config("sortmerna_threads")
var blast_db: Option[String] = config("blast_db")
var confidence: Option[String] = config("confidence")
var min_consensus_fraction: Option[String] = config("min_consensus_fraction")
var similarity: Option[String] = config("similarity")
var uclust_max_accepts: Option[String] = config("uclust_max_accepts")
var rdp_max_memory: Option[String] = config("rdp_max_memory")
var blast_e_value: Option[String] = config("blast_e_value")
var outputDir: File = _
def versionCommand = executable + " --version"
def versionRegex = """Version: (.*)""".r
override def beforeGraph(): Unit = {
super.beforeGraph()
require(outputDir != null)
}
def cmdLine = executable +
required("-o", inputFasta) +
optional("--read_1_seqs_fp", read_1_seqs_fp) +
optional("--read_2_seqs_fp", read_2_seqs_fp) +
optional("-t", id_to_taxonomy_fp) +
optional("-r", reference_seqs_fp) +
optional("-p", training_data_properties_fp) +
optional("--amplicon_id_regex", amplicon_id_regex) +
optional("--header_id_regex", header_id_regex) +
optional("--assignment_method", assignment_method) +
optional("--sortmerna_db", sortmerna_db) +
optional("--sortmerna_e_value", sortmerna_e_value) +
optional("--sortmerna_coverage", sortmerna_coverage) +
optional("--sortmerna_best_N_alignments", sortmerna_best_N_alignments) +
optional("--sortmerna_threads", sortmerna_threads) +
optional("--blast_db", blast_db) +
optional("--confidence", confidence) +
optional("--min_consensus_fraction", min_consensus_fraction) +
optional("--similarity", similarity) +
optional("--uclust_max_accepts", uclust_max_accepts) +
optional("--rdp_max_memory", rdp_max_memory) +
optional("--blast_e_value", blast_e_value) +
required("--output_dir", outputDir)
}
package nl.lumc.sasc.biopet.pipelines.gears
import nl.lumc.sasc.biopet.core.BiopetQScript
import nl.lumc.sasc.biopet.extensions.qiime.{ PickRepSet, PickOtus }
import nl.lumc.sasc.biopet.extensions.qiime.{AssignTaxonomy, PickRepSet, PickOtus}
import nl.lumc.sasc.biopet.utils.config.Configurable
import org.broadinstitute.gatk.queue.QScript
/**
* Created by pjvan_thof on 12/4/15.
*/
class GearsQiimeRatx(val root: Configurable) extends QScript with BiopetQScript {
class GearsQiimeRtax(val root: Configurable) extends QScript with BiopetQScript {
var fastaR1: File = _
var fastqR2: Option[File] = None
var fastaR2: Option[File] = None
override def fixedValues = Map("assigntaxonomy" -> Map("assignment_method" -> "rtax"))
def init() = {
require(fastaR1 != null)
......@@ -31,5 +33,13 @@ class GearsQiimeRatx(val root: Configurable) extends QScript with BiopetQScript
pickRepSet.logFile = Some(new File(pickRepSet.outputDir, fastaR1.getName
.stripSuffix(".fasta").stripSuffix(".fa").stripSuffix(".fna") + ".log"))
add(pickRepSet)
val assignTaxonomy = new AssignTaxonomy(this)
assignTaxonomy.outputDir = new File(outputDir, "assign_taxonomy")
assignTaxonomy.jobOutputFile = new File(assignTaxonomy.outputDir, ".assign_taxonomy.out")
assignTaxonomy.inputFasta = pickRepSet.outputFasta.get
assignTaxonomy.read_1_seqs_fp = Some(fastaR1)
assignTaxonomy.read_2_seqs_fp = fastaR2
add(assignTaxonomy)
}
}
......@@ -109,10 +109,10 @@ class GearsSingle(val root: Configurable) extends QScript with SummaryQScript wi
}
if (gearsUserQiimeRtax) {
val qiimeRatx = new GearsQiimeRatx(this)
val qiimeRatx = new GearsQiimeRtax(this)
qiimeRatx.outputDir = new File(outputDir, "qiime_ratx")
qiimeRatx.fastaR1 = fastaR1
qiimeRatx.fastqR2 = fastaR2
qiimeRatx.fastaR2 = fastaR2
qiimeRatx.init()
qiimeRatx.biopetScript()
addAll(qiimeRatx.functions)
......
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