본문 바로가기

R관련

(ggplot2) 바그래프와 덴드로그램을 합친 플랏 1. 개요바 그래프 (bar graph)는 범주형 데이터를 x축 또는 y축에 둔 후에 값의 크기를 나머지 다른 축에 그리는 그래프이다. 그런데, 바 그래프의 범주형 데이터가 클러스터링이 되는 경우 단순히 범주형 데이터 이름을 나열하는 것보다는 각 범주 간의 유사도를 보여주는 것이 보다 좋은 표현법이다.본 글에서는 ggplot2를 활용해서 해당 그래프를 그리는 법을 다루고자 한다. 2. 코드# 바그래프와 덴드로그램이 합쳐진 플랏# 라이브러리 셋팅library(ggh4x) # ggplot2의 그림을 그릴 때 포맷팅을 도와주는 라이브러리library('ggdendro') # 덴드로그램을 그리기 위한 라이브러리library(ggplot2) # 바그래프를 그리기 위한 ggplot2 라이브러리# 데이터 준비# 아래.. 더보기
R4.x 도커 파일 (dockerfile for R 4.x) 1. 개요 R은 파이썬과 함께 데이터 분석에서 많이 사용되는 언어이다. 문제는 라이브러리의 상호성 문제 등으로 골치가 아플 때가 있다. root계정으로 환경을 조작하다보면 우분투를 아예 밀어버리는게 나은 상황이 올 수도 있다. 따라서, 도커 환경에서 R을 구동하는게 적절할 것이다. 이를 위해 ubuntu 20.04의 도커에서 R 4.x 버전에서 생명정보학 (bioinformatics) 분석을 할 때 최소한 (?)으로 필요한 패키지들을 설치한다. # R 4.x를 구동하기 위한 도커파일임. FROM ubuntu:20.04 # 이상한 메세지 블락하기 ARG DEBIAN_FRONTEND=noninteractive # 필요 라이브러리 설치 시작 # Working directory 설정 WORKDIR /home #.. 더보기
[conda] R 4.2.0설치하기 conda create -n R4.2 python=3.10 conda activate R4.2 conda search r-base conda install -c conda-forge r-base=4.2.0 conda install -c conda-forge/label/gcc7 r-base=4.2.0 conda deactivate conda activate R4.2 R # 이렇게하면 R4.2가 나오는 것을 볼 수 있을 것이다. # devtools 설치 conda -c r r-devtools conda deactivate conda activate R4.2 #R 킨후 install.packages('processx') 더보기
DESEQ2 normalization Count normalization with DESeq2 | Introduction to DGE (hbctraining.github.io) Count normalization with DESeq2 Approximate time: 60 minutes Learning Objectives Explore different types of normalization methods Become familiar with the DESeqDataSet object Understand how to normalize counts using DESeq2 Normalization The first step in the DE analysis workflow is count hbctraining.githu.. 더보기
Hexbin scatter plot #' scatterPlot_with_Cor.test #' #' This function is to draw and perform correlation test #' Input vector should be presorted. #' @param x(default=NULL) : Input vector for x-axis #' @param y(default=NULL) : Input vector for y-axis #' @param xlab(default=NULL) : Label of x-axis #' @param ylab(default=NULL) : Label of y-axis #' @param title(default=NULL) : title #' @param cex.lab(default=1) : Size .. 더보기
sig_barplot #' Drawing sig barplot #' #' This function is to draw barplot with significant p.value code #' ks.test, t.test and wilcox.test are available. #' @param input_list (default=NULL) : Input list object with names. #' @param test_method (default='t.test',character) : Test option parameter. You can also use ks.test and wilcox.test. #' @param one.sided (default=F) : Whether p-values should be obtained .. 더보기
CMScaller https://github.com/peterawe/CMScaller peterawe/CMScaller Contribute to peterawe/CMScaller development by creating an account on GitHub. github.com The CMScaller package provides Consensus Molecular Subtype (CMS) classification of colorectal cancer pre-clinical models [Guinney 2015; Eide 2017; Sveen 2017]. A small ensembl of functions for evaluating and visualizing results is also included. The c.. 더보기
Efficient R coding-data formatting tidyr : spread, gather data.table : setkey, dt[,lapply(.SD,function(k){~~~}),by='col.names'] dplyr 더보기