コード例 #1
0
def collect_data(regions, pcode='p1'):
    '''Get the trees in JSON'''
    username = os.path.split(os.getenv('HOME'))[-1]
    foldername = get_figure_folder(username, 'first')
    fn_data = foldername+'data/'

    print fn_data

    data = []
    for region in regions:
        fn = fn_data+'haplotype_tree_'+pcode+'_'+region+'.json'
        data.append({'region': region,
                     'pcode': pcode,
                     'tree': tree_from_json(fn)})

    return data
コード例 #2
0
def collect_data(regions, pcode='p1'):
    '''Get the trees in JSON'''
    username = os.path.split(os.getenv('HOME'))[-1]
    foldername = get_figure_folder(username, 'first')
    fn_data = foldername + 'data/'

    print fn_data

    data = []
    for region in regions:
        fn = fn_data + 'haplotype_tree_' + pcode + '_' + region + '.json'
        data.append({
            'region': region,
            'pcode': pcode,
            'tree': tree_from_json(fn)
        })

    return data
コード例 #3
0
        for frac, total, num_std, denom_std in zip(fraction, rev_div.loc[:,'divergence'],reversion_std, total_div_std):
            print frac, '+/-', np.sqrt(num_std**2/total**2 + denom_std**2*frac**2/total**2)
        #print reversion_std,total_div_std
        print "Consensus!=Founder:",np.mean(data[subtype]['consensus_distance'].values())


if __name__=="__main__":
    import argparse
    import matplotlib.pyplot as plt
    import pandas as pd
    parser = argparse.ArgumentParser(description="make figure")
    parser.add_argument('--redo', action = 'store_true', help = 'recalculate data')
    params=parser.parse_args()

    username = os.path.split(os.getenv('HOME'))[-1]
    foldername = get_figure_folder(username, 'first')
    fn_data = foldername+'data/'
    fn_data = fn_data + 'to_away.pickle'
    
    if not os.path.isfile(fn_data) or params.redo:
        #patients = ['p1', 'p6'] # other subtypes
        patients = ['p1', 'p2', 'p3','p5', 'p6', 'p8', 'p9','p10', 'p11'] # all subtypes
        regions = ['genomewide']
        #regions = ['gag', 'pol', 'nef'] #, 'env']
        #regions = ['p24', 'p17'] #, 'RT1', 'RT2', 'RT3', 'RT4', 'PR', 
        #           'IN1', 'IN2', 'IN3','p15', 'vif', 'nef','gp41','gp1201']
        cov_min = 1000
        Sbins = np.array([0,0.03, 0.08, 0.25, 2])
        Sbinc = 0.5*(Sbins[1:]+Sbins[:-1])

        data = {}
コード例 #4
0


# Script
if __name__ == '__main__':
    import argparse
    parser = argparse.ArgumentParser(description="make figure for SNP correlations")
    parser.add_argument('--redo', action='store_true', help='recalculate data')
    params = parser.parse_args()

    VERBOSE = 2
    pname = 'p11'
    n_time = 4

    username = os.path.split(os.getenv('HOME'))[-1]
    foldername = get_figure_folder(username, 'controls')
    fn_data = foldername+'data/'
    fn_data = fn_data + 'allele_frequency_overlap.pickle'

    if not os.path.isfile(fn_data) or params.redo:
        patient = Patient.load(pname)
        samples = patient.samples[n_time]
        data = get_allele_frequency_overlap(sample, overlaps, cov_min=cov_min,
                                            VERBOSE=VERBOSE, qual_min=qual_min)

        estimate_templates_overlaps(sample, data)


        store_data(data, fn_data)
    else:
        data = load_data(fn_data)
コード例 #5
0

# Script
if __name__ == '__main__':
    import argparse
    parser = argparse.ArgumentParser(
        description="make figure for SNP correlations")
    parser.add_argument('--redo', action='store_true', help='recalculate data')
    params = parser.parse_args()

    VERBOSE = 2
    pname = 'p11'
    n_time = 4

    username = os.path.split(os.getenv('HOME'))[-1]
    foldername = get_figure_folder(username, 'controls')
    fn_data = foldername + 'data/'
    fn_data = fn_data + 'allele_frequency_overlap.pickle'

    if not os.path.isfile(fn_data) or params.redo:
        patient = Patient.load(pname)
        samples = patient.samples[n_time]
        data = get_allele_frequency_overlap(sample,
                                            overlaps,
                                            cov_min=cov_min,
                                            VERBOSE=VERBOSE,
                                            qual_min=qual_min)

        estimate_templates_overlaps(sample, data)

        store_data(data, fn_data)