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
library(tidyverse) | |
library(rvest) | |
library(tidytext) | |
## Function to get full text given a DOI | |
get_full_text <- function(doi) { | |
paste0("https://www.biorxiv.org/content/", doi, ".full") |> | |
rvest::read_html() |> | |
rvest::html_nodes("div.section") |> | |
rvest::html_text() |> |
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
library(tidyverse) | |
library(httr2) | |
# Set URL path variables | |
url <- "https://api.biorxiv.org/" | |
what <- "details" | |
server <- "biorxiv" | |
date1 <- "2014-01-01" | |
date2 <- "2023-12-31" |
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
# Get / clean data ---- | |
library(tidyverse) | |
library(httr2) | |
# Set URL path variables | |
url <- "https://api.biorxiv.org/" | |
what <- "details" | |
server <- "biorxiv" | |
date1 <- "2014-01-01" | |
date2 <- "2023-12-31" |
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
// Place your key bindings in this file to overwrite the defaults | |
[ | |
// RStudio: Copy lines up/down with alt+cmd+up/down | |
{ | |
"key": "alt+cmd+down", | |
"command": "editor.action.copyLinesDownAction", | |
"when": "editorTextFocus && !editorReadonly" | |
}, | |
{ | |
"key": "shift+alt+down", |
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
# R session 1: model training and deployment ------------------------------ | |
library(tidymodels) | |
library(vetiver) | |
library(plumber) | |
# Not the way you'd actually split data - for demo only | |
cars_train <- mtcars[1:24,] | |
cars_test <- mtcars[25:32,] |
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
#!/usr/bin/env python | |
# Adds allelic depth (AD)=2 to a VCF. | |
# Usage: bcftools view my.vcf.gz | addad.py | bcftools sort -Oz -o my.ad.vcf.gz && tabix my.ad.vcf.gz | |
import pysam | |
vcf_in=pysam.VariantFile("-","r") | |
vcf_in.header.formats.add("AD",".","Integer","Allelic depth, hard-coded as 2") |
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
# Start window and pane indices at 1 instead of 0 | |
set -g base-index 1 | |
set -g pane-base-index 1 | |
# Shift arrow keys to move around panes | |
bind -n S-Up select-pane -U | |
bind -n S-Down select-pane -D | |
bind -n S-Left select-pane -L | |
bind -n S-Right select-pane -R |
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
n <- 1e7 | |
x <- sample(n, size=n, replace=TRUE) | |
length(unique(x))/n | |
# [1] 0.6321897 | |
1-exp(-1) | |
# [1] 0.6321206 |
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
# Compile and install htslib, bcftools, samtools 1.9 to home directory | |
# Set up dirs where stuff will be installed | |
mkdir -p ${HOME}/bin/htslib | |
mkdir -p ${HOME}/bin/bcftools | |
mkdir -p ${HOME}/bin/samtools | |
# Make a dir to build | |
mkdir -p ${HOME}/tmp |
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
# Load some packages | |
library(knitr) | |
library(tidyverse) | |
library(DT) | |
# Get licenses for all installed packages. | |
installed_licenses <- installed.packages() %>% | |
as.data.frame() %>% | |
rownames_to_column("package") %>% | |
as_tibble() %>% |
NewerOlder