def post(self): pool_name = self.get_argument('pool_name') pools_info = json_decode(self.get_argument('pools_info')) concentrations = [] input_compositions = [] for p_info in pools_info: pool_comp = PoolComposition(p_info['pool_id']) concentrations.append({ 'composition': pool_comp, 'concentration': p_info['concentration'] }) input_compositions.append({ 'composition': pool_comp, 'input_volume': p_info['volume'], 'percentage_of_output': p_info['percentage'] }) # Create the quantification process (DNA conc) q_process = QuantificationProcess.create_manual( self.current_user, concentrations) # Create the pool - Magic number 5 - > the volume for this pooling # is always 5 according to the wet lab. p_process = PoolingProcess.create(self.current_user, q_process, pool_name, 5, input_compositions, { "function": "amplicon_pool", "parameters": {} }) self.write({'process': p_process.id})
def create_pools_pool_process(user, quant_process, pools): input_compositions = [{ 'composition': p, 'input_volume': 1, 'percentage_of_output': 1 / 9.0 } for p in pools] pool_process = PoolingProcess.create(user, quant_process, 'New pool name %s' % datetime.now(), 5, input_compositions, { "function": "amplicon_pool", "parameters": {} }) return pool_process
def post(self): plates_info = json_decode(self.get_argument('plates-info')) results = [] for pinfo in plates_info: plate_result = self._compute_pools(pinfo) plate = Plate(plate_result['plate_id']) # calculate estimated molar fraction for each element of pool amts = plate_result['comp_vals'] * plate_result['pool_vals'] pcts = amts / amts.sum() quant_process = QuantificationProcess( plate_result['quant-process-id']) pool_name = 'Pool from plate %s (%s)' % ( plate.external_id, datetime.now().strftime( quant_process.get_date_format())) input_compositions = [] for comp, _, _ in quant_process.concentrations: well = comp.container row = well.row - 1 column = well.column - 1 input_compositions.append({ 'composition': comp, 'input_volume': plate_result['pool_vals'][row][column], 'percentage_of_output': pcts[row][column] }) robot = (Equipment(plate_result['robot']) if plate_result['robot'] is not None else None) process = PoolingProcess.create( self.current_user, quant_process, pool_name, plate_result['pool_vals'].sum(), input_compositions, plate_result['func_data'], robot=robot, destination=plate_result['destination']) results.append({'plate-id': plate.id, 'process-id': process.id}) self.write(json_encode(results))
def create_plate_pool_process(user, quant_process, plate, func_data): input_compositions = [] echo = Equipment(8) for well in chain.from_iterable(plate.layout): if well is not None: input_compositions.append({ 'composition': well.composition, 'input_volume': 1, 'percentage_of_output': 1 / 9.0 }) pool_process = PoolingProcess.create(user, quant_process, 'New test pool name %s' % datetime.now(), 4, input_compositions, func_data, robot=echo) return pool_process