본문 바로가기

R관련

scanning ks-test Scanning Kolmogorov-Smirnov statistic A modification to a Kolmogorov-Smirnov statistic, which we term a scanning ranked KS test, was used to determine which mutations alone or co-occurring combinations of mutation combinations can best predict a selective sensitivity to each unknown compound. In addition to single mutations, we also annotated a ‘RAS_Class’ metaclass in which we assigned a cell l.. 더보기
GEOquery, microarray, getGEO GEOquery로 데이터 다운 받기 #Raw data받기 [CEL file이 제공되지 않은 경우도 있음]#getGEOSuppFiles('GSE13861') #processed data받기 gse13861=getGEO('GSE13861',GSEMatrix = T) # Extract informationeset=gse13861[[1]]phe_info=pData(eset) # Phenotopic informationexp=exprs(est) # Expression data 더보기
R package 만들기 http://www.popit.kr/recycled-r/ R package가 loading시에 어떤 기능을 실행하고 싶다면 보통 zzz.R에 저장을 해둠다음과 같이 설정하면 됨. .onAttach = function(libname,pkgname){ packageStartupMessage('osjpkg attaching') source("https://bioconductor.org/biocLite.R") } 더보기
tidyr table다루기 tidyr로 table의 형태를 바꾸기 매우 좋음 example은 file다운 받아서 하면 됨gather와 spread가 있는데 gather는 row가 긴 형태로 만드는 것임 spread는 column이 긴 형태로 만들어줌 gather즉 -time의 의미는 time은 결과물에서 반드시 킵하라는 의미임. 굳이 컬럼명을 쓸필요 없이 몇 번째 column인지 예를 들어 -1을써도 됨.다수의 컬럼의 경우는 -c(1,2,3,10)이런식으로 줘도됨spreadspread는 long에서 wide로 바꿔준다고 생각하면 됨. 더보기
Entrez, Uniprot, Ensembl id to gene symbol conversion library(org.Hs.eg.db)# Uniprot으로 하는 법uni2=select(org.Hs.eg.db,'P04217',c('UNIPROT',"SYMBOL"),'UNIPROT')또는biocLite("UniProt.ws")up=UniProt.ws(taxId = 9606)columns(up)uni2=select(up,keys=unip,columns=c("GENES","GENECARDS")) # ENST 또는 ENSG id로 하는 법library(ENsDb.Hspaiens.v75)source("https://bioconductor.org/biocLite.R")biocLite("EnsDb.Hsapiens.v75")library(EnsDb.Hsapiens.v75)columns(EnsDb.Hsapiens.v.. 더보기
주식데이터 불러오기 install.packages('quantmod')library(xts)library(quantmod)today=Sys.Date() kq=getSymbols('066910.KQ',from=today-365*5,to=today,auto.assign = F)kq=getSymbols('045060.KQ',from=today-365*5,to=today,auto.assign = F) kosdaq 종목을 가져올 때는 종목코드 뒤에 .KQkospi의 경우는 .KRX 일거임 (확실하지 않음 수정 요망) volume : 그날 주식 거래량. 더보기
survival analysis, hazard ratio harzard ratiohttps://www.r-bloggers.com/cox-proportional-hazards-model/ reference로 하고 싶은 즉 hazard ratio를 1로 두고 싶은 것은 factor상 앞으로 오게 해야함예를들면 A로 설정한다던지 1로 설정해야함. library(survival) res.cox 더보기
R euclidean distance(거리) 계산 빠르게 해주는 패키지 install.package('wordspace') library(wordspace) dist_mat=dist.matrix(matrix,method='euclidean') 더보기