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
source_https <- function(url, ...) { | |
# load package | |
require(RCurl) | |
# parse and evaluate each .R script | |
sapply(c(url, ...), function(u) { | |
eval( | |
parse( | |
text = getURL(u, followlocation = TRUE, | |
cainfo = system.file("CurlSSL", |
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
path <- paste(getwd(), "\\", sep = "") | |
files <- list.files(path=path, pattern="*.csv") | |
for(file in files) | |
{ | |
perpos <- which(strsplit(file, "")[[1]]==".") | |
assign( | |
gsub(" ","",substr(file, 1, perpos-1)), | |
read.csv(paste(path,file,sep=""))) | |
} |
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
import matplotlib.pyplot as plt | |
from skimage.io import imread | |
from skimage.morphology import disk | |
from skimage.filters import rank | |
import numpy as np | |
im_all = imread("/home/scott/Dropbox/wally/ww2.jpg") | |
all_red = im_all[:, :, 0] | |
im_wally = imread("/home/scott/Dropbox/wally/wally2.png") | |
wally_red = im_wally[:, :, 0] |
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
import matplotlib.pyplot as plt | |
from skimage.io import imread | |
from skimage.feature import match_template | |
import matplotlib.pyplot as plt | |
import numpy as np | |
image = imread("image.jpg") | |
wally = imread("wally.png") | |
# select just the red channel |
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(raster) | |
# load images | |
image_DNA <- raster('~/BBBC007_v1_images/A9/A9 p5d.tif') | |
image_actin <- raster('~/BBBC007_v1_images/A9/A9 p5f.tif') |
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
# display images | |
plot(image_DNA, col = gray.colors(max(values(image_DNA)))) | |
plot(image_actin, col = gray.colors(max(values(image_actin)))) |
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
# merge channels | |
image_stack <- brick(image_DNA, image_actin) | |
# display merged image | |
plotRGB(image_stack, stretch = 'lin') |
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
# change colours of channels | |
plotRGB(image_stack, stretch = 'lin' g = 2, b = 1) |
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(ggplot2) | |
library(reshape2) | |
df_expression <- read.csv("expression.csv") | |
df_molten <- melt(df_expression) | |
ggplot(data = df_molten, | |
aes(x = variable, y = MouseID, fill = value)) + | |
geom_raster() + | |
xlab("Protein") + | |
scale_fill_distiller(palette = "RdYlBu", trans = "log10") + |
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
dat <- df_expression[,2:78] # numerical columns | |
rownames(dat) <- df_expression[,1] | |
row.order <- hclust(dist(dat))$order # clustering | |
col.order <- hclust(dist(t(dat)))$order | |
dat_new <- dat[row.order, col.order] # re-order matrix accoring to clustering | |
df_molten_dat <- melt(as.matrix(dat_new)) # reshape into dataframe | |
names(df_molten_dat)[c(1:2)] <- c("MouseID", "Protein") | |
ggplot(data = df_molten_dat, |
OlderNewer