huang 0 like s 501 view s
Tags:
lComparison;Category;GO ;Term;Count;GeneRatio;PValue;Genes;ListTotal;PopHits;PopTotal;FoldEnrichment;Bonferroni;Benjamini;FDR;Regulation
LT vs ctrl d3;GOTERM_BP_DIRECT;GO:0006915;Apoptotic process;54;5.538461538;3.32E-05;ENSG00000073111, ENSG00000132530, ENSG00000003400, ENSG00000145779, ENSG00000081189, ENSG00000119969, ENSG00000163568, ENSG00000185634, ENSG00000196074, ENSG00000165949, ENSG00000165948, ENSG00000127191, ENSG00000171310, ENSG00000170542, ENSG00000196954, ENSG00000137752, ENSG00000110330, ENSG00000141682, ENSG00000126709, ENSG00000125538, ENSG00000121858, ENSG00000137393, ENSG00000056558, ENSG00000142856, ENSG00000144354, ENSG00000121454, ENSG00000132357, ENSG00000104689, ENSG00000172059, ENSG00000117676, ENSG00000105290, ENSG00000125347, ENSG00000149554, ENSG00000106144, ENSG00000140464, ENSG00000181634, ENSG00000163545, ENSG00000023445, ENSG00000104312, ENSG00000165806, ENSG00000168918, ENSG00000177595, ENSG00000115008, ENSG00000100906, ENSG00000157601, ENSG00000144655, ENSG00000172936, ENSG00000118503, ENSG00000185880, ENSG00000188313, ENSG00000109320, ENSG00000107262, ENSG00000083093, ENSG00000226979;868;595;17340;1.813034891;0.110812752;0.003183959;0.003121828;up
LT vs ctrl d3;GOTERM_BP_DIRECT;GO:0051301;Cell division;36;3.692307692;1.36E-04;ENSG00000111859, ENSG00000092036, ENSG00000174672, ENSG00000197771, ENSG00000112029, ENSG00000152240, ENSG00000075131, ENSG00000212916, ENSG00000097046, ENSG00000249115, ENSG00000198924, ENSG00000175305, ENSG00000120539, ENSG00000119969, ENSG00000105173, ENSG00000184445, ENSG00000101773, ENSG00000149636, ENSG00000094804, ENSG00000135913, ENSG00000196074, ENSG00000133739, ENSG00000111602, ENSG00000119397, ENSG00000165730, ENSG00000079335, ENSG00000108055, ENSG00000145241, ENSG00000142856, ENSG00000164649, ENSG00000100297, ENSG00000144354, ENSG00000183765, ENSG00000123374, ENSG00000167513, ENSG00000105486;868;360;17340;1.997695853;0.381712586;0.010451504;0.010247558;up
... ...
library(ggplot2)
library(dplyr)
library(magrittr)
library(tidyr)
library(forcats)
mydat <- read.csv("Bubble_R_allTantigens.csv", sep=";", header=TRUE)
mydat$GeneRatio <- sapply(mydat$GeneRatio_frac, function(x) eval(parse(text=x)))
#mydat$FoldEnrichment <- as.numeric(mydat$FoldEnrichment)
mydat$Regulation <- factor(mydat$Regulation, levels=c("up","down"))
mydat$Comparison <- factor(mydat$Comparison, levels=c("sT vs ctrl d3","sT vs ctrl d8","LT vs ctrl d3","LT vs ctrl d8","LTtr vs ctrl d3","LTtr vs ctrl d8","sT+LT vs ctrl d3","sT+LTtr vs ctrl d912"))
mydat$Term <- factor(mydat$Term, levels=rev(c("Cell division", "Cell cycle", "Negative regulation of cell proliferation", "Mitotic cell cycle", "Mitotic sister chromatid segregation", "Mitotic spindle organization", "Chromosome segregation", "DNA replication", "DNA repair", "Cellular response to DNA damage stimulus", "Regulation of transcription, DNA-templated", "Positive regulation of transcription, DNA-templated", "Regulation of transcription from RNA polymerase II promoter", "Negative regulation of transcription from RNA polymerase II promoter", "rRNA processing", "Protein folding", "Immune response", "Inflammatory response", "Positive regulation of I-kappaB kinase/NF-kappaB signaling", "Cellular response to tumor necrosis factor", "Chemotaxis", "Neutrophil chemotaxis", "Innate immune response", "Response to virus", "Defense response to virus", "Cellular response to lipopolysaccharide", "Signal transduction", "Response to drug", "Apoptotic process", "Cell adhesion", "Collagen fibril organization", "Nervous system development", "Axon guidance", "Extracellular matrix organization", "Angiogenesis")))
tiff("Bubble_all-Tantigens_big.tiff", units = "in", width = 35, height = 50, res=500)
#png("bubble.png", width=1400, height=600)
xl <- factor(rev(c("Cell division", "Cell cycle", "Negative regulation of cell proliferation", "Mitotic cell cycle", "Mitotic sister chromatid segregation", "Mitotic spindle organization", "Chromosome segregation", "DNA replication", "DNA repair", "Cellular response to DNA damage stimulus", "Regulation of transcription, DNA-templated", "Positive regulation of transcription, DNA-templated", "Regulation of transcription from RNA polymerase II promoter", "Negative regulation of transcription from RNA polymerase II promoter", "rRNA processing", "Protein folding", "Immune response", "Inflammatory response", "Positive regulation of I-kappaB kinase/NF-kappaB signaling", "Cellular response to tumor necrosis factor", "Chemotaxis", "Neutrophil chemotaxis", "Innate immune response", "Response to virus", "Defense response to virus", "Cellular response to lipopolysaccharide", "Signal transduction", "Response to drug", "Apoptotic process", "Cell adhesion", "Collagen fibril organization", "Nervous system development", "Axon guidance", "Extracellular matrix organization", "Angiogenesis")))
bold.terms <- c("Innate immune response", "Response to virus", "Defense response to virus")
bold.labels <- ifelse((xl) %in% bold.terms, yes = "bold", no = "plain")
#-log10(FDR) can be renamed as 'Significance'
png("bubble_plot.png", 3000, 2000)
ggplot(mydat, aes(y = Term, x = Comparison)) + geom_point(aes(color = Regulation, size = Count, alpha = abs(log10(FDR)))) + scale_color_manual(values = c("up" = "red", "down" = "blue")) + scale_size_continuous(range = c(1, 34)) + labs(x = "", y = "", color="Regulation", size="Count", alpha="-log10(FDR)") + theme(axis.text.y = element_text(face = bold.labels))+ theme(axis.text.x = element_text(angle = 30, vjust = 0.5)) + theme(axis.text = element_text(size = 40)) + theme(legend.text = element_text(size = 40)) + theme(legend.title = element_text(size = 40))+
guides(color = guide_legend(override.aes = list(size = 20)), alpha = guide_legend(override.aes = list(size = 20)))
dev.off()
#---- from chat1 ----
# create a plot using ggplot2 in R, where the color of points is determined by a discrete variable, shading by a continuous variable, and the size by a another continuous variables
# Load ggplot2 library
library(ggplot2)
# Create a data frame with discrete and continuous variables
data <- data.frame(
x = runif(100, 0, 10), # continuous variable for shading
y = runif(100, 0, 10), # continuous variable for size
group = sample(c("A", "B", "C"), 100, replace = TRUE), # discrete variable for color
size = runif(100, 1, 10), # continuous variable for size
Shading = runif(100, 0, 1)
)
# Create the plot
ggplot(data, aes(x, y)) +
geom_point(aes(color = group, size = size, alpha = Shading)) +
scale_color_manual(values = c("A" = "red", "B" = "blue", "C" = "green")) +
scale_size_continuous(range = c(1, 10)) +
labs(title = "Scatter plot with color, size, and shading",
x = "X-axis label",
y = "Y-axis label",
color = "Group",
size = "Size") +
theme_bw()
#---- from chat2 ----
#create a plot using ggplot2 in R, where the color of points is determined by a discrete variable, shading by a continuous variable (but not x), and the size by a another continuous variables
# Load ggplot2 library
library(ggplot2)
# Create a data frame with discrete and continuous variables
data <- data.frame(
x = runif(100, 0, 10), # continuous variable
y = runif(100, 0, 10), # continuous variable for size
group = sample(c("A", "B", "C"), 100, replace = TRUE), # discrete variable for color
shade = rnorm(100, 0, 1) # continuous variable for shading
)
# Create the plot
ggplot(data, aes(x, y)) +
geom_point(aes(color = group, size = shade, alpha = 0.8)) +
scale_color_manual(values = c("A" = "red", "B" = "blue", "C" = "green")) +
scale_size_continuous(range = c(1, 10)) +
labs(title = "Scatter plot with color, size, and shading",
x = "X-axis label",
y = "Y-axis label",
color = "Group",
size = "Shade") +
theme_bw()
#In this example, we use geom_point to create a scatter plot with the x and y variables from the data data frame. The color of each point is determined by the group variable, which is a factor (i.e., a discrete variable). We use the size parameter to make the size of the points vary with the shade variable, which is continuous. We also use the alpha parameter to make the points semi-transparent.
#To specify the colors for each level of the group variable, we use the scale_color_manual function. We also use the scale_size_continuous function to specify the range of sizes for the points. Finally, we add a title and axis labels to the plot using the labs function, and we use the theme_bw function to set the plot theme to a black-and-white style.
#---- from chat3 ----
# Load ggplot2 library
library(ggplot2)
# Create a data frame with continuous and discrete variables
data <- data.frame(
x = runif(100, 0, 10), # continuous variable
y = runif(100, 0, 10), # continuous variable
group = sample(c("A", "B", "C"), 100, replace = TRUE) # discrete variable
)
# Create the plot
ggplot(data, aes(x, y)) +
geom_point(aes(color = group, alpha = x/10)) +
scale_color_manual(values = c("A" = "red", "B" = "blue", "C" = "green")) +
scale_alpha_continuous(range = c(0.2, 10)) +
labs(title = "Scatter plot with color shading and discrete color",
x = "X-axis label",
y = "Y-axis label",
color = "Group")
#In this example, we use geom_point to create a scatter plot with the x and y variables from the data data frame. The color of each point is determined by the group variable, which is a factor (i.e., a discrete variable). We also use the alpha parameter to make the shading of the points vary with the x variable, which is continuous.
#To specify the colors for each level of the group variable, we use the scale_color_manual function. Finally, we add a title and axis labels to the plot using the labs function.
#---- PCA plot from search ----
#https://stackoverflow.com/questions/64688100/how-to-make-geom-point-specific-shapes-for-each-condition-using-scale-shape-manu
#Fixed using this code, to call the shape in aesthetic based on treatment, then giving manual shapes.
cisr5_plot <- ggplot(cisr5scores, aes(x=PC1, y=PC2))+
geom_point(size= 4.5, aes(fill=cisr5$Treatment, shape = cisr5$Treatment), colour="black")+
scale_shape_manual(values=c("Cells" = 21,"HIV-1 R5" = 21,"LPS" = 24,"M. bovis" = 23,"HN878" = 24,"H37Rv" = 21,"EU127" = 24,"CDC1551" = 21))+
scale_fill_manual(breaks=c("Cells","HIV-1 R5", "LPS", "M. bovis", "H37Rv", "HN878", "CDC1551", "EU127"),
values=c("Cells" = "black", "HIV-1 R5" = "ivory3", "LPS" = "royalblue4", "M. bovis" = "darkcyan", "HN878" = "sandybrown", "H37Rv" = "seagreen4", "EU127" = "darkorange1", "CDC1551" = "orangered1"))+
xlab(paste("PC1 ", "(",cisr5exp12[1],"%", ")", sep=""))+
ylab(paste("PC1 ", "(",cisr5exp12[2],"%", ")", sep=""))+
theme(axis.title.y = element_text(size = 24, family = "sans"),
legend.position = "bottom",
legend.text = element_text(size = 22, family = "sans"),
axis.text.x = element_text(colour ="black", size = 22, family = "sans"),
axis.text.y = element_text(colour ="black", size = 22, family = "sans"),
axis.title.x = element_text(colour = "black", size = 24, family = "sans"),
legend.title = element_blank(),
panel.background = element_blank(),
axis.line = element_line(colour = "black"),
plot.title = element_text(size = 10, hjust = 0.5))+
theme(legend.key = element_rect(fill = "white"))
# Load ggplot2 library
library(ggplot2)
# Create a data frame with continuous and discrete variables
data <- data.frame(
x = runif(100, 0, 10), # continuous variable
y = runif(100, 0, 10), # continuous variable
group = sample(c("A", "B", "C"), 100, replace = TRUE) # discrete variable
)
# Create the plot
ggplot(data, aes(x, y)) +
geom_point(aes(color = group, alpha = x)) +
scale_color_manual(values = c("A" = "red", "B" = "blue", "C" = "green")) +
scale_alpha_continuous(range = c(0.2, 1)) +
labs(title = "Scatter plot with color shading and discrete color",
x = "X-axis label",
y = "Y-axis label",
color = "Group")
点赞本文的读者
还没有人对此文章表态
没有评论
Sorry, 没有相似文章
© 2023 XGenes.com Impressum