Ejemplo n.º 1
0
 def _make_labeler(self, variants, confident_regions):
   return customized_classes_labeler.CustomizedClassesVariantLabeler(
       truth_vcf_reader=vcf.InMemoryVcfReader(variants),
       confident_regions=confident_regions,
       classes_list=CUSTOMIZED_CLASSES_LIST,
       info_field_name=CUSTOMIZED_INFO_FIELD_NAME
   )
Ejemplo n.º 2
0
    def _make_labeler_from_options(self):
        """Creates the labeler from options."""
        truth_vcf_reader = vcf.VcfReader(
            self.options.truth_variants_filename,
            excluded_format_fields=['GL', 'GQ', 'PL'])
        confident_regions = read_confident_regions(self.options)

        if (self.options.labeler_algorithm ==
                deepvariant_pb2.DeepVariantOptions.POSITIONAL_LABELER):
            return positional_labeler.PositionalVariantLabeler(
                truth_vcf_reader=truth_vcf_reader,
                confident_regions=confident_regions)
        elif (self.options.labeler_algorithm ==
              deepvariant_pb2.DeepVariantOptions.HAPLOTYPE_LABELER):
            return haplotype_labeler.HaplotypeLabeler(
                truth_vcf_reader=truth_vcf_reader,
                ref_reader=self.ref_reader,
                confident_regions=confident_regions)
        elif (self.options.labeler_algorithm ==
              deepvariant_pb2.DeepVariantOptions.CUSTOMIZED_CLASSES_LABELER):
            if (not FLAGS.customized_classes_labeler_classes_list
                    or not FLAGS.customized_classes_labeler_info_field_name):
                raise ValueError(
                    'For -labeler_algorithm=customized_classes_labeler, '
                    'you need to set '
                    '-customized_classes_labeler_classes_list and '
                    '-customized_classes_labeler_info_field_name.')
            return customized_classes_labeler.CustomizedClassesVariantLabeler(
                truth_vcf_reader=truth_vcf_reader,
                confident_regions=confident_regions,
                classes_list=FLAGS.customized_classes_labeler_classes_list,
                info_field_name=FLAGS.
                customized_classes_labeler_info_field_name)
        else:
            raise ValueError('Unexpected labeler_algorithm',
                             self.options.labeler_algorithm)