Skip to content

Instantly share code, notes, and snippets.

@simecek
simecek / click_on_ggvis.R
Created February 11, 2015 16:48
Interactive scatterplot
# Example of ggvis scatterplot
# on over - display MGI gene symbol
# on click - open browser with Ensembl page
library(ggvis)
# load dataset
dataset <- read.csv("http://dl.dropboxusercontent.com/u/232839/DO_liver_variability_sex.csv", as.is=TRUE)
head(dataset)
@simecek
simecek / scatterplot.R
Last active December 31, 2015 16:48
Ggplot2 scatterplot
# load dataset
dataset <- read.csv("http://dl.dropboxusercontent.com/u/232839/DO_liver_variability_sex.csv", as.is=TRUE)
head(dataset)
# make plot
library(ggplot2)
ggplot(aes(y=protein.Sex, x=mrna.Sex), data=dataset) +
geom_point(alpha=0.2, size=I(5)) +
geom_smooth(method=loess) +
ggtitle("Variability Explained by Sex") + theme_bw()
@simecek
simecek / iplot_example.R
Created February 11, 2015 17:20
Example of iplot usage
library(testjs)
dataset <- readRDS("click_on_ggvis\\DO_liver_variability_sex.rds")
head(dataset)
out <- with(dataset, iplot(x=protein.Sex, y=mrna.Sex, indID=Associated.Gene.Name,
chartOpts=list(width=300, height=300)))
out
htmlwidgets::saveWidget(out, "iplot.html")
@simecek
simecek / start_course_RStudios.R
Last active August 29, 2015 14:21
For each participant, start RStudio with DOQTL preinstalled and send the email
library(analogsea) # to access Digital Oceal
library(sendmailR) # to send emails
library(parallel)
library(doParallel)# foreach parallelization
# Sys.setenv(DO_PAT = "*****")
# Set list of participants' emails
# email_list <- c("first_email@gmail.com", "second_email@gmail.com", ...)
@simecek
simecek / iplot_bug_example.R
Created November 10, 2015 23:52
Minimal example for iplot axis and title overplotting
library(shiny)
library(qtlcharts)
server <- function(input, output) {
output$interactivePlot <- iplot_render({
x <- rnorm(26) * ifelse(input$graphType == "higher values", 10, 1)
y <- rnorm(26) * ifelse(input$graphType == "higher values", 10, 1)
p1 <- iplot(x=x, y=y, indID = LETTERS,
chartOpts = list(title = input$graphType))
return(p1)
@simecek
simecek / rmagic_example.ipynb
Last active January 16, 2021 13:29
How to add R code to your (IPython) Jupyter Notebook
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@simecek
simecek / Management+of+Twitter+Account.ipynb
Last active March 31, 2017 05:22
Managing Twitter Account With Tweepy
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@simecek
simecek / Image+as+Numpy+Array.ipynb
Last active May 15, 2017 16:55
Example of Reading Image Into Numpy Array
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@simecek
simecek / ZIP+example.ipynb
Last active August 4, 2017 13:17
Fetch zipped file without temporary extracting it to disk:
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@simecek
simecek / example.r
Created August 18, 2017 11:04
Classification of jpg files into several one letter subfolders
# example of usage
setwd("c:/Users/simecekp/Downloads/")
fls <- dir(patter=".*jpg")
jpg_sort(fls,c("a", "s"))