Skip to content

Instantly share code, notes, and snippets.

View johnmackintosh's full-sized avatar

John MacKintosh johnmackintosh

View GitHub Profile
@moldach
moldach / biomart.csv
Created March 28, 2021 19:38
Troubleshooting faster fuzzy_inner_join
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
Gene Symbol Gene_description Chromosome Start End NCBI WormBase WormBase_seq GO Human_GeneID Human_GeneName Identity Human_Identity
WBGene00000001 aap-1 Phosphoinositide 3-kinase adapter subunit; Phosphoinositide kinase AdAPter subunit [Source:UniProtKB/TrEMBL;Acc:G5EDP9] I 5107833 5110183 172141 aap-1 Y110A7A.10 kinase activity ENSG00000117461 PIK3R3 18.9655 21.4751
WBGene00000001 aap-1 Phosphoinositide 3-kinase adapter subunit; Phosphoinositide kinase AdAPter subunit [Source:UniProtKB/TrEMBL;Acc:G5EDP9] I 5107833 5110183 172141 aap-1 Y110A7A.10 phosphorylation ENSG00000117461 PIK3R3 18.9655 21.4751
WBGene00000001 aap-1 Phosphoinositide 3-kinase adapter subunit; Phosphoinositide kinase AdAPter subunit [Source:UniProtKB/TrEMBL;Acc:G5EDP9] I 5107833 5110183 172141 aap-1 Y110A7A.10 protein kinase binding ENSG00000117461 PIK3R3 18.9655 21.4751
WBGene00000001 aap-1 Phosphoinositide 3-kinase adapter subunit; Phosphoinositide kinase AdAPter subunit [Source:UniProtKB/TrEMBL;Acc:G5EDP9] I 5107833 5110183 172141 a
@johnmackintosh
johnmackintosh / automate blog years.txt
Created January 1, 2021 12:29
Update the year in the copyright notice of blog post automatically
<script>document.write(new Date().getFullYear())</script>
or
<script>new Date().getFullYear()>2005&&document.write("-"+new Date().getFullYear());</script>
@rich-iannone
rich-iannone / information_palmerpenguins.R
Last active January 19, 2021 23:48
A pointblank information report for the `peguins` dataset in the `palmerpenguins` package
library(pointblank)
library(palmerpenguins)
informant_pp <-
create_informant(
read_fn = ~ palmerpenguins::penguins,
tbl_name = "penguins",
label = "The `penguins` dataset from the **palmerpenguins** 📦."
) %>%
info_columns(
library(tidyverse)
library(data.table)
# Create som edata
dates <- tibble(id = 1,
labdate = lubridate::dmy(c("01-01-2010", "01-02-2010", "01-03-2010")))
fupdate <- tibble(id = 1,
fupdate = lubridate::dmy("02-02-2010")) %>%
#set window of +/- 14 days
@burchill
burchill / knit_hook_setter.R
Last active January 27, 2022 19:10
Make htmlwidgets work with knitr-powered Jekyll and GitHub Pages
#' Set knitr hooks for htmlwidgets with Jekyll/GitHub Pages
#'
#' This functions sets a `knitr` hook so that any HTML widgets that were
#' printed (i.e., objects that inherit the `'htmlwidget'`, like those from
#' the `htmlwidgets` or `plotly` packages) will work with a Jekyll system,
#' like the one used for GitHub Pages.
#'
#' It essentially sets a hook so that, when the document is finished being
#' knitted, it moves all the dependencies necessary for the widgets to a
#' directory, and then adds HTML code to the document to load those files
@data-henrik
data-henrik / 0intro.md
Last active November 25, 2022 01:36
SQL statements to dig into COVID-19 data

Introduction

Let's assume a simple schema consisting of two tables.

  1. STATISTICS for COVID-19 daily statistics like confirmed cases, deaths, etc.
  2. DEMOGRAPHICS with addition per-country data like population, area, population density and more

STATISTICS

This table could have columns such as

  • country_id: Identifies the country by ISO code
@kar9222
kar9222 / i_love_base_R.md
Last active August 2, 2020 22:31
I love base R

I dont use base R for everything. But I use & ❤️ base R

  • Super high emphasis on stability & backward compatibility
  • No dependency
  • Works well with {data.table}
  • Most importantly, it's the foundation of all packages

Feel free to see image & shared Gist link. You might find some useful ones.

Imgur

read_csv("https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_19-covid-Confirmed.csv") %>%
gather(date, cases, 5:ncol(.)) %>%
mutate(date = as.Date(date, "%m/%d/%y")) %>%
group_by(country = `Country/Region`, date) %>%
summarise(cases = sum(cases)) %>%
filter(country != "Others" & country != "Mainland China") %>%
bind_rows(
tibble(country = "Republic of Korea", date = as.Date("2020-03-11"), cases = 7755)
) %>%
group_by(country) %>%
@gvenzl
gvenzl / TestDatabaseSetup.md
Last active January 13, 2025 03:21
Setup scripts for test databases for Oracle, MySQL, Postgres, SQL Server, and Db2