예제 #1
0
 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 poolings
     # 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})
예제 #2
0
    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'])
            pool_name = 'Pool from plate %s (%s)' % (
                plate.external_id,
                datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
            # create input molar percentages
            pcts = calc_pool_pcts(plate_result['comp_vals'],
                                  plate_result['pool_vals'])
            quant_process = plate.quantification_process
            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))
예제 #3
0
    def post(self):
        plate_id = self.get_argument('plate-id')
        concentrations = json_decode(self.get_argument('concentrations'))
        concentrations = np.asarray(concentrations)

        plate = Plate(plate_id)
        q_process = QuantificationProcess.create(self.current_user, plate,
                                                 concentrations)

        pool_name = 'Pool - %s' % plate.external_id

        input_compositions = []
        concentrations = q_process.concentrations
        total_vol = 0
        for conc in concentrations:
            in_vol = conc[1]
            total_vol += in_vol
            input_compositions.append({
                'composition': conc[0],
                'input_volume': in_vol,
                'percentage_of_output': in_vol
            })

        for ic in input_compositions:
            ic['percentage_of_output'] = ic['percentage_of_output'] / total_vol

        process = PoolingProcess.create(self.current_user, q_process,
                                        pool_name, total_vol,
                                        input_compositions)

        self.write({'process': process.id})
예제 #4
0
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
예제 #5
0
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