Commit 2fc72f69 authored by Sander Bollen's avatar Sander Bollen Committed by GitHub

Merge pull request #12 from biopet/fix-BIOPET-544

Replace ID with a file argument
parents d36878da c3a9e217
...@@ -120,7 +120,7 @@ trait BiopetQScript extends Configurable with GatkLogging { qscript: QScript => ...@@ -120,7 +120,7 @@ trait BiopetQScript extends Configurable with GatkLogging { qscript: QScript =>
val className = if (f.getClass.isAnonymousClass) f.getClass.getSuperclass.getSimpleName else f.getClass.getSimpleName val className = if (f.getClass.isAnonymousClass) f.getClass.getSuperclass.getSimpleName else f.getClass.getSimpleName
BiopetQScript.safeOutputs(f) match { BiopetQScript.safeOutputs(f) match {
case Some(o) => f.jobOutputFile = new File(o.head.getAbsoluteFile.getParent, "." + f.firstOutput.getName + "." + className + ".out") case Some(o) => f.jobOutputFile = new File(o.head.getAbsoluteFile.getParent, "." + f.firstOutput.getName + "." + className + ".out")
case _ => f.jobOutputFile = new File("./stdout") // Line is here for test backup case _ => f.jobOutputFile = new File("./stdout") // Line is here for test backup
} }
}) })
......
...@@ -11,7 +11,7 @@ import scala.io.Source ...@@ -11,7 +11,7 @@ import scala.io.Source
*/ */
object DownloadNcbiAssembly extends ToolCommand { object DownloadNcbiAssembly extends ToolCommand {
case class Args(assemblyId: String = null, case class Args(assemblyReport: File = null,
outputFile: File = null, outputFile: File = null,
reportFile: Option[File] = None, reportFile: Option[File] = None,
contigNameHeader: Option[String] = None, contigNameHeader: Option[String] = None,
...@@ -19,8 +19,8 @@ object DownloadNcbiAssembly extends ToolCommand { ...@@ -19,8 +19,8 @@ object DownloadNcbiAssembly extends ToolCommand {
mustNotHave: List[(String, String)] = List()) extends AbstractArgs mustNotHave: List[(String, String)] = List()) extends AbstractArgs
class OptParser extends AbstractOptParser { class OptParser extends AbstractOptParser {
opt[String]('a', "assembly id") required () unbounded () valueName "<file>" action { (x, c) => opt[File]('a', "assembly_report") required () unbounded () valueName "<file>" action { (x, c) =>
c.copy(assemblyId = x) c.copy(assemblyReport = x)
} text "refseq ID from NCBI" } text "refseq ID from NCBI"
opt[File]('o', "output") required () unbounded () valueName "<file>" action { (x, c) => opt[File]('o', "output") required () unbounded () valueName "<file>" action { (x, c) =>
c.copy(outputFile = x) c.copy(outputFile = x)
...@@ -52,8 +52,8 @@ object DownloadNcbiAssembly extends ToolCommand { ...@@ -52,8 +52,8 @@ object DownloadNcbiAssembly extends ToolCommand {
val argsParser = new OptParser val argsParser = new OptParser
val cmdargs: Args = argsParser.parse(args, Args()) getOrElse (throw new IllegalArgumentException) val cmdargs: Args = argsParser.parse(args, Args()) getOrElse (throw new IllegalArgumentException)
logger.info(s"Reading ${cmdargs.assemblyId} from NCBI") logger.info(s"Reading ${cmdargs.assemblyReport}")
val reader = Source.fromURL(s"ftp://ftp.ncbi.nlm.nih.gov/genomes/ASSEMBLY_REPORTS/All/${cmdargs.assemblyId}.assembly.txt") val reader = Source.fromFile(cmdargs.assemblyReport)
val assamblyReport = reader.getLines().toList val assamblyReport = reader.getLines().toList
reader.close() reader.close()
cmdargs.reportFile.foreach { file => cmdargs.reportFile.foreach { file =>
......
...@@ -23,7 +23,7 @@ class DownloadNcbiAssemblyTest extends TestNGSuite with Matchers { ...@@ -23,7 +23,7 @@ class DownloadNcbiAssemblyTest extends TestNGSuite with Matchers {
val outputReport = File.createTempFile("test.", ".report") val outputReport = File.createTempFile("test.", ".report")
output.deleteOnExit() output.deleteOnExit()
outputReport.deleteOnExit() outputReport.deleteOnExit()
DownloadNcbiAssembly.main(Array("-a", "GCF_000844745.1", DownloadNcbiAssembly.main(Array("-a", new File(resourcePath("/GCF_000844745.1.report")).getAbsolutePath,
"-o", output.getAbsolutePath, "-o", output.getAbsolutePath,
"--report", outputReport.getAbsolutePath)) "--report", outputReport.getAbsolutePath))
......
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