示例#1
0
    def __init__(self, config, genomes_db):
        super(VariantAnnotatorBase, self).__init__(config, genomes_db)

        if self.config.options.vcf:
            self.variant_builder = VCFBuilder(self.config,
                                              self.genomic_sequence)
        else:
            self.variant_builder = DAEBuilder(self.config,
                                              self.genomic_sequence)

        if not self.config.virtual_columns:
            self.config = GPFConfigParser.modify_tuple(
                self.config,
                {
                    "virtual_columns": [
                        "CSHL_location",
                        "CSHL_chr",
                        "CSHL_position",
                        "CSHL_variant",
                        "VCF_chr",
                        "VCF_position",
                        "VCF_ref",
                        "VCF_alt",
                    ]
                },
            )
示例#2
0
    def _build_annotator_for(self, score_name):
        assert os.path.exists(
            self.config.options.scores_directory
        ), self.config.options.scores_directory

        score_filename = self._get_score_file(score_name)

        options = GPFConfigParser.modify_tuple(
            self.config.options, {"scores_file": score_filename}
        )
        columns = {score_name: getattr(self.config.columns, score_name)}

        variant_config = AnnotationConfigParser.parse_section({
                "options": options,
                "columns": columns,
                "annotator": "score_annotator.VariantScoreAnnotator",
                "virtual_columns": [],
            }
        )

        annotator = PositionScoreAnnotator(variant_config, self.genomes_db)
        return annotator