달력

52025  이전 다음

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31

'Coding/R'에 해당되는 글 10건

  1. 2018.08.02 plots
  2. 2018.07.16 PCA
  3. 2018.07.10 [plot]violin plot
  4. 2018.04.04 [R] igraph
  5. 2017.06.13 [plot] barplot with text
  6. 2014.03.14 line plot
  7. 2014.01.28 line plot
  8. 2012.09.19 ggplot histogram
  9. 2012.09.07 ggplot2 barplot
  10. 2012.09.07 ggplot2(pie chart)

plots

2018. 8. 2. 13:23

보호되어 있는 글입니다.
내용을 보시려면 비밀번호를 입력하세요.

PCA

2018. 7. 16. 11:35

보호되어 있는 글입니다.
내용을 보시려면 비밀번호를 입력하세요.

[plot]violin plot

2018. 7. 10. 13:46

보호되어 있는 글입니다.
내용을 보시려면 비밀번호를 입력하세요.

[R] igraph

Coding/R 2018. 4. 4. 11:05

source("https://bioconductor.org/biocLite.R")

biocLite("STRINGdb")



library(STRINGdb)


library(igraph)

g <- read.graph("karate.net", format="pajek")

d <- get.diameter(g)


L <- graph(n=9,c(1,4,2,4,3,4,4,5,5,6,6,7,7,8,8,9),directed=F)

plot(L, layout=layout.fruchterman.reingold, edge.arrow.mode="-", edge.width=2, vertex.label.cex=1.2)


g <- graph.empty (5, directed = FALSE)

new_edges <- c(1,3, 1,5, 2,5, 4,5)

g <- add.edges(g, new_edges)

plot(g)



library(igraph)

dat = as.matrix(read.table('/Users/lsy/Downloads/string_interactions.tsv',sep='\t',header = FALSE))

#dat = rbind(dat,c("BCAM","","0","0","9606.ENSP00000363071","0","0","0","0","0","0","0","0.0","0","0"))

edges = as.vector(t(dat[,1:2]))

g<-graph(edges, n=max(edges), isolates=c("BCAM"))

get.edgelist(g)

plot(g, layout = layout.fruchterman.reingold, vertex.label=V(g)$number,edge.arrow.size=0.5)



library(igraph)

dat = as.matrix(read.table('/Users/lsy/Downloads/string_interactions.tsv',sep='\t',header = FALSE))

edges = as.vector(t(dat[,1:2]))

net <- graph_from_data_frame(d=dat, vertices=unique(edges), directed=T) 

plot(net, edge.arrow.size=.4,vertex.label=NA)

as_data_frame(net, what="edges")

as_data_frame(net, what="vertices")



plot(net, vertex.shape="none", vertex.label=names(V(net)), 

  vertex.label.font=2, vertex.label.color="gray40",

  vertex.label.cex=.7, edge.color="gray85")


E(net)$color[E(net)$weight > 2] <- 'green'

plot.igraph(net,vertex.label=V(net)$name,layout=layout.fruchterman.reingold,edge.arrow.size=0.2,

            vertex.label.color="gray40",edge.color="red",vertex.shape="none"

)





E(testgraph)$color <- as.factor(edges$department)


E(g)$lty[E(g)$weight == 8] <- 1

E(g)$color[E(g)$weight == 3] <- 'green'

E(g)$lty[E(g)$weight == 3] <- 2





library(igraph)

dat = as.matrix(read.table('/Users/lsy/Downloads/string_interactions.tsv',sep='\t',header = FALSE))

edges = as.vector(t(dat[,1:2]))

g<-graph(edges, n=max(edges), isolates=c("BCAM"), directed=FALSE)

E(g)$weight = as.numeric(dat[,15])

E(g)$color <-"skyblue"

E(g)$color[which(E(g)$weight > 0.7)] ="blue"

V(g)$color <-c('red','red','yellow','red','yellow','yellow','yellow')

plot.igraph(g,layout=layout.fruchterman.reingold,

            vertex.shape="circle",vertex.color=c("#Eddfed","#Eddfed","#90A66A","#Eddfed","#C45A63","#C45A63","#C45A63")

            ,vertex.size=30,

            vertex.label=V(g)$name, vertex.label.color=V(g)$color,vertex.label.cex=1, vertex.frame.color= "white",

            edge.arrow.size=0.2,edge.color=E(g)$color,edge.label=c("","PM1689487","","","","PM27559130","",""),

            edge.label.color="black",edge.label.cex=0.7

)



g<-graph(edges, n=max(edges), isolates=c("Glioblastoma\ngene","Damaging\nnsSNV","Tolerated\nnsSNV"), directed=FALSE)

V(g)$color <-c('red','red','yellow','red','yellow','yellow','red','yellow','yellow')

plot.igraph(g,layout=layout.fruchterman.reingold,

            vertex.shape="circle",

            vertex.color=c("#Eddfed","#Eddfed","#90A66A","#Eddfed","#C45A63","#C45A63","#Eddfed","#C45A63","#90A66A")

            ,vertex.size=50,

            vertex.label=V(g)$name, vertex.label.color=V(g)$color,vertex.label.cex=1, vertex.frame.color= "white",

            edge.arrow.size=0.2,edge.color=E(g)$color,edge.label=c("","PM1689487","","","","PM27559130","",""),

            edge.label.color="black",edge.label.cex=0.7

)


de

legend("topleft", legend=c("interaction score > 0.7", "0.7 < interaction score > 0.4"), col=c("blue", "skyblue"), lty=1, cex=0.8)



'Coding > R' 카테고리의 다른 글

PCA  (0) 2018.07.16
[plot]violin plot  (0) 2018.07.10
[plot] barplot with text  (0) 2017.06.13
line plot  (0) 2014.03.14
line plot  (0) 2014.01.28
Posted by jjbang
|

[plot] barplot with text

Coding/R 2017. 6. 13. 15:12

bp = barplot(table(dat[,1]),las=2,ylim = c(0,600),main="Number of experience per cell line in the L1000 data")

text(x = bp, y = table(dat[,1]), label = table(dat[,1]), pos = 3, cex = 0.8, col = "red")


bp = barplot(table(dat[,1]),las=2,ylim = c(0,600),main="Number of experience per cell line in the L1000 data")

text(x = bp, y = table(dat[,1]), label = table(dat[,1]), pos = 3, cex = 0.8, col = "red")

'Coding > R' 카테고리의 다른 글

[plot]violin plot  (0) 2018.07.10
[R] igraph  (0) 2018.04.04
line plot  (0) 2014.03.14
line plot  (0) 2014.01.28
ggplot histogram  (0) 2012.09.19
Posted by jjbang
|

line plot

2014. 3. 14. 10:51

보호되어 있는 글입니다.
내용을 보시려면 비밀번호를 입력하세요.

line plot

2014. 1. 28. 15:50

보호되어 있는 글입니다.
내용을 보시려면 비밀번호를 입력하세요.

ggplot histogram

Coding/R 2012. 9. 19. 19:19
data
44458
43268
42549
40440
37718
34968
34779
34592
32402
31347
31285
31165
31046
31046
29434
29286
28128


b = log2(a)

p = ggplot(a, aes(x = b)) 

p = p + geom_histogram(aes(y = ..density..), binwidth = 1,colour="black", fill="white") 

p= p + geom_density(colour="blue")

p = p + xlab("term frequency in test(log2)") 

p = p + opts(title = "term frequency distribution in sample dataset", legend.title=theme_blank())

p




p = ggplot(a, aes(x = b)) 

p = p + geom_histogram(aes(y = ..density..), binwidth = 1,colour="black", fill="white") 

p= p + geom_density()

'Coding > R' 카테고리의 다른 글

[plot] barplot with text  (0) 2017.06.13
line plot  (0) 2014.03.14
line plot  (0) 2014.01.28
ggplot2 barplot  (0) 2012.09.07
ggplot2(pie chart)  (0) 2012.09.07
Posted by jjbang
|

ggplot2 barplot

Coding/R 2012. 9. 7. 12:55

data

Type mapping_rate

GSE 97.93504477

GPL 56.69988926

GDS 99.96324881

GSM 97.95128376

IDF 96.93251534

ADF 12.13235294

SDRF 96.92645445





code

library(reshape2)

library(ggplot2)

g = read.table("mr.txt", header=TRUE,sep='\t')

p = ggplot(g,aes(x=Type,y=mapping.rate ,fill=Type))+geom_bar()

p = p + xlab("Mapping Rate(%)") + ylab("Type of datas")

p = p + opts(title = "Mapping rateof each data format ", legend.title=theme_blank())

p


'Coding > R' 카테고리의 다른 글

[plot] barplot with text  (0) 2017.06.13
line plot  (0) 2014.03.14
line plot  (0) 2014.01.28
ggplot histogram  (0) 2012.09.19
ggplot2(pie chart)  (0) 2012.09.07
Posted by jjbang
|

ggplot2(pie chart)

Coding/R 2012. 9. 7. 11:47

data

Type Mapped upmapped
GSE 29642 625
GPL 4608 3519
GDS 2720 1
GSM 694599 14528
IDF 948 30
ADF 297 2151
SDRF 883 28





code

library(reshape2) # data 형태 변환

library(ggplot2)

setwd("C:\\Users\\jjbang\\Desktop\\GEE paper\\data\\")

f = read.table("mp.txt", header=TRUE,sep='\t')

tt = melt(f)

p <- ggplot(tt, aes(x = factor(1), y = value, fill = variable)) 

p = p +  geom_bar(width = 1) + coord_polar(theta = "y") + facet_wrap(~Type, scales = "free_y")

p = p+ scale_fill_manual(values=c("#191970", "#CAE1FF"))

p = p + opts(title = "mapping result of GEE when using ontology", legend.title=theme_blank())

p = p + xlab(" ") + ylab(" ")

p

'Coding > R' 카테고리의 다른 글

[plot] barplot with text  (0) 2017.06.13
line plot  (0) 2014.03.14
line plot  (0) 2014.01.28
ggplot histogram  (0) 2012.09.19
ggplot2 barplot  (0) 2012.09.07
Posted by jjbang
|