def get(self, process_id): process = SequencingProcess(int(process_id)) name_pieces = ["preps", process.run_name] with BytesIO() as content: with zipfile.ZipFile(content, mode='w', compression=zipfile.ZIP_DEFLATED) as zf: # We anticipate that someday the generation of multiple # prep files for different studies may be coming back; that # is why this loop has not been torn out in spite of the # fact that, given changes in the generate_*_prep_information # methods, the dictionary will only have one item in it # so this loop will only ever execute once. for _, prep in process.generate_prep_information().items(): # NB: first piece is NOT the same as above: singular "prep" # instead of plural "preps" curr_name_pieces = ["prep", process.run_name] name = self.generate_file_name(curr_name_pieces, process) zf.writestr(name, prep) self.deliver_zip(name_pieces, process, content.getvalue(), extension="zip")
def get(self, process_id): process = SequencingProcess(int(process_id)) text = process.generate_sample_sheet() name_pieces = ["samplesheet", process.run_name] if not process.is_amplicon_assay: name_pieces.append(process.experiment) self.deliver_text(name_pieces, process, text, extension="csv")
def get(self, process_id): pid = int(process_id) process = SequencingProcess(pid) text = process.generate_sample_sheet() name_pieces = ["samplesheet", process.run_name] # TODO: Verify that the isAmplicon conditional is still needed. assay = PoolComposition.get_assay_type_for_sequencing_process(pid) if assay != 'Amplicon': name_pieces.append(process.experiment) self.deliver_text(name_pieces, process, text, extension="csv")
def get(self): res = {"data": [[p['process_id'], p['run_name'], p['experiment'], p['principal_investigator'], p['sequencing_process_id']] for p in SequencingProcess.list_sequencing_runs()]} self.write(res)
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
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})