From CSBLwiki
Tutorials
-
- Bioconductor course materials
- 2010 introductory course
-
-
Tips
- The script editor with R.gui is a convenient tool (c.f. ESS with Emacs)
- Command + Enter (OS X) or Ctrl + R (windows)
Packages
- Installed @panflam, @panpyro
ape
- an object of class "phylo" with the following components:
- edge a two-column matrix of mode numeric where each row represents an edge of the tree; the nodes and the tips are symbolized with numbers; the tips are numbered 1, 2, ..., and the nodes are numbered after the tips. For each row, the first column gives the ancestor.
- edge.length (optional) a numeric vector giving the lengths of the branches given by edge.
- tip.label a vector of mode character giving the names of the tips; the order of the names in this vector corresponds to the (positive) number in edge.
- Nnode the number of (internal) nodes.
- node.label (optional) a vector of mode character giving the names of the nodes.
- root.edge (optional) a numeric value giving the length of the branch at the root if it exists.
DBI
seqinr
Examples
UMLS
library(RMySQL)
library(DBI)
drv = dbDriver("MySQL")
con = dbConnect(drv,username='',password='',dbname='')
que = "select CUI1,CUI2,COF from MRCOC where SAB=\'CCPSS\'"
ccpss = dbSendQuery(con,statement=que)
ccpss.all = unlist(fetch(ccpss,n=-1))
ccpss.all = matrix(ccpss.all,length(ccpss.all)/3,3)
colnames(ccpss.all) = c('CUI1','CUI2','COF')
tmp = unique(c(ccpss.all[,1],ccpss.all[,2]))
cof = matrix(NA,10877,10877)
dimnames(cof) = list(tmp,tmp)
apply(ccpss.all,1,function(x) { cof[x[1],x[2]]=x[3] })
cof[1:10,1:10]
select m1.CUI,m1.SAB,m1.STR,m1.SDUI,m2.CUI,m2.SAB,m2.STR,m2.SDUI from MRCONSO as m1, MRCONSO as m2 where ((m1.CUI=m2.CUI AND m1.LUI=m2.LUI) AND (m1.SAB='MSH' AND m2.SAB='OMIM')) AND m1.TTY='MH' limit 5;
mysql> select CUI,LUI,CODE,SAB,ATV from MRSAT where SAB='MSH' AND ATN='MN' AND ATV like 'C%' limit 5;
mysql> select * from MRDOC where EXPL like 'OMIM%' limit 10;
mysql> select count(distinct CODE) from MRSAT where SAB='OMIM';
mysql> select count(ATV) from MRSAT where SAB='OMIM' AND ATN='GENESYMBOL';
mysql> select count(distinct ATV) from MRSAT where SAB='OMIM' AND ATN='GENESYMBOL';
mysql> select * from MRCONSO where CUI='C0000744' AND SAB='MTHICD9' AND TS='P';
library(DBI)
library(RMySQL)
drv = dbDriver("MySQL")
con = dbConnect(drv,username='igchoi',password='13579',dbname='umls')
que = "select distinct CUI,CODE from MRSAT where SAB=\'OMIM\'"
ret = dbSendQuery(con,statement=que)
# parsing
ret = unlist(fetch(ret,n=-1))
ret = matrix(ret,length(ret)/2,2)
print(dim(ret))
tot = cbind(ret,rep(NA,nrow(ret)))
# omim2icd9
for (i in 1:nrow(qret)) {
print(i)
qi=paste("select CODE from MRCONSO where CUI=\'",ret[i,1],"\' AND SAB=\'MTHICD9\' AND TS=\'P\'",sep="")
v = dbSendQuery(con,statement=qi)
v = unlist(fetch(v,n=1))
if(length(v)>0) { tot[i,3] = v }
print(i)
}
print(tot[,3])
save.image(file="omim2icd.rdata")
Links