Exemple #1
0
 add_debug_option(p.parser_for('info'))
 # Add copy command
 p.add_command('copy',help="Copy fastqs from ANALYSIS_DIR",
               usage="%prog copy [OPTIONS] ANALYSIS_DIR DEST_DIR",
               description="Copy fastqs from ANALYSIS_DIR to DEST_DIR.")
 p.parser_for('copy').add_option('--projects',action='store',dest='projects',default=None,
                                 help="Restrict copying to projects matching the "
                                 "supplied pattern")
 p.parser_for('copy').add_option('--fastq-dir',action='store',dest='fastq_dir',default=None,
                                 help="Only copy fastqs from the specified FASTQ_DIR")
 add_dry_run_option(p.parser_for('copy'))
 add_debug_option(p.parser_for('copy'))
 # Process the command line
 cmd,options,args = p.parse_args()
 if len(args) < 1:
     p.error("Need to supply a directory to examine")
 if options.debug:
     logging.getLogger().setLevel(logging.DEBUG)
 # Acquire data for putative analysis directory
 dirn = os.path.abspath(args[0])
 print "Examining %s" % dirn
 analysis_dir = utils.AnalysisDir(dirn)
 if not (analysis_dir.n_projects and analysis_dir.n_sequencing_data):
     logging.warning("Not an analysis directory")
     sys.exit()
 # Deal with commands
 if cmd == 'info':
     # Report projects from sequencing data
     if analysis_dir.n_sequencing_data:
         for data in analysis_dir.sequencing_data:
             print "Sequencing data projects found in '%s':\n" % \
 else:
     # For other options check if an analysis
     # directory was specified
     if len(args) > 0:
         analysis_dir = args[0]
     else:
         analysis_dir = os.getcwd()
     # Turn off allow save for specific commands
     if cmd in ('params','metadata','report'):
         allow_save = False
     # Run the specified stage
     d = AutoProcess(analysis_dir,allow_save_params=allow_save)
     if cmd == 'make_fastqs':
         # Deal with --no-lane-splitting
         if options.no_lane_splitting and options.use_lane_splitting:
             p.error("--no-lane-splitting and --use-lane-splitting "
                     "are mutually exclusive")
         elif options.no_lane_splitting:
             no_lane_splitting = True
         elif options.use_lane_splitting:
             no_lane_splitting = False
         else:
             no_lane_splitting = None
         # Do the make_fastqs step
         d.make_fastqs(skip_rsync=options.skip_rsync,
                       nprocessors=options.nprocessors,
                       runner=options.runner,
                       remove_primary_data=options.remove_primary_data,
                       ignore_missing_bcl=options.ignore_missing_bcl,
                       ignore_missing_stats=options.ignore_missing_stats,
                       generate_stats=(not options.no_stats),
                       require_bcl2fastq_version=options.bcl2fastq_version,