Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@arraytools
arraytools / Singularity
Last active April 20, 2024 12:05
Corrected singularity definition file for RNA-Seq analysis. The original file is available from https://hpc.nih.gov/apps/singularity.html. Especially, From: is changed to use miniconda3. I have to comment out sailfish installation.
sudo singularity build rnaseq3 rnaseq3.def
./rnaseq3 cat /etc/os-release # debian 11, host=ubuntu 2204
./rnaseq3 samtools --version # 1.10
./rnaseq3 STAR --version # 2.5.2b
./rnaseq3 fastqc -v # v0.12.1
./rnaseq3 kallisto | head 1 # 0.50.1
./rnaseq3 subread # command not found
./rnaseq3 featureCounts -v | head # v2.0.6
./rnaseq3 ls /opt/conda/bin
./rnaseq3 which gcc # 10.2.1
@arraytools
arraytools / TCGAbiolinks-GBM.Rmd
Last active March 11, 2024 00:27
This is an updated/enhanced version of [TCGAbiolinks to DESEq2](https://rpubs.com/tiagochst/TCGAbiolinks_to_DESEq2)
-3.2510638297872343 -231.0344827586207
-2.2808510638297874 -170.68965517241372
-2.612765957446809 -151.72413793103442
3.1063829787234054 246.55172413793102
3.846808510638298 246.55172413793102
2.7234042553191484 175.86206896551727
2.340425531914893 194.82758620689657
2.519148936170212 158.62068965517244
2.187234042553192 162.0689655172414
2.187234042553192 146.55172413793105
@arraytools
arraytools / dataOutliers.csv
Created March 7, 2024 19:22
Test data containing outliers
0.3114754098360656 0.4101123595505618
0.4499089253187615 0.4082397003745317
0.3460837887067396 0.5580524344569288
0.8105646630236795 0.7584269662921348
0.785063752276867 0.7584269662921348
0.7777777777777779 0.7584269662921348
0.7686703096539163 0.7584269662921348
0.7231329690346083 0.7602996254681647
0.7085610200364298 0.7602996254681647
0.6976320582877961 0.7584269662921348
@arraytools
arraytools / Install_R_RStudio.txt
Created December 30, 2023 20:31
Install multiple versions of R and launch RStudio with different versions of R. Here I assume I'm working on a Debian desktop (Linux distro affects how R is installed and the binary version of RStudio.
# References:
# https://cran.r-project.org/bin/linux/debian/
# https://rviews.rstudio.com/2018/03/21/multiple-versions-of-r/
# 2023/12/30
sudo nano /etc/apt/sources.list # deb-src http://deb.debian.org/debian/ unstable main
sudo apt update
sudo apt build-dep r-base
wget https://cran.r-project.org/src/base/R-4/R-4.3.2.tar.gz
@arraytools
arraytools / officer-R.Rmd
Last active December 27, 2023 22:39
A demonstration of using the 'officer' R package
---
title: "Officer"
output: html_document
date: "2023-12-26"
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(officer)
library(flextable)
@arraytools
arraytools / Dockerfile
Last active December 24, 2023 00:51
RenvDocker example for Docker + Shiny. See https://appsilon.com/renv-with-docker/ for more details.
# Base R Shiny image
FROM rocker/shiny
# Make a directory in the container
RUN mkdir /home/shiny-app
# Install Renv
RUN R -e "install.packages('renv', repos = c(CRAN = 'https://cloud.r-project.org'))"
# Copy Renv files and Shiny app
@arraytools
arraytools / flatpak.txt
Last active November 4, 2023 13:33
flatpak installation process
$ flatpak install com.obsproject.Studio.flatpakref
Note that the directories
'/var/lib/flatpak/exports/share'
'/home/brb/.local/share/flatpak/exports/share'
are not in the search path set by the XDG_DATA_DIRS environment variable, so
applications installed by Flatpak may not appear on your desktop until the
session is restarted.
@arraytools
arraytools / resp.txt
Created September 28, 2023 19:29
respiratory data for running longitudinal data analysis. See the SAS document https://documentation.sas.com/doc/en/pgmsascdc/v_012/statug/statug_gee_examples01.htm.
center id treat sex age baseline visit1 visit2 visit3 visit4
1 1 P M 46 0 0 0 0 0
1 2 P M 28 0 0 0 0 0
1 3 A M 23 1 1 1 1 1
1 4 P M 44 1 1 1 1 0
1 5 P F 13 1 1 1 1 1
1 6 A M 34 0 0 0 0 0
1 7 P M 43 0 1 0 1 1
1 8 A M 28 0 0 0 0 0
1 9 A M 31 1 1 1 1 1
@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