From 177aac122abd881f9ee5f57c54a13b9166d81c6d Mon Sep 17 00:00:00 2001 From: Diane Trout Date: Thu, 17 Oct 2013 15:02:51 -0700 Subject: [PATCH] Add command line feature to srf command this should allow copying out fastq-equivalent files from a run. --- htsworkflow/pipelines/srf.py | 45 ++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/htsworkflow/pipelines/srf.py b/htsworkflow/pipelines/srf.py index d7efc7d..31aa6d6 100644 --- a/htsworkflow/pipelines/srf.py +++ b/htsworkflow/pipelines/srf.py @@ -1,3 +1,4 @@ +import optparse from glob import glob import logging import os @@ -211,3 +212,47 @@ def make_md5_commands(destdir): return cmd_list +def main(cmdline=None): + parser = make_parser() + opts, args = parser.parse_args(cmdline) + + logging.basicConfig(level = logging.DEBUG) + if not opts.name: + parser.error("Specify run name. Usually runfolder name") + if not opts.destination: + parser.error("Specify where to write sequence files") + if not opts.site_name: + parser.error("Specify site name") + if len(args) != 1: + parser.error("Can only process one directory") + + source = args[0] + LOGGER.info("Raw Format is: %s" % (opts.format, )) + seq_cmds = [] + if opts.format == 'fastq': + LOGGER.info("raw data = %s" % (source,)) + copy_hiseq_project_fastqs(opts.name, source, opts.site_name, opts.destination) + elif opts.format == 'qseq': + seq_cmds = make_qseq_commands(opts.name, source, opts.lanes, opts.site_name, opts.destination) + elif opts.format == 'srf': + seq_cmds = make_srf_commands(opts.name, source, opts.lanes, opts.site_name, opts.destination, 0) + else: + raise ValueError('Unknown --format=%s' % (opts.format)) + print seq_cmds + srf.run_commands(args.source, seq_cmds, num_jobs) + +def make_parser(): + parser = optparse.OptionParser() + parser.add_option('-f', '--format', default='fastq', + help="Format raw data is in") + parser.add_option('-n', '--name', default=None, + help="Specify run name") + parser.add_option('-d', '--destination', default=None, + help='specify where to write files (cycle dir)') + parser.add_option('-s', '--site-name', default=None, + help="specify site name") + parser.add_option('-l', '--lanes', default="1,2,3,4,5,6,7,8", + help="what lanes to process, defaults to all") + return parser +if __name__ == "__main__": + main() -- 2.30.2