コード例 #1
0
def test_seqalleles():
    chroms = [blank_chromosome(2) for x in range(2)]
    seqalleles = '1 2 1 1 2 2 2 1'.split()
    gts = genotypes_from_sequential_alleles(chroms, seqalleles)
    
    # Test to make sure the types returned are correct
    assert all(type(x) is Alleles for x in chain.from_iterable(gts))

    # Test to make sure the values are correct
    assert (gts[0][0] == ['1','1']).all()
    assert (gts[0][1] == ['2','1']).all()
    assert (gts[1][0] == ['2','2']).all()
    assert (gts[1][1] == ['2','1']).all()
コード例 #2
0
ファイル: test_io.py プロジェクト: y-chai/pydigree
def test_seqalleles():
    chroms = [blank_chromosome(2) for x in range(2)]
    seqalleles = '1 2 1 1 2 2 2 1'.split()
    gts = genotypes_from_sequential_alleles(chroms, seqalleles)
    
    # Test to make sure the types returned are correct
    assert all(type(x) is Alleles for x in chain.from_iterable(gts))

    # Test to make sure the values are correct
    assert (gts[0][0] == ['1','1']).all()
    assert (gts[0][1] == ['2','1']).all()
    assert (gts[1][0] == ['2','2']).all()
    assert (gts[1][1] == ['2','1']).all()
コード例 #3
0
    def data_handler(ind, data):

        # Handle the phenotypes first
        phendata = data[phenotype_indices]
        for phenotype, value in zip(phenotypes, phendata):
            kind, label = phenotype
            if kind == 'A':
                value = True if value == '1' else False
            else:
                value = float(value) if '.' in value else int(value)
            ind.phenotypes[label] = value

        gts = data[genotype_indices]
        ind.genotypes = genotypes_from_sequential_alleles(chromsomes,
                                                          gts,
                                                          missing_code='X')
コード例 #4
0
def test_seqalleles_raiseforbadmissingval():
    chroms = [blank_chromosome(2) for x in range(2)]
    seqalleles = '1 2 1 1 2 2 2 1'.split()
    gts = genotypes_from_sequential_alleles(chroms, seqalleles, missing_code=0)
コード例 #5
0
ファイル: test_io.py プロジェクト: y-chai/pydigree
def test_seqalleles_raiseforbadmissingval():
    chroms = [blank_chromosome(2) for x in range(2)]
    seqalleles = '1 2 1 1 2 2 2 1'.split()
    gts = genotypes_from_sequential_alleles(chroms, seqalleles, missing_code=0)
コード例 #6
0
ファイル: plink.py プロジェクト: jameshicks/pydigree
def plink_data_handler(ind, data):
    """ A function to handle the data payload from a plink line """
    ind.genotypes = genotypes_from_sequential_alleles(ind.chromosomes, data, missing_code="0")