Skip to content

Instantly share code, notes, and snippets.

@arraytools
arraytools / delta_correlated.R
Last active August 6, 2023 16:58
Variance of log(xbar/ybar) by delta method
# Generate {(x1,y1), ..., (xn,yn)} where x1 is indep of (y2, .., yn) but (x1, y1) are correlated.
# Output var(log(xbar/ybar)) 1. sample variance by 'nsim' simulations, 2) delta method approximation
library(MASS)
# Set the sample size and number of simulations
n <- 100
nsim <- 1000
# Set the population means, standard deviations, and correlation
mu_x <- 5
@arraytools
arraytools / vibrant_mine.rstheme
Created May 29, 2023 15:30
Vibrant Ink SB 2 theme for RStudio
/* rs-theme-name: Vibrant Ink SB 2 */
/* rs-theme-is-dark: TRUE */
.ace_gutter {
background: #1a1a1a;
color: #BEBEBE
}
.ace_print-margin {
width: 1px;
background: #444;
}
@arraytools
arraytools / EMgenes.R
Last active February 14, 2023 01:51
Epithelial and mesenchymal gene signatures from Tan et al. 2014 . ‘Table S1B. Generic EMT signature for cell line’ & 'Table S1A. Generic EMT signature for tumour'. See also https://bioconductor.org/packages/release/bioc/vignettes/singscore/inst/doc/singscore.html#22_Sample_scoring_with_a_reduced_number_of_measurements
x <- readxl::read_excel("~/Downloads/EMset.xlsx")
x %>% drop_na() %>% write.table("~/Downloads/EMset.txt", quote=F, row.names = F)
x2 <- read.table("~/Downloads/EMset.txt")
dim(x2) # 218 x 2
epi <- x2[1:170, 2]
mes <- x2[171:218, 2]
x3 <- data.frame(symbol=x2[,2], epimes=c(rep("epi", 170), rep("mes", 48)))
x3[, 1] <- gsub(substr(x3[1,1], 1, 1), "", x3[,1]) # rm "white space'?
write.table(x3, file="~/Downloads/EMgenes_cellline.txt", quote=F, row.names = F, sep="\t")
################################################################################
#
# R.nanorc -- nano syntax-highlighting file for R
#
# Origin: This file is part of the pkgutils package for R.
#
# Usage: This file should be placed in a directory such as /usr/share/nano/ (on
# Ubuntu 12.04). That nano uses syntax highlighting at all might need to be
# enabled separately.
#
@arraytools
arraytools / renv_restore.log
Created January 23, 2023 03:03
Output log from calling renv::restore() on a new computer. This is testing on Ubuntu 22.04, renv 0.16.0.
> renv::restore()
Welcome to renv!
It looks like this is your first time using renv. This is a one-time message,
briefly describing some of renv's functionality.
renv maintains a local cache of data on the filesystem, located at:
- "~/.cache/R/renv"
@arraytools
arraytools / qt5.5_configure
Created July 15, 2015 16:51
qt 5.5 configure options
brb@brb-VirtualBox:~/qt-everywhere-opensource-src-5.5.0$ ./configure -h
+ cd qtbase
+ /home/brb/qt-everywhere-opensource-src-5.5.0/qtbase/configure -top-level -h
Usage: configure [options]
Installation options:
These are optional, but you may specify install directories.
-prefix <dir> ...... The deployment directory, as seen on the target device.
KRT19 E
AGR2 E
RAB25 E
CDH1 E
ERBB3 E
FXYD3 E
SLC44A4 E
S100P E
SCNN1A E
GALNT3 E
@arraytools
arraytools / docker-compose.yml
Last active October 10, 2022 13:36
Grafana using docker
version: '3.3'
services:
node-exporter:
image: quay.io/prometheus/node-exporter:latest
container_name: node_exporter
command:
- '--path.rootfs=/host'
network_mode: host
pid: host
restart: unless-stopped
@arraytools
arraytools / shiny-examples.Rmd
Created September 6, 2022 13:17
create a table of URL links to shiny examples (https://github.com/rstudio/shiny-examples)
---
title: "&nbsp;"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
library(dplyr)
library(knitr)
library(kableExtra)
@arraytools
arraytools / interObj.R
Created January 26, 2022 17:32
Demonstration of interaction model
df <-
structure(list(muc6 = c(0.65991920232772827, 12.234284400939941,
7.5393352508544922, 13.921844482421875, 4.8508410453796387, 0,
6.7801151275634766, 5.5127406120300293, 1.030299186706543, 3.5845346450805664,
0.98191821575164795, 0, 0, 1.052558422088623, 0, 0, 2.5294754505157471,
0.59700602293014526, 0, 0, 7.0485143661499023, 0, 0, 0, 1.1008850336074829,
5.777961254119873, 6.1289887428283691, 0, 4.9814505577087402,
0, 5.4703717231750488, 8.0720577239990234, 0), tumortype = c("Carcinoma",
"sarcoma", "Carcinoma", "Carcinoma", "sarcoma", "sarcoma", "Carcinoma",
"Carcinoma", "sarcoma", "sarcoma", "Carcinoma", "Carcinoma",