hapsburg.emissions

Class for calculating Emission Probabilities. Contains Sub-Classes, as well as factory Method. @ Author: Harald Ringbauer, 2019, All rights reserved

Attributes

DTYPE

ob_stat

Classes

Emissions

Class for emission probabilities

Model_Emissions

Implements the haploid model Emission probabilities

RC_Model_Emissions

Implements the Read Count model Emission probabilities.

Diploid_GT_Emissions

Implements the Emission probabilities for Diploid Genotype calls.

RC_Model_Emissions_withContamination

Implements the Read Count model Emission probabilities.

Functions

load_emission_model(ref_states[, e_model, c, pCon])

Load the Emission Model

Module Contents

hapsburg.emissions.DTYPE
class hapsburg.emissions.Emissions

Bases: object

Class for emission probabilities Has methods to return emission probabilities

abstractmethod give_emission_matrix(remember=False)

Return Emission Matrix

abstractmethod give_emission_state(ob_stat)

Gives the emission matrix of path of states

set_params(**kwargs)

Set the Parameters. Takes keyworded arguments

class hapsburg.emissions.Model_Emissions(ref_haps=[])

Bases: Emissions

Implements the haploid model Emission probabilities

p = []
ref_haps = []
e_mat = []
e_rate = 0.001
give_emission_matrix(remember=False)

Return full Emission Matrix. dtype: Precision of the returned Matrix

give_emission_state(ob_stat, e_mat)

Gives the emission matrix of observed states Return emission matrix [k,l]

give_emission(ob_stat)

Return the full emission Probability directly in Log Space. ob_stat: Observed Genotypes [2,l] (only use 1st row)

class hapsburg.emissions.RC_Model_Emissions(ref_haps=[])

Bases: Model_Emissions

Implements the Read Count model Emission probabilities. Inherits from Model_Emission, in particular the constructor (Calculation of Mean Allele Frequency from the Reference and ref_haps)

p = []
ref_haps = []
e_mat = []
e_rate = 0.01
e_rate_ref = 0.001
give_emission_matrix(remember=False)

Return Emission Matrix, which describes probabilities in Genotypes [n_ref+1, n_loci, 3]

give_emission_state(ob_stat, e_mat)

Gives the emission matrix of observed states Return emission matrix [n_ref+1, n_loci] of each ob_stat: [2, n_loci] Matrix with Nr Ref/Alt Reads in Row0/Row1 (!) e_mat: Probabilities of genotypes [n_ref+1, n_loci, 3]

give_emission(ob_stat)

Return the full emission Probability directly in Log Space. ob_stat: Observed Readcounts [2,l] array of 0/1

class hapsburg.emissions.Diploid_GT_Emissions(ref_haps=[])

Bases: RC_Model_Emissions

Implements the Emission probabilities for Diploid Genotype calls. Inherits top level Model_Emission, in particular the constructor (Calculation of Mean Allele Frequency from the Reference and ref_haps) and from RC_Model_Emission, in particular the calculation of probabilities of the [n_ref+1, n_loci, 3] genotype probability matrix give_emission_matrix

p = []
ref_haps = []
e_mat = []
e_rate = 0.001
e_rate_ref = 0.0
give_emission_state(ob_stat, e_mat)

Gives the emission matrix of observed states Return emission matrix [n_ref+1, n_loci] of each ob_stat: [2, n_loci] Matrix with 0 or 1 for Ref or Alt e_mat: Probabilities of genotypes [n_ref+1, n_loci, 3]

give_emission(ob_stat, dtype=DTYPE)

Return the full emission Probability directly in Log Space. ob_stat: Observed Readcounts [2,l] array of 0/1

class hapsburg.emissions.RC_Model_Emissions_withContamination(ref_haps=[], c=0.0, pCon=[])

Bases: RC_Model_Emissions

Implements the Read Count model Emission probabilities. Inherits from Model_Emission, in particular the constructor (Calculation of Mean Allele Frequency from the Reference and ref_haps)

c = 0.0
emission_matrix = []
pCon = []
give_emission_matrix(remember=False)

Return Emission Matrix, which describes probabilities in Genotypes [n_ref+1, n_loci, 3]

give_emission_state(ob_stat, e_mat)

Gives the emission matrix of observed states Return emission matrix [n_ref+1, n_loci] of each ob_stat: [2, n_loci] Matrix with Nr Ref/Alt Reads in Row0/Row1 (!) e_mat: Probabilities of genotypes [n_ref+1, n_loci, 3]

give_emission(ob_stat)

Return the full emission Probability directly in Log Space. ob_stat: Observed Readcounts [2,l] array of 0/1 c: contamination rate

hapsburg.emissions.load_emission_model(ref_states, e_model='haploid', c=0.0, pCon=[])

Load the Emission Model

hapsburg.emissions.ob_stat