def main(p_dict): ld_dict = ld.get_ld_dict_using_p_dict(p_dict, summary_dict={}) ldpred_inf_genomewide(data_file=p_dict['cf'], out_file_prefix=p_dict['out'], ld_radius=p_dict['ldr'], ld_dict=ld_dict, n=p_dict['N'], h2=p_dict['h2'], verbose=p_dict['debug'])
def main(p_dict): #Check parameters summary_dict = {} summary_dict[0] = { 'name': 'Coordinated data filename', 'value': p_dict['cf'] } summary_dict[0.1] = { 'name': 'SNP weights output file (prefix)', 'value': p_dict['out'] } eff_type = get_eff_type(p_dict['cf']) #If already BLUP betas, then skip LD calculation if eff_type != 'BLUP': summary_dict[0.2] = { 'name': 'LD data filename (prefix)', 'value': p_dict['ldf'] } summary_dict[1.01] = { 'name': 'LD radius used', 'value': str(p_dict['ldr']) } summary_dict[1] = {'name': 'dash', 'value': 'LD information'} t0 = time.time() ld_dict = ld.get_ld_dict_using_p_dict(p_dict, summary_dict) t1 = time.time() t = (t1 - t0) summary_dict[1.2] = { 'name': 'Running time for calculating LD information:', 'value': '%d min and %0.2f secs' % (t / 60, t % 60) } t0 = time.time() summary_dict[1.9] = {'name': 'dash', 'value': 'LDpred-fast'} ldpred_fast_genomewide( data_file=p_dict['cf'], out_file_prefix=p_dict['out'], ps=p_dict['f'], ld_radius=p_dict['ldr'], ld_dict=ld_dict, n=p_dict['N'], h2=p_dict['h2'], use_gw_h2=p_dict['use_gw_h2'], eff_type=eff_type, summary_dict=summary_dict, debug=p_dict['debug'], ) t1 = time.time() t = (t1 - t0) summary_dict[3] = { 'name': 'Running time for LDpred-fast:', 'value': '%d min and %0.2f secs' % (t / 60, t % 60) } reporting.print_summary(summary_dict, 'Summary of LDpred-fast')
def main(p_dict): #Check parameters summary_dict = {} summary_dict[0] = { 'name': 'Coordinated data filename', 'value': p_dict['cf'] } summary_dict[0.1] = { 'name': 'SNP weights output file (prefix)', 'value': p_dict['out'] } summary_dict[0.2] = { 'name': 'LD data filename (prefix)', 'value': p_dict['ldf'] } summary_dict[1] = {'name': 'LD radius used', 'value': str(p_dict['ldr'])} t0 = time.time() summary_dict[1.09] = {'name': 'dash', 'value': 'LD information'} ld_dict = ld.get_ld_dict_using_p_dict(p_dict, summary_dict) t1 = time.time() t = (t1 - t0) summary_dict[1.2] = { 'name': 'Running time for calculating LD information:', 'value': '%d min and %0.2f secs' % (t / 60, t % 60) } t0 = time.time() summary_dict[1.9] = {'name': 'dash', 'value': 'LDpred Gibbs sampler'} ldpred_genomewide(data_file=p_dict['cf'], out_file_prefix=p_dict['out'], ps=p_dict['f'], ld_radius=p_dict['ldr'], ld_dict=ld_dict, n=p_dict['N'], num_iter=p_dict['n_iter'], burn_in=p_dict['n_burn_in'], h2=p_dict['h2'], use_gw_h2=p_dict['use_gw_h2'], sampl_var_shrink_factor=1, verbose=p_dict['debug'], summary_dict=summary_dict) t1 = time.time() t = (t1 - t0) summary_dict[2.2] = { 'name': 'Running time for Gibbs sampler(s):', 'value': '%d min and %0.2f secs' % (t / 60, t % 60) } reporting.print_summary(summary_dict, 'Summary of LDpred Gibbs')
def main(p_dict): summary_dict = {} summary_dict[0] = { 'name': 'Coordinated data filename', 'value': p_dict['cf'] } summary_dict[0.1] = { 'name': 'SNP weights output file (prefix)', 'value': p_dict['out'] } summary_dict[0.2] = { 'name': 'LD data filename (prefix)', 'value': p_dict['ldf'] } summary_dict[1] = {'name': 'LD radius used', 'value': str(p_dict['ldr'])} t0 = time.time() summary_dict[1.09] = {'name': 'dash', 'value': 'LD information'} ld_dict = ld.get_ld_dict_using_p_dict(p_dict, summary_dict={}) t1 = time.time() t = (t1 - t0) summary_dict[1.2] = { 'name': 'Running time for calculating LD information:', 'value': '%d min and %0.2f secs' % (t / 60, t % 60) } t0 = time.time() summary_dict[1.9] = {'name': 'dash', 'value': 'LDpred infinitesimal model'} ldpred_inf_genomewide(data_file=p_dict['cf'], out_file_prefix=p_dict['out'], ld_radius=p_dict['ldr'], ld_dict=ld_dict, n=p_dict['N'], h2=p_dict['h2'], use_gw_h2=p_dict['use_gw_h2'], verbose=p_dict['debug'], summary_dict=summary_dict) t1 = time.time() t = (t1 - t0) summary_dict[2.2] = { 'name': 'Running time for LDpred-inf:', 'value': '%d min and %0.2f secs' % (t / 60, t % 60) } reporting.print_summary(summary_dict, 'Summary of LDpred-inf')
def test_get_chromosome_herits(self): p_dict = make_p_dict( '--debug', 'inf', '--cf=%s/test_data/goldens/golden.coord.hdf5' % TEST_DIR, '--ldr=100', '--ldf=' + self.tmp_file_prefix, '--N=10000', '--out=' + self.tmp_file_prefix, ) summary_dict = {} ld_dict = ld.get_ld_dict_using_p_dict(p_dict, summary_dict) coord_file = os.path.join(TEST_DIR, 'test_data/goldens/golden.coord.hdf5') df = h5py.File(coord_file, 'r') herit_dict = ld.get_chromosome_herits(df['cord_data'], ld_dict['ld_scores_dict'], n=p_dict['N'], h2=None) print(herit_dict) self.assertAlmostEqual(herit_dict['chrom_1'], 0.0741219) self.assertAlmostEqual(herit_dict['gw_h2_ld_score_est'], 0.0741219)