dae.variants_loaders.raw package
Subpackages
- dae.variants_loaders.raw.tests package
- Submodules
- dae.variants_loaders.raw.tests.test_annotation_decorators module
- dae.variants_loaders.raw.tests.test_base_loader module
- dae.variants_loaders.raw.tests.test_best_state_calc module
- dae.variants_loaders.raw.tests.test_families_genotypes_decorator module
- dae.variants_loaders.raw.tests.test_flexible_variant_loader module
- dae.variants_loaders.raw.tests.test_stored_annotation_decorator module
- Module contents
Submodules
dae.variants_loaders.raw.flexible_variant_loader module
- dae.variants_loaders.raw.flexible_variant_loader.adjust_chrom_prefix(add_chrom_prefix: str | None = None, del_chrom_prefix: str | None = None) Callable[[Dict[str, Any]], Dict[str, Any]] [source]
Return a function that adds/removes a prefix to/from chrom names.
- dae.variants_loaders.raw.flexible_variant_loader.flexible_variant_loader(infile: TextIO, in_header: List[str], line_splitter: Callable, transformers: Sequence[Callable[[Dict[str, Any]], Dict[str, Any]]], filters: Sequence[Callable[[Dict[str, Any]], bool]]) Generator[Dict[str, Any], None, None] [source]
Split,transform and filter each line from infile.
- dae.variants_loaders.raw.flexible_variant_loader.location_variant_to_vcf_transformer(genome: ReferenceGenome) Callable[[Dict[str, Any]], Dict[str, Any]] [source]
Return a function extracting chrom,pos,ref,alt from a vcf variant.
dae.variants_loaders.raw.loader module
Base classes and helpers for variant loaders.
- class dae.variants_loaders.raw.loader.AnnotationDecorator(variants_loader: VariantsLoader)[source]
Bases:
VariantsLoaderDecorator
Base class for annotators.
- CLEAN_UP_COLUMNS = {'alternatives_data', 'best_state_data', 'effect_gene', 'effect_type', 'family_id', 'family_variant_index', 'frequency_data', 'genetic_model_data', 'genomic_scores_data', 'genotype_data', 'inheritance_data', 'variant_in_member', 'variant_inheritance', 'variant_roles', 'variant_sexes'}
- SEP1 = '!'
- SEP2 = '|'
- SEP3 = ':'
- static build_annotation_filename(filename: str) str [source]
Return the corresponding annotation file for filename.
- static save_annotation_file(variants_loader: AnnotationPipelineDecorator, filename: str, sep: str = '\t') None [source]
Save annotation file.
- class dae.variants_loaders.raw.loader.AnnotationPipelineDecorator(variants_loader: VariantsLoader, annotation_pipeline: AnnotationPipeline)[source]
Bases:
AnnotationDecorator
Annotate variants by processing them through an annotation pipeline.
- property annotation_schema: list[AttributeInfo]
- full_variants_iterator() Generator[tuple[SummaryVariant, list[FamilyVariant]], None, None] [source]
- class dae.variants_loaders.raw.loader.ArgumentType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
Enum
- ARGUMENT = 1
- OPTION = 2
- class dae.variants_loaders.raw.loader.CLIArgument(argument_name: str, has_value: bool = True, default_value: int | str | bool | None = None, destination: str | None = None, help_text: str | None = None, action: str | None = None, value_type: Type[str] | None = None, metavar: str | None = None, nargs: str | None = None, raw: bool = False)[source]
Bases:
object
Defines class for handling CLI arguments in variant loaders.
This class handles the logic for CLI argument operations such as parsing arguments, transforming to dict, transforming a parsed argument back to a CLI argument and adding itself to an existing ArgumentParser. Construction closely mirrors the ArgumentParser argument format.
- class dae.variants_loaders.raw.loader.CLILoader(params: dict[str, Any] | None = None)[source]
Bases:
ABC
Base class for loader classes that require cli arguments.
- build_arguments_dict() Dict[str, str | bool] [source]
Build a dictionary with the argument destinations as keys.
- classmethod cli_arguments(parser: ArgumentParser, options_only: bool = False) None [source]
Add command-line arguments specific for the CLILoader class.
- Args:
- parser (argparse.ArgumentParser): The ArgumentParser object to
add the arguments to.
options_only (bool, optional): If True, only adds options (not arguments) to the parser. Defaults to False.
- class dae.variants_loaders.raw.loader.EffectAnnotationDecorator(variants_loader: VariantsLoader, effect_annotator: AnnotationPipeline)[source]
Bases:
AnnotationDecorator
Annotate variants with an effect.
- full_variants_iterator() Generator[tuple[SummaryVariant, list[FamilyVariant]], None, None] [source]
- class dae.variants_loaders.raw.loader.FamiliesGenotypes[source]
Bases:
ABC
A base class for family genotypes.
- class dae.variants_loaders.raw.loader.StoredAnnotationDecorator(variants_loader: VariantsGenotypesLoader, annotation_filename: str)[source]
Bases:
AnnotationDecorator
Annotate variant using a stored annotator.
- static decorate(variants_loader: VariantsGenotypesLoader, source_filename: str) VariantsLoader [source]
Wrap variants_loader into a StoredAnnotationDecorator.
- full_variants_iterator() Generator[tuple[SummaryVariant, list[FamilyVariant]], None, None] [source]
- class dae.variants_loaders.raw.loader.VariantsGenotypesLoader(families: FamiliesData, filenames: str | list[str], genome: ReferenceGenome, transmission_type: TransmissionType = TransmissionType.transmitted, regions: List[str] | None = None, expect_genotype: bool = True, expect_best_state: bool = False, params: Dict[str, Any] | None = None)[source]
Bases:
VariantsLoader
Base class for variants loaders.
Calculate missing best states and adds a genetic model value to the family variant and its alleles.
- full_variants_iterator() Generator[tuple[SummaryVariant, list[FamilyVariant]], None, None] [source]
- class dae.variants_loaders.raw.loader.VariantsLoader(families: FamiliesData, filenames: str | list[str], genome: ReferenceGenome, transmission_type: TransmissionType = TransmissionType.transmitted, params: Dict[str, Any] | None = None, attributes: Dict[str, Any] | None = None)[source]
Bases:
CLILoader
Base class for all variant loaders.
- property annotation_schema: list[AttributeInfo] | None
- abstract property chromosomes: list[str]
Return list of all chromosomes.
- family_variants_iterator() Generator[FamilyVariant, None, None] [source]
- abstract full_variants_iterator() Generator[tuple[SummaryVariant, list[FamilyVariant]], None, None] [source]
- property variants_filenames: list[str]
- class dae.variants_loaders.raw.loader.VariantsLoaderDecorator(variants_loader: VariantsLoader)[source]
Bases:
VariantsLoader
Base class for wrapping and decoring a variant loader.
- property annotation_schema: list[AttributeInfo] | None
- property chromosomes: list[str]
Return list of all chromosomes.
- classmethod cli_arguments(parser: ArgumentParser, options_only: bool = False) None [source]
Add command-line arguments specific for the CLILoader class.
- Args:
- parser (argparse.ArgumentParser): The ArgumentParser object to
add the arguments to.
options_only (bool, optional): If True, only adds options (not arguments) to the parser. Defaults to False.