Skip to content

Instantly share code, notes, and snippets.

View kevinrue's full-sized avatar
:octocat:
Computational biology, software development, and R package development

Kevin Rue-Albrecht kevinrue

:octocat:
Computational biology, software development, and R package development
View GitHub Profile
@kevinrue
kevinrue / parse_R_dependencies.R
Created October 22, 2018 08:21
Identify the unique list of R packages loaded by "library" or "require" statements
# The following command:
# - Parses (recursively) all files within the "R/" folder (Change as relevant).
# - Identifies all lines that include the statements "require(" or "library(".
# - Trims everything before and including "require(" or "library(", and everything after the next ")", leaving only the package name.
# - Identifies the unique list of packages loaded in those ways.
grep -Rn '.*\(require\|library\)(.*' R/* | sed 's/.*\(require\|library\)(\(.*\)).*/\2/g' | sort | uniq
@kevinrue
kevinrue / Seurat_PBMC3k_proportion_signatures_per_cluster.Rmd
Created November 25, 2018 17:22
Use the signatures declared in the Seurat tutorial to identify the proportion of each cluster positive for each signature.
---
title: "Proportion of cells matching signatures"
author: "Kevin Rue-Albrecht"
date: "25/11/2018"
output: html_document
editor_options:
chunk_output_type: console
---
```{r setup, include=FALSE}
@kevinrue
kevinrue / Seurat_PBMC3k_tutorial.R
Created November 25, 2018 18:21
Seurat - Guided Clustering Tutorial
# Adapted from https://satijalab.org/seurat/pbmc3k_tutorial.html on 2018-11-24
timestamp()
message("Started")
library(BiocFileCache)
library(Seurat)
library(dplyr)
@kevinrue
kevinrue / Seurat_PBMC3k_TENxPBMCData_tutorial.Rmd
Created November 27, 2018 21:51
Seurat - Guided Clustering Tutorial
---
title: "Seurat PBMC 3k tutorial using TENxPBMCData"
author: "Kevin Rue-Albrecht"
date: "27/11/2018"
output: html_document
editor_options:
chunk_output_type: console
---
```{r setup, include=FALSE}
@kevinrue
kevinrue / Seurat_PBMC3k_proportion_signature.Rmd
Created November 27, 2018 21:58
Use the signatures declared in the Seurat tutorial to identify the proportion of each cluster positive for each signature.
---
title: "Proportion of cells matching signatures"
author: "Kevin Rue-Albrecht"
date: "24/11/2018"
output: html_document
editor_options:
chunk_output_type: console
---
```{r setup, include=FALSE}
@kevinrue
kevinrue / clonePackageSource.R
Created February 22, 2019 11:05
Clone the content of an R package
clonePackageSource <- function(from, to, ignore=c(".git")) {
unisetRootFiles <- list.files(cloneSourceFolder, all.files = TRUE, include.dirs = TRUE)
unisetRootFiles <- setdiff(unisetRootFiles, c(".", "..", ".git"))
dir.create(cloneDestinationFolder, recursive = TRUE)
for (rootFile in unisetRootFiles) {
message(rootFile)
file.copy(
from = file.path(cloneSourceFolder, rootFile),
to = file.path(cloneDestinationFolder),
recursive = TRUE, overwrite = TRUE)
@kevinrue
kevinrue / newRscript.R
Last active March 26, 2019 14:39
Template for Rscript
# Introduction -----
timestamp()
message("Started")
# Packages ----
stopifnot(suppressPackageStartupMessages({
require(optparse)
@kevinrue
kevinrue / iSEE-xaxis-reddim.R
Last active May 24, 2019 09:59
Example apps to demonstrate the use of a reduced dimension on the x-axis of colDataPlot and featAssayPlot
library(scRNAseq)
data(allen)
class(allen)
# Example data ----
library(scater)
sce <- as(allen, "SingleCellExperiment")
counts(sce) <- assay(sce, "tophat_counts")
sce <- normalize(sce)
@kevinrue
kevinrue / blogdown_kevinrue.sh
Created June 27, 2019 03:36
Script to automatically build and deploy my Blogdown website
#!/bin/bash
original_path=$(pwd)
source_path="/Users/kevin/git/kevinrue.github.io-academic"
site_path="/Users/kevin/git/kevinrue.github.io"
echo_eval () {
echo "> $1"
eval "$1"
@kevinrue
kevinrue / cloneRepo.R
Last active July 3, 2019 18:58
A function to clone the content of an R package (perhaps other repositories too)
cloneRepo <- function(from, to) {
repoFiles <- list.files(cloneSourceFolder, all.files = TRUE, include.dirs = TRUE)
repoFiles <- setdiff(repoFiles, c(".", "..", ".git"))
dir.create(to, recursive = TRUE)
for (rootFile in repoFiles) {
message(rootFile)
file.copy(
from = file.path(from, rootFile),
to = file.path(to),
recursive = TRUE, overwrite = TRUE)