Skip to content

Instantly share code, notes, and snippets.

View joowkim's full-sized avatar

J Kim joowkim

  • Ohio, USA
View GitHub Profile
@joowkim
joowkim / tips.txt
Created February 21, 2021 04:02
R library permission denied error!
do not use the username\document\somethingpath
use the below path
.libPaths(.libPaths()[2])
@joowkim
joowkim / z.test.R
Created October 12, 2020 20:42
one-sample-z.test
z.test <- function(x,n,p=NULL,conf.level=0.95,alternative="less") {
ts.z <- NULL
cint <- NULL
p.val <- NULL
phat <- x/n
qhat <- 1 - phat
# If you have p0 from the population or H0, use it.
# Otherwise, use phat and qhat to find SE.phat:
if(length(p) > 0) {
q <- 1-p
birth <- function(n) {
deno <- 365^n
nume <- prod(365:(365-n+1))
result <- 1- (nume / deno)
return(result)
}
nrep <- 10000
@joowkim
joowkim / gist:6afc419e11c11a5f31d3c415db5d4b1d
Created May 6, 2019 12:47
R에서 한글이 깨져나올때.txt
Sys.setlocale("LC_ALL", "korean")
@joowkim
joowkim / regression-anova.md
Last active February 7, 2019 05:12
regression-anova.md
요인 제곱합 자유도 평균제곱 F비
회귀 SSR MSR=SSR/1 F0=MSR/MSE
오차 SSE MSE=SSE/(n-2)
전체 SST

SSR = sigma (yhat.i - ymean)**2 = Regression of Sum of Squares
SSE = sigma (y.i - yhat.i) ** 2 = Error of Sum of Squares
SST = sigma (y.i - ymean)**2 = Toatal Sum of Squares

@joowkim
joowkim / table.md
Last active December 30, 2018 13:27
sampling table combination permutation replacement
order matters order doesn't matter
replacement n^^k (n+k-1 choose k)
don't replace n(n-1)/(n-k+1) (n choose k)
cat SRR_Acc_List.txt | xargs -I {} fastq-dump -split-3 --gzip {}
@joowkim
joowkim / read-fasta.sh
Last active September 27, 2018 04:44
bash this.sh *.fasta
Line=0
for var in "$@"
do
Line=`grep -c ">" $var`
echo $var $Line >> read.cnt.log
done
cat read.cnt.log | sort -k 2 -r
@joowkim
joowkim / read-fq.sh
Last active September 27, 2018 03:14
bash this.sh *.gz
Line=0
for var in "$@"
do
Line=`zcat $var | wc -l`
echo $var $((Line/4)) >> read.cnt.log
done
cat read.cnt.log | sort -k 2 -r
@joowkim
joowkim / star-genes-count.txt
Created August 3, 2018 06:19
star-genes-count
STAR_INDEX="/home/mRNAseq/ref/gencode/human/GRCh37.19/idx/"
INPUT_DIR="00_raw_fastq"
OUTPUT_DIR="01_alignment_genes_count"
GTF="/home/mRNAseq/ref/gencode/human/GRCh37.19/gtf/gencode.v19.annotation.gtf"
RSEM_INDEX="/home/mRNAseq/ref/gencode/human/GRCh37.19/idx/GRCh37.p13.genome"
mkdir -p $OUTPUT_DIR
cat samples.list | parallel --jobs 1 "mkdir -p $OUTPUT_DIR/{}"