def execute(conn, process_id, selection_id, prop): pipeline_name = default_attributes.get_attribute_value( conn, 'pipeline_name', process_id) sequencing_platform = default_attributes.get_attribute_value( conn, 'instrument_platform', process_id) #jobids=None #pipeline_content=None print(pipeline_name, process_id) if pipeline_name.upper() == 'DTU_CGE': jobids, pipeline_content = execute_dtu_cge(process_id, selection_id, prop) elif pipeline_name.upper() == 'EMC_SLIM': jobids, pipeline_content = execute_emc_slim(process_id, selection_id, prop) elif pipeline_name.upper() == 'UANTWERP_BACPIPE': jobids, pipeline_content = execute_uantwerp_bacpipe( process_id, selection_id, prop) elif pipeline_name.upper() == 'RIVM_JOVIAN': jobids, pipeline_content = execute_rivm_jovian(process_id, selection_id, prop) print('*' * 100) print("Pipeline name is:{}".format(pipeline_name.upper())) print('*' * 100) return jobids, pipeline_content
def execute_uantwerp_bacpipe (process_id, selection_id, prop): workdir = prop.workdir + process_id + "/" sample_accession = default_attributes.get_attribute_value(conn, 'sample_accession', process_id) pair = default_attributes.get_attribute_value(conn, 'pair', process_id) print("Test:" + workdir) pair = default_attributes.get_attribute_value(conn, 'pair', process_id) library_layout = 'paired' if pair =='True' else 'single' config = UAntwerpBacpipe.config config['directories']['reads'] = workdir config['directories']['output'] = workdir config['trim_galore']['reads_type'] = library_layout config['spades']['Mode'] = library_layout bacpipe_config = workdir + process_id + '.yaml' try: with open(bacpipe_config, 'w') as config_file: yaml.safe_dump(config, config_file, default_style=None, default_flow_style=False) except yaml.YAMLError as exc: print(exc) print('*'*100) print("Bacpipe Config file:\n{}".format(bacpipe_config)) print(prop.uantwerp_bacpipe_program) print(prop.nproc) print(prop.prokka_program) print('*'*100) bacpipe = UAntwerpBacpipe(workdir, bacpipe_config, prop, sample_accession,pair) jobids = bacpipe.execute() return jobids, bacpipe
def get_datahub_names(conn, process_id): """ Extract the datahub name from SELECTADB_PRODUCTION :param conn: PostGreSQL connection :param process_id: process_id :return: datahub names """ value = default_attributes.get_attribute_value(conn, 'datahub', process_id) return value
def execute_emc_slim(process_id, selection_id, prop): fq1 = os.path.basename( default_attributes.get_attribute_value(conn, 'fastq1', process_id)) fq2 = os.path.basename( default_attributes.get_attribute_value(conn, 'fastq2', process_id)) pair = default_attributes.get_attribute_value(conn, 'pair', process_id) sequencing_platform = default_attributes.get_attribute_value( conn, 'instrument_platform', process_id) run_accession = default_attributes.get_attribute_value( conn, 'run_accession', process_id) sample_accession = default_attributes.get_attribute_value( conn, 'sample_accession', process_id) # TODO: not sure needed by SLIM workdir = prop.workdir + process_id + "/" print("Test:" + workdir) # TODO: sequencing_machine shall be available in the parameters """ Sequencing machine should be named in the metadata file.""" sequencing_machine = get_sequencing_machine(sequencing_platform) slim = EmcSlim(fq1, fq2, prop.emc_slim_property_file, workdir, sequencing_machine, pair, run_accession, prop.emc_slim_program, prop, sequencing_platform, sample_accession) print(slim.fq1, slim.fq2, slim.emc_slim_property_file, slim.workdir, slim.sequencing_machine, slim.sample_accession, slim.pair, slim.run_accession, slim.emc_slim_program, prop.lsf, prop.rmem, prop.lmem) jobids = slim.execute() return jobids, slim
def get_file_names(conn, process_id): """ Get the fastq file names from process_attributes table :param conn: mysql connection :param process_id: :return: fastq files """ value = default_attributes.get_attribute_value(conn, 'fastq_files', process_id) files = list() if ";" in value: files = value.split(";") else: files.append(value) return files
def execute_rivm_jovian(process_id, selection_id, prop): fq1 = os.path.basename(default_attributes.get_attribute_value(conn, 'fastq1', process_id)) fq2 = os.path.basename(default_attributes.get_attribute_value(conn, 'fastq2', process_id)) pair = default_attributes.get_attribute_value(conn, 'pair', process_id) sequencing_platform = default_attributes.get_attribute_value(conn, 'instrument_platform', process_id) run_accession = default_attributes.get_attribute_value(conn, 'run_accession', process_id) sample_accession = default_attributes.get_attribute_value(conn, 'sample_accession', process_id) database_dir = prop.dtu_cge_databases workdir = prop.workdir + process_id + "/" sequencing_machine = get_sequencing_machine(sequencing_platform) jovian = RivmJovian(fq1, fq2, workdir, pair, run_accession, prop, sample_accession) print(jovian.fq1, jovian.fq2, jovian.workdir, jovian.pair, jovian.run_accession, jovian.prop, jovian.sample_accession) jobids = jovian.execute() return jobids, jovian
def execute_dtu_cge(process_id, selection_id, prop): fq1 = os.path.basename(default_attributes.get_attribute_value(conn, 'fastq1', process_id)) fq2 = os.path.basename(default_attributes.get_attribute_value(conn, 'fastq2', process_id)) pair = default_attributes.get_attribute_value(conn, 'pair', process_id) sequencing_platform = default_attributes.get_attribute_value(conn, 'instrument_platform', process_id) run_accession = default_attributes.get_attribute_value(conn, 'run_accession', process_id) sample_accession = default_attributes.get_attribute_value(conn, 'sample_accession', process_id) database_dir = prop.dtu_cge_databases workdir = prop.workdir + process_id + "/" print("Test:" + workdir) sequencing_machine = get_sequencing_machine(sequencing_platform) cge = DtuCge(fq1, fq2, database_dir, workdir, sequencing_machine, pair, run_accession, prop, sequencing_platform, sample_accession) print(cge.fq1, cge.fq2, cge.database_dir, cge.workdir, cge.sequencing_machine, cge.pair, cge.sample_accession) #gzip_file, tab_file, error_message , jobids = cge.execute() jobids = cge.execute() return jobids, cge