Exemplo n.º 1
0
    def post(self):
        plates_info = self.get_argument('plates_info')
        volume = self.get_argument('volume')
        preparation_date = self.get_argument('preparation_date')

        month, day, year = map(int, preparation_date.split('/'))
        preparation_date = date(year, month, day)

        processes = [
            LibraryPrep16SProcess.create(
                self.current_user,
                Plate(pid),
                Plate(pp),
                pn,
                Equipment(ep),
                Equipment(ep300),
                Equipment(ep50),
                ReagentComposition.from_external_id(mm),
                ReagentComposition.from_external_id(w),
                volume,
                preparation_date=preparation_date).id
            for pid, pn, pp, ep, ep300, ep50, mm, w in json_decode(plates_info)
        ]

        self.write({'processes': processes})
Exemplo n.º 2
0
def create_gdna_extraction_process(user, plate):
    kingfisher = Equipment(11)
    epmotion = Equipment(6)
    epmotion_tool = Equipment(15)
    extraction_kit = ReagentComposition(1)
    ext_process = GDNAExtractionProcess.create(
        user, plate, kingfisher, epmotion, epmotion_tool, extraction_kit, 100,
        'GDNA test plate %s' % datetime.now())
    gdna_plate = ext_process.plates[0]
    return ext_process, gdna_plate
Exemplo n.º 3
0
def create_amplicon_prep(user, plate):
    primer_plate = Plate(11)
    epmotion = Equipment(6)
    master_mix = ReagentComposition(2)
    water_lot = ReagentComposition(3)
    epmotion_tool_tm300 = Equipment(16)
    epmotion_tool_tm50 = Equipment(17)
    amplicon_process = LibraryPrep16SProcess.create(
        user, plate, primer_plate, 'Amplicon test plate %s' % datetime.now(),
        epmotion, epmotion_tool_tm300, epmotion_tool_tm50, master_mix,
        water_lot, 75,)
    amplicon_plate = amplicon_process.plates[0]
    return amplicon_process, amplicon_plate
Exemplo n.º 4
0
    def post(self):
        robot = self.get_argument('robot')
        tool = self.get_argument('tool')
        kit = self.get_argument('kit')
        plates = self.get_argument('plates')
        volume = self.get_argument('volume')

        plates = [Plate(pid) for pid in json_decode(plates)]

        process = GDNAExtractionProcess.create(
            self.current_user, Equipment(robot), Equipment(tool),
            ReagentComposition.from_external_id(kit), plates, volume)

        self.write({'process': process.id})
Exemplo n.º 5
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))
Exemplo n.º 6
0
def create_sequencing_process(user, pools):
    seq_process = SequencingProcess.create(
        user, pools, 'New sequencing run %s' % datetime.now(),
        'Run experiment %s' % datetime.now(), Equipment(18), 151, 151,
        User('*****@*****.**'),
        contacts=[User('*****@*****.**'), User('*****@*****.**')])
    return seq_process
Exemplo n.º 7
0
    def post(self):
        master_mix = self.get_argument('master_mix')
        water = self.get_argument('water')
        robot = self.get_argument('robot')
        tm300_8_tool = self.get_argument('tm300_8_tool')
        tm50_8_tool = self.get_argument('tm50_8_tool')
        volume = self.get_argument('volume')
        plates = self.get_argument('plates')

        plates = [(Plate(pid), Plate(ppid))
                  for pid, ppid in json_decode(plates)]

        process = LibraryPrep16SProcess.create(
            self.current_user, ReagentComposition.from_external_id(master_mix),
            ReagentComposition.from_external_id(water), Equipment(robot),
            Equipment(tm300_8_tool), Equipment(tm50_8_tool), volume, plates)

        self.write({'process': process.id})
Exemplo n.º 8
0
    def post(self):
        plates_info = self.get_argument('plates_info')
        extraction_date = self.get_argument('extraction_date')
        volume = self.get_argument('volume')

        month, day, year = map(int, extraction_date.split('/'))
        extraction_date = date(year, month, day)

        plates_info = [
            (Plate(pid), Equipment(kf), Equipment(ep), Equipment(ept),
             ReagentComposition.from_external_id(kit), p_name)
            for pid, kf, ep, ept, kit, p_name in json_decode(plates_info)
        ]

        process = GDNAExtractionProcess.create(self.current_user,
                                               plates_info,
                                               volume,
                                               extraction_date=extraction_date)

        self.write({'process': process.id})
Exemplo n.º 9
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
Exemplo n.º 10
0
    def post(self):
        plates = self.get_argument('plates')
        plate_ext_id = self.get_argument('plate_ext_id')
        robot = self.get_argument('robot')

        plates = [Plate(pid) for pid in json_decode(plates)]

        process = GDNAPlateCompressionProcess.create(self.current_user, plates,
                                                     plate_ext_id,
                                                     Equipment(robot))

        self.write({'process': process.id})
Exemplo n.º 11
0
    def post(self):
        plates_info = self.get_argument('plates_info')
        extraction_date = self.get_argument('extraction_date')
        volume = self.get_argument('volume')

        month, day, year = map(int, extraction_date.split('/'))
        extraction_date = date(year, month, day)

        # We create one process per plate
        processes = []
        for pid, ee, kf, ep, ept, kit, p_name, nt in json_decode(plates_info):
            # Check whether plate was externally extracted
            if ee is True:
                # find the id of null things
                eq_no = \
                  Equipment.list_equipment('Not applicable')[0]['equipment_id']
                ep = ept = kf = Equipment(eq_no)
                kit = ReagentComposition.from_external_id('Not applicable')
            else:
                kf = Equipment(kf)
                ep = Equipment(ep)
                ept = Equipment(ept)
                kit = ReagentComposition.from_external_id(kit)
            processes.append(
                GDNAExtractionProcess.create(self.current_user,
                                             Plate(pid),
                                             kf,
                                             ep,
                                             ept,
                                             kit,
                                             volume,
                                             p_name,
                                             externally_extracted=ee,
                                             extraction_date=extraction_date,
                                             notes=nt).id)

        self.write({'processes': processes})
Exemplo n.º 12
0
 def post(self):
     pool_id = self.get_argument('pool')
     run_name = self.get_argument('run_name')
     sequencer_id = self.get_argument('sequencer')
     fwd_cycles = int(self.get_argument('fwd_cycles'))
     rev_cycles = int(self.get_argument('rev_cycles'))
     assay = self.get_argument('assay')
     pi = self.get_argument('principal_investigator')
     c0 = self.get_argument('contact_0')
     c1 = self.get_argument('contact_1')
     c2 = self.get_argument('contact_2')
     process = SequencingProcess.create(
         self.current_user, PoolComposition(pool_id), run_name,
         Equipment(sequencer_id), fwd_cycles, rev_cycles, assay,
         User(pi), User(c0), User(c1), User(c2))
     self.write({'process': process.id})
Exemplo n.º 13
0
    def post(self):
        pools = self.get_argument('pools')
        run_name = self.get_argument('run_name')
        experiment = self.get_argument('experiment')
        sequencer_id = self.get_argument('sequencer')
        fwd_cycles = int(self.get_argument('fwd_cycles'))
        rev_cycles = int(self.get_argument('rev_cycles'))
        pi = self.get_argument('principal_investigator')
        contacts = self.get_argument('additional_contacts')

        pools = [PoolComposition(x) for x in json_decode(pools)]
        contacts = [User(x) for x in json_decode(contacts)]

        process = SequencingProcess.create(self.current_user, pools,
                                           run_name, experiment,
                                           Equipment(sequencer_id), fwd_cycles,
                                           rev_cycles, User(pi), contacts)
        self.write({'process': process.id})
Exemplo n.º 14
0
def create_compression_process(user, gdna_plates):
    comp_process = GDNAPlateCompressionProcess.create(
        user, gdna_plates, 'Compressed test plate %s' % datetime.now(),
        Equipment(6))
    compressed_plate = comp_process.plates[0]
    return comp_process, compressed_plate