Ejemplo n.º 1
0
    def run(self):
        'It runs the analysis.'
        inputs, output_dirs = self._get_inputs_and_prepare_outputs()
        db_dir = output_dirs['db_dir']
        pipeline = [annotate_cdna_introns]

        general_settings = self._project_settings['General_settings']

        settings = self._project_settings['Annotation']
        genomic_seqs = settings['Cdna_intron_annotation']['genomic_seq_file']
        if not genomic_seqs:
            msg = 'genomic_seq_file not set for cdna intron annotation'
            raise ValueError(msg)
        if not settings['Cdna_intron_annotation']['genomic_db']:
            project_path = general_settings['project_path']
            genomic_db = make_backbone_blast_db(project_path, genomic_seqs,
                                                dbtype='nucl')
        else:
            genomic_db = settings['Cdna_intron_annotation']['genomic_db']
        configuration = {'annotate_cdna_introns': {'genomic_db':genomic_db,
                                             'genomic_seqs_fhand':genomic_seqs}}

        return self._run_annotation(pipeline=pipeline,
                                    configuration=configuration,
                                    inputs=inputs,
                                    output_dir=db_dir)
Ejemplo n.º 2
0
    def _get_snv_filter_specs(self):
        'It gets the pipeline and configuration from settings'
        configuration = {}
        settings = self._project_settings['snv_filters']
        for filter_data in settings.values():
            if not filter_data['use']:
                continue
            name = filter_data['name']
            unique_name = filter_data['unique_name'] if 'unique_name' in filter_data else name
            filter_config = {}
            for argument, value in filter_data.items():
                if argument == 'use' or argument == 'name':
                    continue
                if name == 'ref_not_in_list':
                    filter_config['seq_list'] = []
                    for item  in open(value):
                        filter_config['seq_list'].append(item.strip())
                else:
                    filter_config[argument] = value
                if name == 'by_kind' and argument == 'kind':
                    filter_config[argument] = self._snv_kind_to_franklin(value)
            filter_config['name'] = name

            #the uniq_continguous filter can have the genomic db not defined
            if (name == 'uniq_contiguous' and
                 ('genomic_db' not in filter_config or
                  not filter_config['genomic_db'])):
                project_path = self._project_settings['General_settings']['project_path']
                genomic_db = make_backbone_blast_db(project_path,
                                            filter_config['genomic_seqs_fpath'],
                                                     dbtype='nucl')
                filter_config['genomic_db'] = genomic_db

            configuration[unique_name] = filter_config
        pipeline = self._get_pipeline_from_step_name(configuration)

        return pipeline, configuration