SNP alleles
From PyPedia
Contents |
[edit] Documentation
Get the two different alleles of a SNP. The parameter SNP is a list of tuples with genotypes. For example if SNP = [(A,A), (A,G), (G,G), (G,A)] the function returns (A,G)
[edit] Parameters
<inputs> <param name="SNP" type="eval" value="" label="Python list of SNPs: "/> <param name="missing" type="data" value="0" label="Character for missing SNP: "/> </inputs>
[edit] Return
A tuple of the two different alleles that comprise this SNP.
[edit] See also
[edit] Code
def SNP_alleles( SNP = None, missing = "0", ): allele_1 = None for gen in SNP: if gen[0] != missing: if not allele_1: allele_1 = gen[0] elif gen[0] != allele_1: return (allele_1, gen[0]) if gen[1] != missing: if not allele_1: allele_1 = gen[1] elif gen[1] != allele_1: return (allele_1, gen[1]) return (allele_1, allele_1)
[edit] Unit Tests
def uni1(): if SNP_alleles([("A","A"), ("A","G"), ("G","G"), ("G","A")]) != ("A", "G"): return 'Edit failed to find the alleles of the SNP: [("A","A"), ("A","G"), ("G","G"), ("G","A")]' return True
[edit] Development Code
def SNP_alleles(): pass
[edit] Permissions
[edit] Documentation Permissions
Kantale
[edit] Code Permissions
Kantale
[edit] Unit Tests Permissions
Kantale