Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(ComplexHeatmap)
- library(circlize)
- d11 <- read.csv("DC3_7_MUT.txt",stringsAsFactors = FALSE)
- a <- as.data.frame(d11)
- head(a)
- ex <- melt(a, id.vars=c("Gene"))
- head(ex)
- dim(ex)
- bb1 <- ex %>% na.omit() %>%
- group_by(Gene,value) %>%
- mutate(new = n()) %>%
- data.frame()
- #head(bbb)
- #dim(bbb)
- bb1[bb1==""]<-NA
- df <- na.omit(bb1)
- bbb <- df
- features1 = unique(bbb[[3]])
- features_col1 = structure(rand_color(length(features1)), names = features1)
- patients_col1 = structure(1:187, names = unique(bbb[[2]]))
- col1 = ifelse(bbb[[4]], features_col1[bbb[[3]]], "#FFFFFF00")
- col1 = gsub("FF$", "80", col1) # half transparent
- features_count1 = tapply(bbb[[4]], bbb[[3]], sum)
- head(bbb)
- # set color to white if it only exists in one patient/cell
- col1[features_count1[bbb[[3]]] == 1] = "#FFFFFF00"
- pdf("CIRCOS.pdf",20,25)
- chordDiagram(bbb, col = col1, grid.col = c(features_col1, patients_col1))
- dev.off()
Add Comment
Please, Sign In to add comment