Skip to content

Instantly share code, notes, and snippets.

View antonkratz's full-sized avatar

Anton Kratz antonkratz

View GitHub Profile
@antonkratz
antonkratz / symlog_trans.R
Created May 31, 2022 18:14 — forked from davidtedfordholt/symlog_trans.R
A `scales`/`ggplot2` implementation of the `symlog` transformation
#' symlog transformation
#'
#' `symlog_trans()` transforms data using `log(x)` for `abs(x) > thr`, where
#' `thr` is a tuneable threshold, but leaves the data linear for `abs(x) < thr`.
#' (credit for base code to https://stackoverflow.com/users/1320535/julius-vainora)
#'
#'
#' @param base base of logarithm
#' @param thr numeric threshold for transitioning from log to linear
#' @param scale numeric scaling factor for data
@antonkratz
antonkratz / ak.degree.distro.r
Created July 21, 2018 01:55 — forked from ruliana/igraph-degree-distribution.R
Plotting degree distribution with igraph and ggplot2
# Anton Kratz
# date: Sat Jul 21 17:03:22 PDT 2018
suppressPackageStartupMessages(library("igraph"))
suppressPackageStartupMessages(library("ggplot2"))
# Load the PG Yeast Net file - two large components and many small ones
rf <- read.table("~/git/assets/INT.PG.YeastNet.v3.2463gene.54496link.txt", sep="\t")
akg <- graph_from_data_frame(rf, directed = FALSE, vertices = NULL)
# List of degrees