Skip to content

Instantly share code, notes, and snippets.

View daenuprobst's full-sized avatar

Daniel Probst daenuprobst

View GitHub Profile
@daenuprobst
daenuprobst / drugbank.py
Created September 20, 2019 08:09
Code for generating a visualisation of Drugbank. The drugbank data has to be downloaded separately from https://www.drugbank.ca.
import numpy as np
import pandas as pd
import tmap as tm
import scipy.stats as ss
from faerun import Faerun
from rdkit.Chem import AllChem, Descriptors, Descriptors3D
from mhfp.encoder import MHFPEncoder
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
from lipinski import lipinski_pass
@daenuprobst
daenuprobst / dendrogram.py
Created November 22, 2020 15:58
Create a TMAP from a scipy hierarchy
import tmap as tm
import numpy as np
from scipy.cluster import hierarchy
from matplotlib import pyplot as plt
N = 1000
CFG = tm.LayoutConfiguration()
# This is the most important parameter to tune when changing the
# number of nodes. More nodes -> smaller number
CFG.node_size = 1 / 10
canton to_date from_date
AG 2021-01-03 2020-12-19
AR 2021-01-03 2020-12-19
AI 2021-01-03 2020-12-19
BL 2021-01-03 2020-12-19
BS 2021-01-03 2020-12-19
BE 2021-01-10 2020-12-24
FR 2021-01-03 2020-12-19
GE 2021-01-10 2020-12-24
GL 2021-01-10 2020-12-24
We can't make this file beautiful and searchable because it's too large.
"geoRegion","datum","entries","sumTotal","timeframe_7d","offset_last7d","sumTotal_last7d","timeframe_14d","offset_last14d","sumTotal_last14d","timeframe_28d","offset_last28d","sumTotal_last28d","timeframe_phase2","offset_Phase2","sumTotal_Phase2","timeframe_phase2b","offset_Phase2b","sumTotal_Phase2b","sum7d","sum14d","mean7d","mean14d","timeframe_all","entries_diff_last_age","pop","inz_entries","inzmean7d","inzmean14d","inzsumTotal","inzsumTotal_last7d","inzsumTotal_last14d","inzsumTotal_last28d","inzsumTotal_Phase2","inzsumTotal_Phase2b","inzsum7d","inzsum14d","sumdelta7d","inzdelta7d","type","type_variant","version","datum_unit","entries_letzter_stand","entries_neu_gemeldet","entries_diff_last"
"CH",2020-02-24,1,1,FALSE,493515,0,FALSE,476732,0,FALSE,431216,0,FALSE,30941,0,FALSE,52684,0,NA,NA,NA,NA,TRUE,1,8606033,0.01,NA,NA,0.01,NA,NA,NA,NA,NA,NA,NA,NA,NA,"COVID19Cases","","2021-01-22_07-45-28","day",1,0,2145
"CH",2020-02-25,1,2,FALSE,493515,0,FALSE,476732,0,FALSE,431216,0,FALSE,30941,0,FALSE,52684,0,NA,NA,
@daenuprobst
daenuprobst / xmas_holidays_cases_corr.ipynb
Last active January 23, 2021 22:13
xmas_holidays_cases_corr.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
canton to_date from_date
AG 2020-10-11 2020-09-26
AR 2020-10-18 2020-10-03
AI 2020-10-18 2020-10-03
BL 2020-10-11 2020-09-26
BS 2020-10-11 2020-09-26
BE 2020-10-11 2020-09-19
FR 2020-11-01 2020-10-17
GE 2020-10-25 2020-10-17
GL 2020-10-18 2020-10-03
@daenuprobst
daenuprobst / autumn_holidays_cases_corr.ipynb
Created January 24, 2021 13:21
autumn_holidays_cases_corr.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@daenuprobst
daenuprobst / borders.csv
Created February 17, 2021 18:35
Country land border and area data
Rank Country or territory Total length of land borders (km) Total surface area (km2) Border/area ratio (km/km2)
1 Vatican City 3.2 0.44 7.2727273
2 Monaco 4.4 2 2.2000000
3 San Marino 39 61 0.6393443
4 Liechtenstein 76 160 0.4650000
5 Sint Maarten (Netherlands) 10.2 34 0.3000000
6 Andorra 120.3 468 0.2570513
7 Gibraltar (United Kingdom) 1.2 6 0.2000000
8 Saint Martin (France) 10.2 54 0.1888889
9 Luxembourg 359 2586 0.1388244
import string
from matplotlib.axes import Axes
from matplotlib import rcParams
def index_subplots(
axs: Axes,
font_size: float = 20,
font_weight: str = "bold",
font_family: str = rcParams["font.family"],
@daenuprobst
daenuprobst / vaccination_rate.csv
Last active November 25, 2021 17:34
Swiss vaccination rates 2021-11-25
Canton Rate Cases
AG 0.65 698.49
AI 0.54 1643.49
AR 0.59 1479.16
BE 0.67 903.72
BL 0.68 907.31
BS 0.69 1008.46
FR 0.66 675.89
GE 0.66 594.26
GL 0.6 1045.26