Skip to content

Instantly share code, notes, and snippets.

View seandavi's full-sized avatar

Sean Davis seandavi

View GitHub Profile
@seandavi
seandavi / README.md
Last active June 12, 2020 15:21
Example of using R to build a working web API

Example R API

To use, clone this repository and then run:

Rscript api.R

Test using the following URLs:

@seandavi
seandavi / README.md
Last active July 8, 2020 14:31
Run a Bioconductor Workshop docker image on Google Cloud Platform

Run a Bioconductor Workshop on a Google Cloud Instance

To run one of the workshops for Bioc2020, follow these steps after determining which workshop you'd like to run and finding the docker image name. Substitute the docker image name below for tidytranscriptomics if desired.

Prereqs

  • A google cloud platform account (which you can create with $300 free credit if you don't have one)
  • Installed google cloud sdk (the gcloud command)
@seandavi
seandavi / index.Rmd
Created June 4, 2020 13:42
Bioconductor big data notes
---
title: "Big Data Approaches"
subtitle: "Where to go with Bioconductor"
event: "Bioconductor Technical Advisory Board Meeting"
#author: Sean Davis
date: "`r Sys.Date()`"
output:
BiocStyle::html_document
---
library(tibble)
library(jsonlite)
library(curl)
as_tibble(jsonlite::fromJSON(curl('https://api.omicidx.cancerdatasci.org/sra/studies/ERP009142/runs?size=500'))$hits)
@seandavi
seandavi / kubernetes_job_example.py
Created March 4, 2020 01:37
example of kubernetes batch job with env variables and secrets
"""
Creates, updates, and deletes a job object.
"""
from os import path
import os
import yaml
import uuid
@seandavi
seandavi / go.mod
Created December 30, 2019 15:42
basic go postgres and logging example
module monitor
go 1.13
require (
github.com/jackc/pgx/v4 v4.1.2
github.com/jinzhu/gorm v1.9.11
github.com/joho/godotenv v1.3.0
go.uber.org/zap v1.13.0
)
@seandavi
seandavi / es_dsl_dynamic_mapping.py
Created October 8, 2019 13:15
Working with elasticsearch DSL and dynamic mappings
from elasticsearch import Elasticsearch
cli = Elasticsearch() # may need to create
from elasticsearch_dsl import connections
connections.add_connection('default',cli.client)
import elasticsearch_dsl as dsl
class Study(dsl.Document):
class Index:
name = 'sra_study-zq'
@seandavi
seandavi / main.java
Created October 1, 2019 02:08
Java string play
class Main {
public static void main(String[] args) {
String s1 = "Taylor Swift";
String s2 = "John Boyega";
String s3 = "Emma Stone";
String s4 = s1.substring(2,s1.length()-3).toLowerCase();
String s5 = s2.substring(2,s2.length()-3).toLowerCase();
String s6 = s3.substring(2,s3.length()-3).toLowerCase();
System.out.println(s1 + ">>>" + s4 + "\n" + s2 + ">>>" + s5 + "\n"+ s3 + ">>>" + s6);
}
@seandavi
seandavi / sra_urls.md
Last active August 2, 2019 14:40
SRA URLs

Build an R package

├── DESCRIPTION <<<--- This is the only file needed to have an R package!
├── NAMESPACE
├── R
│   └── hello.R
...
└── man
 └── hello.Rd