<jupyter_start><jupyter_text>http://www.nealelab.is/uk-biobank<jupyter_code>ukbb_table=pd.read_csv(ukbb_table_path,sep=',')
ukbb_table.head()
phenotypes_both_sexes_v2=pd.read_csv(phenotypes_both_sexes_v2_file_path,sep='\t',compression='gzip')
phenotypes_male_v2=pd.read_csv(phenotypes_male_v2_file_path,sep='\t',compression='gzip')
phenotypes_female_v2=pd.read_csv(phenotypes_female_v2_file_path,sep='\t',compression='gzip')
phenotypes_both_sexes_v2['Sex']='both_sexes';phenotypes_male_v2['Sex']='male';phenotypes_female_v2['Sex']='female';
phenotypes=pd.concat([phenotypes_both_sexes_v2,phenotypes_male_v2,phenotypes_female_v2],sort='False')
phenotypes_select_list=[]
for idx,phenotype in enumerate(phenotypes['phenotype'].unique()):
    ukbb_table_select=ukbb_table[ukbb_table['Phenotype Code']==phenotype]
    if (ukbb_table_select['check']==0).sum()>0:
        continue
    phenotypes_select=phenotypes[phenotypes['phenotype']==phenotype]
    if phenotypes_select[phenotypes_select['Sex']=='female'].shape[0]==0:
        phenotypes_select_list.append(phenotypes_select[phenotypes_select['Sex']=='male'])
        print(phenotypes_select[phenotypes_select['Sex']=='male'][['Sex','description']])
    elif phenotypes_select[phenotypes_select['Sex']=='male'].shape[0]==0:
        phenotypes_select_list.append(phenotypes_select[phenotypes_select['Sex']=='female'])
        print(phenotypes_select[phenotypes_select['Sex']=='female'][['Sex','description']])
    else:
        phenotypes_select_list.append(phenotypes_select[phenotypes_select['Sex']=='both_sexes'])
phenotypes_filtered=pd.concat(phenotypes_select_list)
phenotypes_filtered.shape
len(ukbb_table['Phenotype Code'][ukbb_table['check']!=0].unique())
ukbb_table_file_list=[]
for idx,row in phenotypes_filtered.iterrows():
    ukbb_table_select=ukbb_table[ukbb_table['Phenotype Code']==row['phenotype']]
    ukbb_table_select=ukbb_table_select[ukbb_table_select['Sex']==row['Sex']]
    
    if ukbb_table_select['File'].str.contains('v2').sum()>0:
        ukbb_table_select=ukbb_table_select[ukbb_table_select['File'].str.contains('v2')]
    #& (ukbb_table['Sex']==row['Sex'])]
    #print(ukbb_table_select)
    if ukbb_table_select.shape[0]==1:
        ukbb_table_file_list.append(ukbb_table_select.iloc[0][['Phenotype Code','UK Biobank Data Showcase Link','File','wget command','Dropbox File']])
    else:
        print(ukbb_table_select)
        
phenotypes_filtered=phenotypes_filtered.merge(right=pd.DataFrame(ukbb_table_file_list),left_on='phenotype',right_on='Phenotype Code')
phenotypes_filtered=phenotypes_filtered.set_index('phenotype')
phenotypes_filtered.to_csv(phenotypes_filtered_path)
os.chdir(gwas_path)
for idx,row in phenotypes_filtered.iterrows():
    if not os.path.exists(row['File']):
        run_command(row['wget command'],quiet=True)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15735862311204776, 'fraction_numerical': 0.008781173164734809, 'mean_word_length': 9.787878787878787, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '489632', 'license': 'MIT', 'n_tokens_mistral': 1160, 'n_tokens_neox': 1014, 'n_words': 71, 'path': '1_downlaod_gwas_neale.ipynb', 'repo_name': 'ch6845/regional_heritability_analysis', 'size': '2847'}