hapsburg.emissions_lowmem ========================= .. py:module:: hapsburg.emissions_lowmem .. autoapi-nested-parse:: Class for calculating Emission Probabilities in a memory-efficient way. Specifically, it computes emission probability for the non-ROH state and the ROH state (only two states, 0 or 1). The original implementation computes the emission probability for all ROH states, which scales linearly with the number of haplotypes in the reference panel. Contains Sub-Classes, as well as a factory Method. @ Author: Yilei Huang, 2024, All rights reserved Classes ------- .. autoapisummary:: hapsburg.emissions_lowmem.Emissions hapsburg.emissions_lowmem.Model_Emissions hapsburg.emissions_lowmem.RC_Model_Emissions hapsburg.emissions_lowmem.Diploid_GT_Emissions hapsburg.emissions_lowmem.RC_Model_Emissions_withContamination Functions --------- .. autoapisummary:: hapsburg.emissions_lowmem.load_emission_model_lowmem Module Contents --------------- .. py:class:: Emissions(ref_haps=[], blocksize=8, overhang=0) Bases: :py:obj:`object` Class for emission probabilities Has methods to return emission probabilities .. py:attribute:: p :value: [] .. py:attribute:: ref_haps :value: [] .. py:attribute:: e_rate :value: 0.01 .. py:attribute:: e_rate_ref :value: 0.001 .. py:attribute:: overhang :value: 0 .. py:attribute:: blocksize :value: 8 .. py:method:: allele_freq_per_block(gts_one_block) Calculate allele frequency per block. Return 1D array of length blocksize .. py:method:: calc_allelefreq_blockwise() Calculate allele frequency for all markers in ref_haps, blockwise .. py:method:: give_emission(ob_stat) :abstractmethod: Gives the emission matrix of path of states Return emission matrix [3,l] .. py:method:: set_params(**kwargs) Set the Parameters. Takes keyworded arguments .. py:class:: Model_Emissions(ref_haps=[], blocksize=8, overhang=0) Bases: :py:obj:`Emissions` Implements the haploid model Emission probabilities .. py:method:: give_emission(ob_stat) Return the full emission Probability directly in Log Space. ob_stat: Observed Genotypes [2,l] (only use 1st row) .. py:class:: RC_Model_Emissions(ref_haps=[], blocksize=8, overhang=0) Bases: :py:obj:`Emissions` Implements the Read Count model Emission probabilities. .. py:method:: give_emission(ob_stat) Gives the emission matrix of path of states Return emission matrix [3,l] .. py:class:: Diploid_GT_Emissions(ref_haps=[], blocksize=8, overhang=0) Bases: :py:obj:`Emissions` Implements the Diploid Genotype model Emission probabilities. .. py:method:: give_emission(ob_stat) Gives the emission matrix of path of states Return emission matrix [3,l] .. py:class:: RC_Model_Emissions_withContamination(ref_haps, c, pCon, blocksize=8, overhang=0) Bases: :py:obj:`Emissions` Class for emission probabilities Has methods to return emission probabilities .. py:attribute:: c :value: 0.0 .. py:attribute:: pCon :value: [] .. py:method:: give_emission(ob_stat) Gives the emission matrix of path of states Return emission matrix [3,l] .. py:function:: load_emission_model_lowmem(ref_states, e_model='haploid', c=0.0, pCon=[], overhang=0) Load the Emission Model