Skip to content

Instantly share code, notes, and snippets.

@lazappi
lazappi / graph-diffusion.R
Created July 3, 2019 07:39
Toy implementation for propagating updates through a graph
library("igraph")
set.seed(1)
n_nodes <- 20000
raw_graph <- sample_forestfire(n_nodes, 0.1)
graph_data <- get.data.frame(raw_graph)
graph_data <- graph_data[, c("from", "to")]
graph_data$weight <- rnorm(nrow(graph_data))
graph <- graph.data.frame(graph_data)
# Handy packages!
## here
# Provides a relative file path from your project directory
#
# https://here.r-lib.org/
# https://cran.r-project.org/web/packages/here/index.html
# https://github.com/r-lib/here
@lazappi
lazappi / splatSimulateFixedGenes.R
Created April 9, 2018 06:04
Modified version of the splatSimulate function that allows the gene means to be fixed
#' Splat simulation (fixed genes)
#'
#' Modified version of the splatSimulate function that allows the gene means to
#' be fixed
#'
#' @param params SplatParams object containing parameters for the simulation.
#' See \code{\link{SplatParams}} for details.
#' @param means vector of gene means, must be the same length as the number of
#' genes to simulate
#' @param method which simulation method to use. Options are "single" which
@lazappi
lazappi / abacbs17_software.csv
Last active November 27, 2017 22:56
Software tools mentioned at #COMBINE17 and #abacbs17 and #BiocAsia
url name user type
https://bioconductor.org/packages/splatter splatter NA Bioconductor
https://bioconductor.org/packages/Sushi Sushi NA Bioconductor
https://bioconductor.org/packages/diffHic diffHic NA Bioconductor
https://bioconductor.org/packages/miRBaseConverter miRBaseConverter NA Bioconductor
https://bioconductor.org/packages/miRLAB miRLAB NA Bioconductor
https://bioconductor.org/packages/miRsponge miRsponge NA Bioconductor
https://bioconductor.org/packages/scPipe scPipe NA Bioconductor
https://bioconductor.org/packages/ClassifyR ClassifyR NA Bioconductor
https://bioconductor.org/packages/monocle monocle NA Bioconductor
@lazappi
lazappi / clustering_tree.R
Created October 19, 2017 01:48
Functions for plotting a clustering tree from a Seurat object that has been clustered at different resolutions, or a data.frame describing clusterings.
#' Get tree nodes
#'
#' Get the nodes required for a clustering tree
#'
#' @param clusterings data.frame describing clusterings at different
#' resolutions. Columns must be named "res.X" where X is numeric and indicates
#' the clustering resolution.
#' @param tSNE data.frame giving the t-SNE positions of each cell
#'
#' @return data.frame contining the nodes of a clustering tree