- lxml - Pythonic binding for the C libraries libxml2 and libxslt.
- boto - Python interface to Amazon Web Services
- Django - Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
- Fabric - Library and command-line tool for streamlining the use of SSH for application deployment or systems administration task.
- PyMongo - Tools for working with MongoDB, and is the recommended way to work with MongoDB from Python.
- Celery - Task queue to distribute work across threads or machines.
- pytz - pytz brings the Olson tz database into Python. This library allows accurate and cross platform timezone calculations using Python 2.4 or higher.
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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(png) | |
library(abind) | |
library(impute) | |
SplitImage <- function(rgb.array) { | |
# decompose image into RGB elements | |
rgb.list <- list() | |
for (i in 1:dim(rgb.array)[3]) { | |
rgb.list[[i]] <- rgb.array[, , i] | |
} |
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(png) | |
library(abind) | |
ProjectImage <- function(prcomp.obj, pc.num) { | |
# project image onto n principal components | |
scores <- prcomp.obj$x | |
loadings <- prcomp.obj$rotation | |
img.proj <- scores[, c(1:pc.num)] %*% t(loadings[, c(1:pc.num)]) | |
return(img.proj) | |
} |
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(BiSeq) | |
readBedgraph <- function(inputDirectory, nSamples = 8) { | |
## get list of file names | |
fileNames <- list.files(path = inputDirectory, pattern = ".bedGraph") | |
## parse sample name from file name | |
sampleNames <- sapply(fileNames,function(fileName) { | |
gsub("_r123_R1_val_1.fq_bismark_bt2_pe.bedGraph", "", fileName) | |
}, USE.NAMES = FALSE) |
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(RCurl) | |
library(XML) | |
escapeAmpersands <- function(url) { | |
doc <- getURL(url) | |
## escape ampersands in XML | |
validDoc <- gsub("&", "&", doc) | |
validDoc | |
} |
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
# Check if file exists in working directory; if not, downloads | |
fileName = "medMis.csv" | |
if (!file.exists(fileName)){ | |
url <- "https://health.data.ny.gov/api/views/ebmi-8ctw/rows.csv?accessType=DOWNLOAD" | |
fileName <- "medMis.csv" | |
download.file(url, fileName, method = "curl") | |
} | |
medMis <- read.csv(fileName) |
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
# Convert variable from factor into "Date" class | |
medMis$Effective.Date <- as.character(medMis$Effective.Date) | |
medMis$Effective.Date <- as.POSIXct(medMis$Effective.Date, format = "%m/%d/%Y") | |
# Order dataset by Effective.Date from 1990-2014 | |
medMis <- (medMis[order(medMis$Effective.Date),]) | |
# Create time-series data | |
medMis_month <- as.data.frame(table(format(medMis$Effective.Date, "%Y-%m-01")), stringsAsFactors = FALSE) | |
medMis_plot <- as.data.frame(table(format(medMis$Effective.Date, "%Y-%m")), stringsAsFactors = FALSE) |
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
# Time-series plot | |
library(ggplot2) | |
library(scales) | |
# By month | |
m = ggplot(data = medMis_month, aes(x = Time, y = Freq)) + geom_line() | |
m = m + scale_x_datetime(labels = date_format("%Y"), breaks = date_breaks("2 years")) | |
m = m + ylab("No. of Physicians Disciplined") + | |
ggtitle("Physicians Disciplined by NYS DOH from 1990-2013") | |
m |
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(rCharts) | |
library(zoo) | |
# Data transformations | |
names(medMis_plot) <- c("Month", "MedicalMisconductCount") | |
medMis_plot$Month <- as.yearmon(medMis_plot$Month) | |
medMis_plot <- transform(medMis_plot, Month = as.character(Month)) | |
# Morris Line Plot | |
m1 <- mPlot(x = "Month", y = colnames(medMis_plot)[2], data = medMis_plot, type = "Line") |
OlderNewer