Created
March 11, 2020 08:36
-
-
Save andy23512/8bad2438598dc36852c12d4a28171750 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
df = pd.read_excel('data.xlsx') | |
print(""" | |
Mode 1: Search with locus | |
Mode 2: Search with chr and pos | |
""") | |
mode = input('Input query mode: ') | |
if mode == '1': | |
query_locus = input('Input locus: ') | |
print(df.loc[df['locus'] == query_locus]) | |
elif mode == '2': | |
query_chr = input('Input chr: ') | |
query_pos = int(input('Input pos: ')) | |
print(df.loc[(df['chr'] == query_chr) & (df['start_POS'] <= query_pos) & (df['stop_POS'] >= query_pos)]) | |
else: | |
raise ValueError('Unexpected mode') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment