This file contains hidden or 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 sys, os | |
| from functools import partial | |
| import warnings | |
| import numpy as np | |
| import pandas as pd | |
| from numpy.random import gamma | |
| from numpy.random import beta | |
| from scipy import stats |
This file contains hidden or 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
| echo "" | |
| echo "Log into GitHub through the browser using a one-time code" | |
| gh auth login --hostname github.com -p ssh --skip-ssh-key --web --scopes "admin:public_key,repo,read:org" | |
| filename="$HOME/.ssh/id_ed25519" | |
| echo "Generatig SSH key" | |
| if [[ ! -f "$filename" ]]; then | |
| ssh-keygen -t ed25519 -f "$filename" -N "" |
This file contains hidden or 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 os | |
| import requests | |
| from requests.auth import HTTPBasicAuth | |
| import json | |
| from tqdm.notebook import tqdm | |
| def download_4dn(identifier, dowload_dir=os.getcwd(), pgbar=False): | |
| def download_file(url, dowload_dir=dowload_dir: | |
| if not os.path.exists(dowload_dir): |
This file contains hidden or 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
| #!/usr/bin/env bash | |
| usage=$(cat <<-END | |
| Use like this: | |
| gdk-code -m <memory> -t <walltime> -a <account> ~/some/dir/on/genomedk | |
| The following needs to be part of your .ssh/config file: |
This file contains hidden or 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
| def stars(p): | |
| return '*' * (-np.log10(p / 5) - 1) |
This file contains hidden or 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 itertools | |
| import matplotlib.pyplot as plt | |
| from matplotlib.ticker import FuncFormatter | |
| import seaborn as sns | |
| import pandas as pd | |
| import numpy as np | |
| from scipy.stats import chi2 | |
| %config InlineBackend.figure_format = 'retina' | |
| def fisher_method(pvalues): |
This file contains hidden or 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
| #!/usr/bin/env bash | |
| usage=$(cat <<-END | |
| Use like this: | |
| gdk-code <memory> <walltime> <environment> <projectdir> <> ~/some/dir/on/genomedk | |
| The following needs to be part of your .ssh/config file: |
This file contains hidden or 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
| from scipy.stats import fisher_exact | |
| import pandas as pd | |
| from IPython.display import display, Markdown | |
| def read_google_sheet(): | |
| SHEET_ID = '1JSjSLuto3jqdEnnG7JqzeC_1pUZw76n7XueVAYrUOpk' | |
| SHEET_NAME = 'Sheet1' | |
| url = f'https://docs.google.com/spreadsheets/d/{SHEET_ID}/gviz/tq?tqx=out:csv&sheet={SHEET_NAME}' | |
| df = pd.read_csv(url, header=1, dtype='str') | |
| return df.loc[:, [not x.startswith('Unnamed') for x in df.columns]] |
This file contains hidden or 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 matplotlib.pyplot as plt | |
| import matplotlib.colors as clr | |
| import numpy as np | |
| some_matrix = np.random.rand(10, 10) | |
| cmap = clr.LinearSegmentedColormap.from_list('custom colormap', | |
| ['white', 'gold', 'red', 'magenta', 'blue', 'black'], | |
| N=256) | |
| sns.heatmap(some_matrix, cmap=cmap) |
This file contains hidden or 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
| # set dark plots if theme is dark | |
| user_settings = '~/.jupyter/lab/user-settings/@jupyterlab/apputils-extension/themes.jupyterlab-settings' | |
| if 'JupyterLab Dark' in open(os.path.expanduser(user_settings)).read(): | |
| style = {'axes.facecolor': '#111111', | |
| 'axes.edgecolor': '.99', | |
| 'axes.labelcolor': '.99', | |
| 'figure.facecolor': '#111111', | |
| 'grid.color': '.0', | |
| 'text.color': '.99', | |
| 'xtick.color': '.99', |
NewerOlder