Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Column merging #7

Closed
bschilder opened this issue Nov 8, 2019 · 1 comment
Closed

Column merging #7

bschilder opened this issue Nov 8, 2019 · 1 comment

Comments

@bschilder
Copy link

extract_snpvar.py

For scenarios where someone's summary stats file has both SNP and CHR/POS, I modified the merging procedure so that column names don't get duplicated.
lines 66-76

#merge the dfs
    # BMS edits
    print('Merging metadata files by...')
    if all(x in df_snps.columns for x in ['SNP', 'BP', 'CHR']):
        logging.info('   SNP and position.')
        df = df_meta.merge(df_snps, on=['SNP', 'A1', 'A2', 'SNP', 'BP', 'CHR'], how='inner')
    elif 'SNP' in df_snps.columns:
        print('   SNP.')
        df = df_meta.merge(df_snps, on=['SNP', 'A1', 'A2'], how='inner')
    else:
        print('   position.')
        df = df_meta.merge(df_snps, on=['CHR', 'BP', 'A1', 'A2'], how='inner')
@omerwe
Copy link
Owner

omerwe commented Nov 8, 2019

Great suggestion! Committed (with slight modifications)

@omerwe omerwe closed this as completed Nov 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants