"""Now collect other arguments. While the variable args declared below is global, properties of args are also arguments of the go() function so different command-line arguments can be passed to it for unit tests.""" args = parser.parse_args(argv[1:]) # Start keep_alive thread immediately if args.keep_alive: from dooplicity.tools import KeepAlive keep_alive_thread = KeepAlive(sys.stderr) keep_alive_thread.start() if __name__ == "__main__": import time start_time = time.time() go( bowtie_exe=os.path.expandvars(args.bowtie_exe), bowtie_index_base=os.path.expandvars(args.bowtie_idx), bowtie_args=bowtie_args, gzip_level=args.gzip_level, verbose=args.verbose, report_multiplier=args.report_multiplier, scratch=tempdel.silentexpandvars(args.scratch), ) print >>sys.stderr, "DONE with align_readlets.py; in=%d; " "time=%0.3f s" % ( _input_line_count, time.time() - start_time, )
import time start_time = time.time() input_line_count = 0 if args.out is not None: '''If --out is a local file, just write directly to that file. Otherwise, write to a temporary file that will later be uploaded to the destination.''' output_url = Url(args.out) if output_url.is_local: try: os.makedirs(output_url.to_url()) except: pass output_filename = os.path.join(args.out, args.junction_filename) else: temp_dir_path = make_temp_dir(tempdel.silentexpandvars(args.scratch)) register_cleanup(tempdel.remove_temporary_directories, [temp_dir_path]) output_filename = args.junction_filename + '.temp' output_filename = os.path.join(temp_dir_path, output_filename) with xopen(True, output_filename, 'w', args.gzip_level) as output_stream: for line in sys.stdin: tokens = line.strip().split('\t') # Remove leading zeros from ints print >>output_stream, '\t'.join( [tokens[0], str(int(tokens[1])), str(int(tokens[2]) - 1), tokens[3], tokens[4]] ) input_line_count += 1 else: # Default --out is stdout
'task alive') filemover.add_args(parser) bowtie.add_args(parser) tempdel.add_args(parser) args = parser.parse_args() import time start_time = time.time() output_filename, output_stream, output_url = [None] * 3 output_url = Url(args.out) if args.out is not None \ else Url(os.getcwd()) # Set up temporary destination import tempfile temp_dir_path = make_temp_dir(tempdel.silentexpandvars(args.scratch)) # For deleting temporary directory, even on unexpected exit register_cleanup(tempdel.remove_temporary_directories, [temp_dir_path]) # Set up temporary destination try: os.makedirs(os.path.join(temp_dir_path, 'index')) except: pass # Write to temporary directory, and later upload to URL index_basename = os.path.join(temp_dir_path, 'index/' + args.basename) fasta_file = os.path.join(temp_dir_path, 'temp.fa') print >> sys.stderr, 'Opened %s for writing....' % fasta_file with open(fasta_file, 'w') as fasta_stream: input_line_count = 0 for line in sys.stdin: counter.add('inputs')
args = parser.parse_args(argv[1:]) mover = filemover.FileMover(args=args) # Start keep_alive thread immediately if args.keep_alive: from dooplicity.tools import KeepAlive keep_alive_thread = KeepAlive(sys.stderr) keep_alive_thread.start() if __name__ == '__main__' and not args.test: import time start_time = time.time() go(bowtie2_exe=os.path.expandvars(args.bowtie2_exe), bowtie2_index_base=os.path.expandvars(args.bowtie2_idx), bowtie2_args=bowtie2_args, verbose=args.verbose, report_multiplier=args.report_multiplier, stranded=args.stranded, fudge=args.fudge, score_min=args.score_min, mover=mover, intermediate_dir=args.intermediate_dir, scratch=tempdel.silentexpandvars(args.scratch)) print >>sys.stderr, ('DONE with cointron_enum.py; in=%d; time=%0.3f s') % \ (_input_line_count, time.time() - start_time) elif __name__ == '__main__': # Test units del sys.argv[1:] # Don't choke on extra command-line parameters import unittest # Add unit tests here unittest.main()