Skip to content

Instantly share code, notes, and snippets.

View chasemc's full-sized avatar
:octocat:

Chase Clark chasemc

:octocat:
View GitHub Profile
library(ggplot2)
library(data.table)
library(geofacet)
raw_data <- data.table::fread("http://covidtracking.com/api/states/daily.csv")
raw_data$date <- as.Date(as.character(raw_data$date), "%Y%m%d")
raw_data <- raw_data[date > "2020-03-15", ]
raw_data[positiveIncrease > 0, ] %>%
library(ggplot2)
library(data.table)
library(geofacet)
library(magrittr)
raw_data <- data.table::fread("http://covidtracking.com/api/states/daily.csv")
raw_data$date <- as.Date(as.character(raw_data$date), "%Y%m%d")
raw_data <- raw_data[date > "2020-03-15", ]
server <- function(input, output, server) {
output$out <- renderText({
validate(
need(input$x < 0, "x can not be negative"),
need(input$trans %in% c("log", "square-root"), "trans blah blah")
)
switch(input$trans,
square = input$x ^ 2,
"square-root" = sqrt(input$x),
plot(protein_peak_dend$dendrogram )
z<-sapply(protein_peak_data, function(x) x@mass[x@mass > 4000 & x@mass < 15000])
z <- z[ match(labels(protein_peak_dend$dendrogram),labels(z))]
plot(1, xlim=c(0,861), ylim=c(4000,15000))
for(i in seq_along(z)) points(z[[i]], x=rep(i, length(z[[i]])), col = rgb(red = 0, green = 0, blue = 0, alpha = 0.1), pch=16, cex=.5)
@chasemc
chasemc / shiny-oauth.r
Created June 30, 2020 13:34 — forked from hadley/shiny-oauth.r
Sketch of shiny + oauth
library(shiny)
library(httr)
# OAuth setup --------------------------------------------------------
# Most OAuth applications require that you redirect to a fixed and known
# set of URLs. Many only allow you to redirect to a single URL: if this
# is the case for, you'll need to create an app for testing with a localhost
# url, and an app for your deployed app.
@chasemc
chasemc / idbac_mirror_plot.R
Created July 2, 2020 01:55
Use IDBac to create an interactive mirror plot comparing two samples
a <- IDBacApp::assembleMirrorPlots(
sampleID1 = "apples",
sampleID2 = "oranges",
minFrequency = 1,
lowerMassCutoff = 100,
upperMassCutoff = 3000,
minSNR = 6,
tolerance = 0.002,
pool1 = pool,
library(remotes)
pkg <- "electricShine"
repo <- "chasemc/electricShine"
remote <- lapply(repo, remotes:::github_remote, ref = "master", subdir = NULL,
auth_token = remotes:::github_pat(quiet), host = "api.github.com")
remote_sha <- remotes:::remote_sha(remote[[1]],
remotes:::local_sha(pkg))
local_sha <- remotes:::local_sha(pkg)
library(ggplot2)
library(data.table)
library(geofacet)
library(magrittr)
raw_data <- data.table::fread("http://covidtracking.com/api/states/daily.csv")
raw_data$date <- as.Date(as.character(raw_data$date), "%Y%m%d")
raw_data <- raw_data[date > "2020-03-15", ]
@chasemc
chasemc / Abbreviate Journal Names in Bibtex Database.py
Created August 3, 2020 03:26 — forked from trevismd/Abbreviate Journal Names in Bibtex Database.py
Using the translation table from the Jabref program, finds and replaces all scientific journal names to their standardized abbreviated form. First argument is the file to be processed; outputs safely to 'abbreviated.bib'
#!/usr/bin/env python
#-*- coding: utf-8 -*-
# Supporting Python 3 and JabRef csv file
import os
import re
import sys
try:
bibtexdb = open(sys.argv[1]).read()
library(ggplot2)
library(data.table)
library(geofacet)
library(magrittr)
raw_data <- data.table::fread("http://covidtracking.com/api/states/daily.csv")
raw_data$date <- as.Date(as.character(raw_data$date), "%Y%m%d")
raw_data <- raw_data[date > "2020-03-15", ]