Пример #1
0
def main(args):
	
	options = parse_args(args)
	
	#Open up connection to database
	engine = dbtables.connect(options.db)
	Session = sessionmaker(bind=engine)
	session = Session()

        #Get all of the blanks in groups, as a dictionary by mode. Then compress to a single run
        # for each mode. Note: the compound information in compressed runs is not very reliable.
        # the adduct information is what is preserved. 
	blanks = group_cefs(*options.blanks)
	for mode in blanks:
		for ind, blank in enumerate(blanks[mode]):
			blanks[mode][ind] = cefparse.read_cef(blank)
		blanks[mode] = btools.comb_runs(20, 0.4, *blanks[mode])
	runs = []
	ceflists = group_cefs(*options.cefs)	
	modes = ceflists.keys()
	
	#This is for the parallelization, this says only use this computer, no network cluster
	ppservers = ()
	if options.cpus:
		job_server = pp.Server(options.cpus, ppservers=ppservers, secret='acetone')
	else:
		job_server = pp.Server(ppservers=ppservers, secret='acetone')
	print "Running with ", job_server.get_ncpus(), " CPU's"
	
	widgets = ['Submitting Jobs: ', Percentage(), ' ', Bar(marker=RotatingMarker()), ' ', ETA(),\
			' ', FileTransferSpeed()]
	pbar = ProgressBar(widgets=widgets, maxval=len(ceflists.values()[0])).start()
	for ind, group in enumerate(zip(*ceflists.values())):
		if len(group) < 4:
			print "Skipping: ", group
			continue
		small = dict([(mode, cef) for mode, cef in zip(modes, group)])
		#Submit the group as a job to parallel process
		
		print group

		runs.append(job_server.submit(process, (small, blanks, options.cutoff, options.rt,), (),
				("btools", "sys", "re", "cefparse", "sqlalchemy.orm", "sqlalchemy.ext.declarative",
				"dbtables", "val",)))
		pbar.update(ind + 1)
	pbar.finish()

	#This portion is for the progress bar.
	widgets = ['COMMITING: ', Percentage(), ' ', Bar(marker=RotatingMarker()), ' ', ETA(),\
			' ', FileTransferSpeed()]
	pbar = ProgressBar(widgets=widgets, maxval=len(runs)).start()

	for ind, run in enumerate(runs):
		session.add(run())
		session.commit()
		pbar.update(ind + 1)
	pbar.finish()
Пример #2
0
	def __init__(self, db, tabfile, quant=True, remove=True, bqs=['00110', '00100', '10000', '10100', '10110', '11000', '11100', '11110','00111', '00101', '10001', '10101', '10111', '11001', '11101', '11111']):
		bqs = set(bqs)
		self.db = db
		self.engine = dbtables.connect(db)
		self.Session = sessionmaker(bind=self.engine)
		self.session = self.Session()
		
		self.cp = self.get_cp(tabfile)
		self.ad_heat = self.get_bins([finger.name for finger in self.cp.fingerprints()], bqs)
		
		if remove:
			self.remove_systematic(0.1)
			self.remove_underrepresent()
		
		if quant:
			self.quant()
Пример #3
0
	def __init__(self, db, tabfile, quant=True, remove=True, bqs=['00110', '00100', '10000', '10100', '10110', '11000', '11100', '11110','00111', '00101', '10001', '10101', '10111', '11001', '11101', '11111']):
		bqs = set(bqs)
		self.db = db
		self.engine = dbtables.connect(db)
		self.Session = sessionmaker(bind=self.engine)
		self.session = self.Session()
		
		self.synleth = self.get_synleth(tabfile)
		self.ad_heat = self.get_bins([str(pref) for pref in self.synleth.prefs], bqs)
		
		if remove:
			self.remove_systematic(0.1)
			self.remove_underrepresent()
		
		if quant:
			self.quant()