Data Integrator (Python API)
Public Member Functions | Static Public Attributes | List of all members
cls.MendelianFiltering.CMendelianFiltering Class Reference

Public Member Functions

def __init__ (s, vcfReader, pedReader, pen, det, mode, minCov, missing, perm)
 Constructor. More...
 
def GetListEntries (s, theList, positions)
 Returns a list that contains the elements of theList at positions positions. More...
 
def ParsePedfile (s, pedReader, vcfReader)
 Extract sample phenotypes from the pedfile. More...
 
def GetGenotypes (s, variantLine)
 Returns two list of genotypes for all samples in variantLine. More...
 
def GetIntersectInds (s, list1, list2)
 Returns a list of indices of elements of list1 that are also in list2. More...
 
def InGenotypeGroup (s, g1, g2, mode)
 Returns if g1 is in a genotype group with g2. More...
 
def IsRetained (s, pos, genotypes, alleles, mode)
 Returns, if the variant is retained and the p-value of the Fisher test. More...
 
def InRegion (s, pos, mode)
 Returns if the position is valid for this mode. More...
 
def DoMendelianFiltrationOne (s)
 Perform the Mendelian Filtration for s.mode as mode of inheritance. More...
 
def DoMendelianFiltrationAll (s, allModes)
 Perform the Mendelian Filtration for all possible modi of inheritance. More...
 
def DoMendelianFiltrationAny (s, allModes)
 Perform the Mendelian Filtration for any mode of inherintace. More...
 

Static Public Attributes

dictionary GenotypesPerMode
 
dictionary RegionsPerMode
 
dictionary FormatIndx2ArrayIndx = {}
 
dictionary Phenotype = {"affected": [], "unaffected": []}
 

Detailed Description

 The genotypes that are expected of causal variants in affected samples.
 It must be one of the following:
 * homRef: homozygous reference
 * homAlt: homozygous alternative
 * hetRefAlt: heterozygous reference / alternative
 * hetAltAlt: heterozygous alternative / alternative
 * hemRef: hemizygous reference / -
 * hemAlt: hemizygous alternative / -
 * unk: unknown genotype. This occurs for example, when a genotype call is
   not accepted due to small coverage. It is not correct to assume
   homRef then.

Constructor & Destructor Documentation

◆ __init__()

def cls.MendelianFiltering.CMendelianFiltering.__init__ (   s,
  vcfReader,
  pedReader,
  pen,
  det,
  mode,
  minCov,
  missing,
  perm 
)

Constructor.

    @param vcfReader  Instance of cls.DefaultTable.CVcfTableReader.
    @param pedReader  Instance of cls.DefaultTable.CDefaultTableReader.
    @param pen  The penetrance of the disease.
    @param det  The detectance of the disease.
    @param mode The Mendelian mode of inherintace.
                One of cmd.MendelianFiltrator.INHERITANCEMODELS
    @param minCov The minimal coverage to accept a called variant.
    @param missing If true variants that have missing genotypes will not
                suffice the inherintace model.

Member Function Documentation

◆ DoMendelianFiltrationAll()

def cls.MendelianFiltering.CMendelianFiltering.DoMendelianFiltrationAll (   s,
  allModes 
)

Perform the Mendelian Filtration for all possible modi of inheritance.

    Perform the Mendelian Filtration for all possible modi of inheritance.
    Write each variant from the input to the output and add a column for
    each mode of inheritance, which holds 1, if the variant is retained
    for this mode of inheritance and 0, if the variant is exluded for
    this mode of inheritance.
    @param allModes  All modes of inheritance. Currently
    cmd.MendelianFiltrator.INHERITANCEMODELS

◆ DoMendelianFiltrationAny()

def cls.MendelianFiltering.CMendelianFiltering.DoMendelianFiltrationAny (   s,
  allModes 
)

Perform the Mendelian Filtration for any mode of inherintace.

    Perform the Mendelian Filtration for any mode of inherintace. Output a
    variant line, if it suffices any model of inherintace. The VCF file
    format is retained.
    @param allModes  All modes of inheritance. Currently
    cmd.MendelianFiltrator.INHERITANCEMODELS

◆ DoMendelianFiltrationOne()

def cls.MendelianFiltering.CMendelianFiltering.DoMendelianFiltrationOne (   s)

Perform the Mendelian Filtration for s.mode as mode of inheritance.

    Perform the Mendelian Filtration for s.mode as the mode of inheritance.
    Only write the variants to the output file which suffice the assumtions
    of the model regarding the mode, penetrance, and detectance.

◆ GetGenotypes()

def cls.MendelianFiltering.CMendelianFiltering.GetGenotypes (   s,
  variantLine 
)

Returns two list of genotypes for all samples in variantLine.

    Returns a tuple of two lists, which hold the genotype information
    for all samples in the order they are listed in the vcfReader.FirstLine
    1st list: genotypeList = [hem_alt, hom_alt, ...]
    2nd list: alleleList = [[1], [2,2], ...]
    @param variantLine  A line from the input vcf file.
    @return  A tuple of two lists.

◆ GetIntersectInds()

def cls.MendelianFiltering.CMendelianFiltering.GetIntersectInds (   s,
  list1,
  list2 
)

Returns a list of indices of elements of list1 that are also in list2.

Parameters
list1The first list from which to return the indices.
list2The second list which to compare list1 to.

◆ GetListEntries()

def cls.MendelianFiltering.CMendelianFiltering.GetListEntries (   s,
  theList,
  positions 
)

Returns a list that contains the elements of theList at positions positions.

Parameters
theList
positions
Returns
A list that contains the elements of theList at positions positions

◆ InGenotypeGroup()

def cls.MendelianFiltering.CMendelianFiltering.InGenotypeGroup (   s,
  g1,
  g2,
  mode 
)

Returns if g1 is in a genotype group with g2.

    Returns, if g1 and g2 have the same effect of the phenotype with
    respect to the mode. E.g. g1=[1,1] and mode = autDom. Then return
    true for g2=[0,1] (because g2 has THE alt allele 1 and that suffices
    for dominant), but g2=[2,2] returns false, because 2 is another alt
    allele than 1, even though it is hom_alt.
    @param g1  Genotype 1
    @param g2  Genotype 2
    @param mode  The Mendelian mode under which to compare g1 and g2.
    @return  @c True, if g1 is in a genotype group with g2, @c False else.

◆ InRegion()

def cls.MendelianFiltering.CMendelianFiltering.InRegion (   s,
  pos,
  mode 
)

Returns if the position is valid for this mode.

   Returns if the genomic position pos is inside the regions defined
   by s.RegionsPerMode for the given mode
   @param pos  @c List The genomic position to check as [CHR, COORD]
   @param mode The Mendelian mode of inheritance. One of
               s.RegionsPerMode.keys()
   @return @c True, if pos is inside the regions defined in
              s.RegionsPerMode. @c False, else.

◆ IsRetained()

def cls.MendelianFiltering.CMendelianFiltering.IsRetained (   s,
  pos,
  genotypes,
  alleles,
  mode 
)

Returns, if the variant is retained and the p-value of the Fisher test.

Returns a tuple of (boolean, float). First value is true, if the variant is retained under the given mode for the given samples, False, if the variant does not suffice the assumptions of the model. Second value is the p-value of the Fisher exact test with the null hypothesis that the genotypes are equally distributed between affected and unaffected samples.

Parameters
posThe genomic position as a list. Format [CHR, COORD]
genotypesList The return value of s.GetGenotypes[0]
allelesList The return value of s.GetGenotypes[1]
modeThe Medelian mode of inheritance. One of cmd.MendelianFiltrator.INHERITANCEMODELS
Returns
True, if the variant is retained. False, if the variant is filtered out.

◆ ParsePedfile()

def cls.MendelianFiltering.CMendelianFiltering.ParsePedfile (   s,
  pedReader,
  vcfReader 
)

Extract sample phenotypes from the pedfile.

Parameters
pedReaderThe pedegree reader
vcfReaderThe VCF reader

Member Data Documentation

◆ FormatIndx2ArrayIndx

dictionary cls.MendelianFiltering.CMendelianFiltering.FormatIndx2ArrayIndx = {}
static

◆ GenotypesPerMode

dictionary cls.MendelianFiltering.CMendelianFiltering.GenotypesPerMode
static
Initial value:
= {"autRec": ["homAlt", "hemAlt"],
"autDom": ["hetRefAlt", "hetAltAlt", "hemAlt", "homAlt"],
"xRec": ["homAlt", "hemAlt"],
"xDom": ["homAlt","hemAlt","hetRefAlt","hetAltAlt"],
"mt": ["hemAlt"]
}

◆ Phenotype

dictionary cls.MendelianFiltering.CMendelianFiltering.Phenotype = {"affected": [], "unaffected": []}
static

◆ RegionsPerMode

dictionary cls.MendelianFiltering.CMendelianFiltering.RegionsPerMode
static
Initial value:
= {"autRec": __Aut, "autDom": __Aut,
"xRec": __X, "xDom": __X,
"mt": [["MT"]]}

The documentation for this class was generated from the following file: