Beispiel #1
0
def run(project):
	logging.info('Beginning featureCounts component of pipeline.')

	# get the location of the utils directory:
	utils_dir = project.parameters.get('utils_dir')

	# load the parser and the util_methods modules:
	config_parser = component_utils.load_remote_module('config_parser', utils_dir)
	util_methods = component_utils.load_remote_module('util_methods', utils_dir)

	# parse this module's config file
	component_utils.parse_config_file(project, util_methods, config_parser, os.path.dirname(os.path.realpath(__file__)))

	# create a full path to the output directory for the featureCount's output and reset the parameter in the project parameters:
	output_dir = os.path.join(project.parameters.get('output_location'), project.parameters.get('feature_counts_output_dir'))
	project.parameters.reset_param('feature_counts_output_dir', output_dir)

	# create the final output directory, if possible
	util_methods.create_directory(output_dir)

	# start the counting:
	execute_counting(project, util_methods)

	# create the final, unnormalized count matrices for each set of BAM files
	merged_count_files = create_count_matrices(project, util_methods)
	
	# add to the project object:
	project.count_matrices = merged_count_files
Beispiel #2
0
def run(project):

    # get the location of the utils directory:
    utils_dir = project.parameters.get('utils_dir')

    # load the parser and the util_methods modules:
    config_parser = component_utils.load_remote_module('config_parser',
                                                       utils_dir)
    util_methods = component_utils.load_remote_module('util_methods',
                                                      utils_dir)

    # parse this module's config file
    component_utils.parse_config_file(
        project, util_methods, config_parser,
        os.path.dirname(os.path.realpath(__file__)))

    # create a full path to the output directory for the output and reset the parameter in the project parameters:
    output_dir = os.path.join(
        project.parameters.get('output_location'),
        project.parameters.get('normalized_counts_output_dir'))
    project.parameters.reset_param('normalized_counts_output_dir', output_dir)

    # create the final output directory, if possible
    util_methods.create_directory(output_dir)

    # perform the actual normalization:
    normalize(project)
Beispiel #3
0
def run(project):

    # get the location of the utils directory:
    utils_dir = project.parameters.get('utils_dir')

    # load the parser and the util_methods modules:
    config_parser = component_utils.load_remote_module('config_parser',
                                                       utils_dir)
    util_methods = component_utils.load_remote_module('util_methods',
                                                      utils_dir)
Beispiel #4
0
def run(name, project):
	logging.info('Beginning DESeq differential expression analysis...')

	# get the location of the utils directory:
	utils_dir = project.parameters.get('utils_dir')

	# load the util_methods module:
	util_methods = component_utils.load_remote_module('util_methods', utils_dir)

	# parse this module's config file
	this_dir = os.path.dirname(os.path.realpath(__file__))
	project.parameters.add(component_utils.parse_config_file(project, this_dir))
	component_params = component_utils.parse_config_file(project, this_dir, 'COMPONENT_SPECIFIC')

	# create a full path to the output directory for the output:
	output_dir = os.path.join(project.parameters.get('output_location'), component_params.get('deseq_output_dir'))
	component_params['deseq_output_dir']  = output_dir 

	# create the final output directory, if possible
	util_methods.create_directory(output_dir, overwrite = True)

	deseq_output_files, heatmap_files = call_deseq(project, component_params)

	# write a summary of the number of differentially expressed genes
	create_diff_exp_summary(deseq_output_files, project, component_params)

	# change permissions:
	[os.chmod(f,0775) for f in deseq_output_files.values()]
Beispiel #5
0
def run(name, project):

    # get the location of the utils directory:
    utils_dir = project.parameters.get('utils_dir')

    # load the util_methods module:
    util_methods = component_utils.load_remote_module('util_methods',
                                                      utils_dir)

    # parse this module's config file
    this_dir = os.path.dirname(os.path.realpath(__file__))
    project.parameters.add(component_utils.parse_config_file(
        project, this_dir))
    component_params = component_utils.parse_config_file(
        project, this_dir, 'COMPONENT_SPECIFIC')

    # create a full path to the output directory for the output and reset the parameter in the project parameters:
    output_dir = os.path.join(
        project.parameters.get('output_location'),
        component_params.get('normalized_counts_output_dir'))
    component_params['normalized_counts_output_dir'] = output_dir

    # create the final output directory, if possible
    util_methods.create_directory(output_dir, overwrite=True)

    # perform the actual normalization:
    output_files = normalize(project, component_params)

    logging.info('Done with normalize.  Output files: %s' % output_files)
    # change permissions on those output files:
    [os.chmod(f, 0775) for f in output_files.values()]
Beispiel #6
0
def run(name, project):
    logging.info('Beginning creation of custom latex report')

    # get the location of the utils directory:
    utils_dir = project.parameters.get('utils_dir')

    # load the util_methods module:
    util_methods = component_utils.load_remote_module('util_methods',
                                                      utils_dir)

    # parse this module's config file
    this_dir = os.path.dirname(os.path.realpath(__file__))
    project.parameters.add(component_utils.parse_config_file(
        project, this_dir))
    component_params = component_utils.parse_config_file(
        project, this_dir, 'COMPONENT_SPECIFIC')

    # TODO: generate report when we didn't align-- use samtools, etc. to get alignment stats
    if project.parameters.get(
            'aligner') == 'star' and not project.parameters.get('skip_align'):
        extra_params = component_utils.parse_config_file(
            project, this_dir, 'STAR')
    else:
        raise PdfReportNotConfiguredForAlignerException(
            'Please configure the pdf report generator for this particular aligner.'
        )

    # create a full path to the output directory for the output:
    output_dir = os.path.join(project.parameters.get('output_location'),
                              component_params.get('report_output_dir'))
    component_params['report_output_dir'] = output_dir

    # create the final output directory, if possible
    util_methods.create_directory(output_dir, overwrite=True)

    # read template
    env = jinja2.Environment(loader=jinja2.FileSystemLoader(this_dir))
    template = env.get_template(component_params.get('report_template'))
    output_file = create_report(template, project, component_params,
                                extra_params)

    # change permissions:
    os.chmod(output_file, 0775)

    # have to give the constructor of ComponentOutput a dictionary
    output_file_map = {os.path.basename(output_file): output_file}

    # create the ComponentOutput object and return it
    logging.info('Preparing ComponentOutput for latex report module')
    c1 = component_utils.ComponentOutput(
        output_file_map, component_params.get('report_tab_title'),
        component_params.get('report_header_msg'),
        component_params.get('report_display_format'))
    return [c1]
Beispiel #7
0
def run(name, project):
    logging.info('Beginning GSEA component.')

    # get the location of the utils directory:
    utils_dir = project.parameters.get('utils_dir')

    # load the parser and the util_methods modules:
    util_methods = component_utils.load_remote_module('util_methods',
                                                      utils_dir)

    # parse this module's config file
    this_dir = os.path.dirname(os.path.realpath(__file__))
    project.parameters.add(component_utils.parse_config_file(
        project, this_dir))
    component_params = component_utils.parse_config_file(
        project, this_dir, 'COMPONENT_SPECIFIC')

    if project.parameters.get('genome') in component_params.get(
            'acceptable_genomes'):

        # create a full path to the output directory for GSEA's output:
        output_dir = os.path.join(project.parameters.get('output_location'),
                                  component_params.get('gsea_output_dir'))
        component_params['gsea_output_dir'] = output_dir

        # create the final output directory, if possible
        logging.info('Creating output directory at %s' % output_dir)
        util_methods.create_directory(output_dir, overwrite=True)

        # create the cls and gct files for input to GSEA:
        logging.info('About to create the CLS and GCT files')
        create_input_files(project, component_params)

        # run it:
        logging.info('Actually run GSEA')
        output = run_gsea(project, component_params, util_methods)

        return [
            component_utils.ComponentOutput(
                output, component_params.get('tab_title'),
                component_params.get('header_msg'),
                component_params.get('display_format')),
        ]
    else:
        # return a list of None if we shouldn't run GSEA for this genome
        return [
            None,
        ]
Beispiel #8
0
def run(name, project):
    logging.info('Beginning featureCounts component of pipeline.')

    # get the location of the utils directory:
    utils_dir = project.parameters.get('utils_dir')

    # load the parser and the util_methods modules:
    util_methods = component_utils.load_remote_module('util_methods',
                                                      utils_dir)

    # parse this module's config file
    this_dir = os.path.dirname(os.path.realpath(__file__))
    project.parameters.add(component_utils.parse_config_file(
        project, this_dir))
    component_params = component_utils.parse_config_file(
        project, this_dir, 'COMPONENT_SPECIFIC')

    # create a full path to the output directory for the featureCount's output:
    output_dir = os.path.join(
        project.parameters.get('output_location'),
        component_params.get('feature_counts_output_dir'))
    component_params['feature_counts_output_dir'] = output_dir

    # create the final output directory, if possible
    util_methods.create_directory(output_dir, overwrite=True)

    # start the counting:
    execute_counting(project, component_params, util_methods)

    # create the final, unnormalized count matrices for each set of BAM files
    merged_count_files = create_count_matrices(project, component_params,
                                               util_methods)

    # add these common files to the project object (so that other components have access to them):
    project.raw_count_matrices = merged_count_files

    # change permissions on all those:
    [os.chmod(f, 0775) for f in merged_count_files]
Beispiel #9
0
def run(name, project):
    logging.info('Beginning rnaSeQC component of pipeline.')

    # get the location of the utils directory:
    utils_dir = project.parameters.get('utils_dir')

    # load the parser and the util_methods modules:
    util_methods = component_utils.load_remote_module('util_methods',
                                                      utils_dir)

    # parse this module's config file
    this_dir = os.path.dirname(os.path.realpath(__file__))
    project.parameters.add(component_utils.parse_config_file(
        project, this_dir))
    component_params = component_utils.parse_config_file(
        project, this_dir, 'COMPONENT_SPECIFIC')
    component_params.update(
        component_utils.parse_config_file(project, this_dir,
                                          project.parameters.get('genome')))

    # create a full path to the output directory for rnaseQC's output:
    output_dir = os.path.join(project.parameters.get('output_location'),
                              component_params.get('rnaseqc_output_dir'))

    # create the final output directory, if possible
    util_methods.create_directory(output_dir, overwrite=True)

    # run the QC processes:
    reports = run_qc(project, component_params, util_methods)

    return [
        component_utils.ComponentOutput(
            reports, component_params.get('tab_title'),
            component_params.get('header_msg'),
            component_params.get('display_format')),
    ]