Commit c3a9e217 authored by Peter van 't Hof's avatar Peter van 't Hof

Replace ID with a file argument

parent d36878da
......@@ -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
BiopetQScript.safeOutputs(f) match {
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
*/
object DownloadNcbiAssembly extends ToolCommand {
case class Args(assemblyId: String = null,
case class Args(assemblyReport: File = null,
outputFile: File = null,
reportFile: Option[File] = None,
contigNameHeader: Option[String] = None,
......@@ -19,8 +19,8 @@ object DownloadNcbiAssembly extends ToolCommand {
mustNotHave: List[(String, String)] = List()) extends AbstractArgs
class OptParser extends AbstractOptParser {
opt[String]('a', "assembly id") required () unbounded () valueName "<file>" action { (x, c) =>
c.copy(assemblyId = x)
opt[File]('a', "assembly_report") required () unbounded () valueName "<file>" action { (x, c) =>
c.copy(assemblyReport = x)
} text "refseq ID from NCBI"
opt[File]('o', "output") required () unbounded () valueName "<file>" action { (x, c) =>
c.copy(outputFile = x)
......@@ -52,8 +52,8 @@ object DownloadNcbiAssembly extends ToolCommand {
val argsParser = new OptParser
val cmdargs: Args = argsParser.parse(args, Args()) getOrElse (throw new IllegalArgumentException)
logger.info(s"Reading ${cmdargs.assemblyId} from NCBI")
val reader = Source.fromURL(s"ftp://ftp.ncbi.nlm.nih.gov/genomes/ASSEMBLY_REPORTS/All/${cmdargs.assemblyId}.assembly.txt")
logger.info(s"Reading ${cmdargs.assemblyReport}")
val reader = Source.fromFile(cmdargs.assemblyReport)
val assamblyReport = reader.getLines().toList
reader.close()
cmdargs.reportFile.foreach { file =>
......
......@@ -23,7 +23,7 @@ class DownloadNcbiAssemblyTest extends TestNGSuite with Matchers {
val outputReport = File.createTempFile("test.", ".report")
output.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,
"--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