Filtering Polymorphisms (SNPs and Indels)

Polymorphism filtering is an important part of personalized genomes. By creating your own filters you can easily taylor personalized genomes to your needs. The importaant thing to understand about the filtering process, is that it gives you complete freedom about should be inserted. Once pyGeno finds a polymorphism, it automatically triggers the filter to know what should be inserted at this position, and that can be anything you choose.

class pyGeno.SNPFiltering.DefaultSNPFilter[source]

Default filtering object, does not filter anything. Doesn’t apply insertions or deletions. This is also a template that you can use for own filters. A prototype for a custom filter might be:

class MyFilter(SNPFilter) :
        def __init__(self, thres) :
                self.thres = thres

        def filter(chromosome, SNP_Set1 = None, SNP_Set2 = None ) :
                if SNP_Set1.alt is not None and (SNP_Set1.alt == SNP_Set2.alt) and SNP_Set1.Qmax_gt > self.thres :
                        return SequenceSNP(SNP_Set1.alt)
                return None

Where SNP_Set1 and SNP_Set2 are the actual names of the snp sets supplied to the genome. In the context of the function they represent single polymorphisms, or lists of polymorphisms, derived from thoses sets that occur at the same position.

Whatever goes on into the function is absolutely up to you, but in the end, it must return an object of one of the following classes:

  • SequenceSNP

  • SequenceInsert

  • SequenceDel

  • None

filter(chromosome, **kwargs)[source]

The default filter mixes applied all SNPs and ignores Insertions and Deletions.

class pyGeno.SNPFiltering.SNPFilter[source]

Abtract Class. All filters must inherit from me

class pyGeno.SNPFiltering.SequenceDel(length, sources={}, ref=None, alt='-')[source]

Represents a Deletion to be applied to the sequence

class pyGeno.SNPFiltering.SequenceInsert(bases, sources={}, ref='-')[source]

Represents an Insertion to be applied to the sequence

class pyGeno.SNPFiltering.SequenceSNP(alleles, sources={})[source]

Represents a SNP to be applied to the sequence

class pyGeno.SNPFiltering.Sequence_modifiers(sources={})[source]

Abtract Class. All sequence must inherit from me

addSource(name, snp)[source]

Optional, you can keep a dict that records the polymorphims that were mixed together to make self. They are stored into self.sources