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(ShortRead) | |
## create a single string with the number of characters defined by 'length' | |
## and the letter sampled from 'alphabet' | |
generateString <- function(length = 50, alphabet = c("A","C","G","T") ) { | |
paste0(sample(alphabet, size = length, replace = TRUE), collapse = "") | |
} | |
## create a ShortReadQ object containing 'nreads' reads, each of which has length 'length' | |
createFastq <- function(nreads, length) { |
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
fullXmlQuery <- "<?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE Query> | |
<Query virtualSchemaName = 'default' uniqueRows = '1' count = '0' datasetConfigVersion = '0.6' header='1' requestid= 'biomaRt'> | |
<Dataset name = 'hsapiens_gene_ensembl'> | |
<Attribute name = 'ensembl_transcript_id'/> | |
<Attribute name = 'ensembl_exon_id'/> | |
<Attribute name = 'rank'/> | |
<Attribute name = 'genomic_coding_start'/> | |
<Attribute name = 'cds_start'/> | |
<Attribute name = '5_utr_start'/> | |
</Dataset> |
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
fullXmlQuery <- "<?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE Query> | |
<Query virtualSchemaName = 'default' uniqueRows = '1' count = '0' datasetConfigVersion = '0.6' header='1' requestid= 'biomaRt'> | |
<Dataset name = 'hsapiens_gene_ensembl'> | |
<Attribute name = 'phenotype_description'/> | |
<Attribute name = 'ensembl_gene_id'/> | |
<Filter name = 'ensembl_gene_id' value = 'ENSG00000094804'/> | |
</Dataset> | |
</Query>" | |
rcurl_return <- RCurl::postForm(uri = "http://www.ensembl.org:80/biomart/martservice?", |
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(TENxBrainData) | |
library(ggplot2) | |
library(tidyr) | |
tenx <- TENxBrainData() | |
ncols <- c(1,2,5,10,20,50,100,200,500,1000) | |
svd <- bda <- numeric(length = length(ncols)) |
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(gridExtra) | |
## create 17 plots, where the only element is a number in the centre | |
res <- list() | |
for(i in 1:17) { | |
x <- data.frame(x = 1, y = 1, num = as.character(i)) | |
res[[i]] <- ggplot(x, aes(x = x, y = y, label = num)) + | |
geom_text() + | |
theme_void() + |
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(rhdf5) | |
hslab_bm <- function(m = 10000, n = 10000) { | |
## TENxBrainData | |
fid <- H5Fopen('/media/Storage/Work/ExperimentHub/1040') | |
did <- H5Dopen(h5loc = fid, 'counts') | |
sid <- H5Dget_space(did) | |
## select first 100 rows and a random (ordered) sample of columns | |
index <- list(1:100, |
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
WD <- tempdir() | |
setwd(WD) | |
library(EBImage) | |
library(tidyverse) | |
## download example zip file ad unpack | |
download.file('https://www.dropbox.com/s/40e5tfohgdm9wlo/IF015_plate002_test.zip?dl=1', | |
destfile = 'IF015_plate002.zip', mode = "wb") | |
unzip('IF015_plate002.zip') |
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
BiocManager::install("grimbough/rhdf5", ref = "f06ab6f", | |
update = FALSE, ask = TRUE, INSTALL_opts = c('--no-lock')) | |
suppressPackageStartupMessages(library(rhdf5)) | |
suppressPackageStartupMessages(library(microbenchmark)) | |
suppressPackageStartupMessages(library(ggplot2)) | |
suppressPackageStartupMessages(library(dplyr)) | |
suppressPackageStartupMessages(library(stringr)) | |
h5file <- "/tmpdata/msmith/ExperimentHub/2230" |
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
This code chunk will extract all code blocks from `example.Rmd` and write them to a temporary file, preservining chunk options. It will then read them and make those chunks avaliable in the current R environment when the presentation is knitted. | |
```{r include, eval=TRUE, echo=FALSE, include = FALSE} | |
tmp_script <- tempfile() | |
knitr::purl("example.Rmd", output=tmp_script, quiet = TRUE) | |
knitr::read_chunk(tmp_script) | |
``` | |
We can then include a chunk from `example.Rmd` like so: |
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
/* | |
* Confirming hyperslab issue remains when combining two selections | |
* using H5Scombine_select | |
*/ | |
#include <hdf5.h> | |
#include <stdlib.h> | |
#define FILE "subset.h5" | |
#define DATASETNAME "IntArray" |
OlderNewer