def fixpairs(args): """ %prog fixpairs pairsfile sep sd Fix pairs library stats. This is sometime useful to modify library stats, for example, the separation between paired reads after importing the data. """ p = OptionParser(fixpairs.__doc__) opts, args = p.parse_args(args) if len(args) != 3: sys.exit(not p.print_help()) pairsfile, sep, sd = args newpairsfile = pairsfile.rsplit(".", 1)[0] + ".new.pairs" sep = int(sep) sd = int(sd) p = PairsFile(pairsfile) p.fixLibraryStats(sep, sd) p.write(newpairsfile)
def main(): parser = OptionParser() parser.add_option('--restore', dest='restore', action='store_true', help='restore your simulation files and cache the current sampling results', default=False) parser.add_option('--radii', dest='radii', default='0.0,4.0,8.0', action='store', type='string', help='the displacement radii to sample, separated with commas and no spaces, e.g., --radius=0.0,4.0,8.0') parser.add_option('--magnitudes', dest='magnitudes', default='0.1,0.2,0.4', action='store', type='string', help='the displacement magnitudes to sample, separated with commas and no spaces, e.g., --magnitude=0.1,0.2,0.4') parser.add_option('--searches', dest='searches', default=50, action='store', type=int, help='the number of searches to perform per sample') (options, args) = parser.parse_args() if options.restore: restore() return if not os.path.exists('original'): if not os.path.exists('config.ini') or not os.path.exists('reactant.con'): print('This does not appear to be an eon project directory. Either config.ini or reactant.con or both were not found. Aborting.') sys.exit() rads = [float(r) for r in options.radii.split(',')] mags = [float(m) for m in options.magnitudes.split(',')] searches = int(options.searches) initialize(rads, mags, searches) print 'Initialized new akmc displacement sampling with radii %s, magnitudes %s, and performing %s searches per sample.' % (options.radii, options.magnitudes, options.searches) return radi, rads, magi, mags, searches = read_metadata() # Make sure we're not finished sampling before continuing. if magi >= len(mags): print_table() print 'Sampling complete.' sys.exit(1) return rad = rads[radi] mag = mags[magi] if not os.path.exists('config.ini') or not os.path.exists('reactant.con'): # Initialize the next sample. for thing in glob.glob('original/*'): shutil.copy(thing, '.') print 'Sampling with radius %f and magnitude %f' % (rad, mag) parser = ConfigParser.SafeConfigParser() parser.read('config.ini') parser.set('Saddle Search', 'displace_radius', str(rad)) parser.set('Saddle Search', 'displace_magnitude', str(mag)) parser.set('AKMC', 'confidence', '1.1') fob = open('config.ini', 'w') parser.write(fob) fob.close() # Register any available results. throwaway = commands.getoutput('eon -n') # Check the number of completed searches. n_completed_searches = 0 if os.path.exists('states/0/search_results.txt'): n_completed_searches = len(open('states/0/search_results.txt').readlines()) - 2 print '%d searches have been completed for this sample.' % n_completed_searches if n_completed_searches >= searches: print 'Sample finished.' store_sample('samples/sample-%f-%f' % (rad, mag)) # Increment the sample parameters inc_attempt = inc_params() return print 'Executing eon...' throwaway = commands.getoutput('eon') print 'Done.'
raw_text_split = raw_text.splitlines() insert_counter = 0 for (i,rt) in zip(range(0,len(raw_text_split)),raw_text_split): if rt.find("video::") >= 0: video_text = rt.split(" ") for (j,vt) in zip(range(0,len(video_text)),video_text): if vt.find("video::") >= 0: tmp_text = os.path.basename(video_text[j + 1]) raw_text_split.insert(i + 1 + insert_counter, " :url: http://jenkins.jsk.imi.i.u-tokyo.ac.jp:8080/job/agentsystem-test/lastSuccessfulBuild/artifact/%s-example/_images/%s"%(args[0],tmp_text)) insert_counter = insert_counter + 1 raw_text = "\n".join(raw_text_split) sphinxdoc += raw_text+'\n\n' parser.getroot().remove(tag) tf = tempfile.TemporaryFile() parser.write(tf) tf.seek(0) sxml = tf.read() sphinxdoc += """Contents ######## .. code-block:: xml %s """%re.sub('\\n','\n ',sxml) try: os.mkdir(os.path.join(pkgdir,options.output_dir)) except OSError: pass
def main(): parser = OptionParser() parser.add_option( '--restore', dest='restore', action='store_true', help= 'restore your simulation files and cache the current sampling results', default=False) parser.add_option( '--radii', dest='radii', default='0.0,4.0,8.0', action='store', type='string', help= 'the displacement radii to sample, separated with commas and no spaces, e.g., --radius=0.0,4.0,8.0' ) parser.add_option( '--magnitudes', dest='magnitudes', default='0.1,0.2,0.4', action='store', type='string', help= 'the displacement magnitudes to sample, separated with commas and no spaces, e.g., --magnitude=0.1,0.2,0.4' ) parser.add_option('--searches', dest='searches', default=50, action='store', type=int, help='the number of searches to perform per sample') (options, args) = parser.parse_args() if options.restore: restore() return if not os.path.exists('original'): if not os.path.exists('config.ini') or not os.path.exists( 'reactant.con'): print( 'This does not appear to be an eon project directory. Either config.ini or reactant.con or both were not found. Aborting.' ) sys.exit() rads = [float(r) for r in options.radii.split(',')] mags = [float(m) for m in options.magnitudes.split(',')] searches = int(options.searches) initialize(rads, mags, searches) print 'Initialized new akmc displacement sampling with radii %s, magnitudes %s, and performing %s searches per sample.' % ( options.radii, options.magnitudes, options.searches) return radi, rads, magi, mags, searches = read_metadata() # Make sure we're not finished sampling before continuing. if magi >= len(mags): print_table() print 'Sampling complete.' sys.exit(1) return rad = rads[radi] mag = mags[magi] if not os.path.exists('config.ini') or not os.path.exists('reactant.con'): # Initialize the next sample. for thing in glob.glob('original/*'): shutil.copy(thing, '.') print 'Sampling with radius %f and magnitude %f' % (rad, mag) parser = ConfigParser.SafeConfigParser() parser.read('config.ini') parser.set('Saddle Search', 'displace_radius', str(rad)) parser.set('Saddle Search', 'displace_magnitude', str(mag)) parser.set('AKMC', 'confidence', '1.1') fob = open('config.ini', 'w') parser.write(fob) fob.close() # Register any available results. throwaway = commands.getoutput('eon -n') # Check the number of completed searches. n_completed_searches = 0 if os.path.exists('states/0/search_results.txt'): n_completed_searches = len( open('states/0/search_results.txt').readlines()) - 2 print '%d searches have been completed for this sample.' % n_completed_searches if n_completed_searches >= searches: print 'Sample finished.' store_sample('samples/sample-%f-%f' % (rad, mag)) # Increment the sample parameters inc_attempt = inc_params() return print 'Executing eon...' throwaway = commands.getoutput('eon') print 'Done.'
video_text = rt.split(" ") for (j, vt) in zip(range(0, len(video_text)), video_text): if vt.find("video::") >= 0: tmp_text = os.path.basename(video_text[j + 1]) raw_text_split.insert( i + 1 + insert_counter, " :url: http://jenkins.jsk.imi.i.u-tokyo.ac.jp:8080/job/agentsystem-test/lastSuccessfulBuild/artifact/%s-example/_images/%s" % (args[0], tmp_text), ) insert_counter = insert_counter + 1 raw_text = "\n".join(raw_text_split) sphinxdoc += raw_text + "\n\n" parser.getroot().remove(tag) tf = tempfile.TemporaryFile() parser.write(tf) tf.seek(0) sxml = tf.read() sphinxdoc += """Contents ######## .. code-block:: xml %s """ % re.sub( "\\n", "\n ", sxml ) try: os.mkdir(os.path.join(pkgdir, options.output_dir))