@@ -2994,7 +2994,7 @@ ggplot(table.m[grepl("F1|Balanced", table.m$variable),], aes(stim, value, fill =
29942994 theme_bw(base_size = 20 )+ facet_grid(~ variable )+ theme(axis.text.x = element_text(angle = 45 , vjust = 1 , hjust = 1 ))
29952995
29962996
2997- # Figure 5h
2997+ # Figure 5h Gene Ontology----
29982998# biological functions---
29992999library(clusterProfiler )
30003000library(enrichplot )
@@ -3007,6 +3007,7 @@ library(enrichplot)
30073007library(enrichTF );library(RcisTarget )
30083008library(org.Mm.eg.db )
30093009library(DOSE )
3010+ library(reshape2 )
30103011
30113012collect_all = read.delim(" ./infotheo/SLEMI_singlegene_M0M1M2_ISnorm_500genes.txt" )
30123013dcast0 = dcast(collect_all [! grepl(" 0.25|0.5hr|^5hr|1hr|8h|24hr" , collect_all $ time ),], gene ~ type + time , value.var = " cc" )
@@ -3022,6 +3023,7 @@ dcast0$groups = ifelse((dcast0$clusterM1=="DOWN" & dcast0$clusterM2=="DOWN"), "b
30223023 ifelse(dcast0 $ clusterM2 == " DOWN" , " M2onlyDOWN" ,
30233024 " bothUP"
30243025 )))
3026+ write.table(dcast0 ," F://scRNAseq_macro/SuppTables/TableS6_GOgroups.txt" , quote = F ,row.names = F , sep = " \t " )
30253027
30263028genes.to.label = c(" Cxcl10" ," Tgtp1" ," Rsad2" ," Irf7" ," Trim21" ," Ifi205" ," Gbp7" ,
30273029 " Ccl5" , " Tnf" , " Tnfaip3" ," Gclm" , " Il6" ,
@@ -3470,8 +3472,11 @@ p1
34703472library(scales )
34713473macro = readRDS(" ./output/macrophage_PMexpts_Feb2021_rmUnstim_500genes_DBEC.rds" );
34723474# macro = readRDS("./output/macrophage_PMexpts_Feb2021_500genes_DBEC.rds");
3473- p1 = DimPlot(macro , reduction = " tsne" , group.by = " type" )
3474- p2 = FeaturePlot(macro , reduction = " tsne" ,ncol = 2 , features = c(" Pilra" ," Il1b" , " Serpinb2" , " Retnla" ))
3475+ colors_list = (c(PM_B6.LFD = " #F8766D" ,PM_B6.old = " #00BA38" ,PM_B6.HFD = " #619CFF" ))
3476+ p1 = DimPlot(macro , reduction = " tsne" , group.by = " type" )+
3477+ scale_color_manual(values = colors_list )
3478+ p1
3479+ p2 = FeaturePlot(macro , reduction = " tsne" ,ncol = 2 , features = c(" Retnla" ," Serpinb2" ," Cd14" , " Pilra" ))
34753480p2
34763481colors_list = c(' CpG' = " #F8766D" , ' IFNb' = " #B79F00" ,' LPS' = " #00BA38" ,' P3CSK' = " #00BFC4" ,' PIC' = " #619CFF" ,' TNF' = " #F564E3" ,
34773482 ' Unstim' = " black" ,' Unselected' = " gray" )
@@ -4153,6 +4158,8 @@ pheatmap(frame.truncate[,c(2,4,6,5,3)]*-1, scale = "none", clustering_method = "
41534158# annotatePeaks.pl tss mm10 -list ./../genes2GRSclusters_allNFkB.txt -size -1000,500 -hist 10 -m ap1.motif irf3.motif nfkb.motif srf.motif > output_allnfkb_genes.txt
41544159
41554160# plot motif bars
4161+ if (1 ){
4162+ library(stringr )
41564163assignGRS = readxl :: read_excel(" F://BACKUP_USB_20200710_active/Projects_writing/response-specificity/CellSystems_sub/TableS4_gene_regulatory_strategies_allgenes.xlsx" )
41574164assignGRS $ HOMER_AP1 = gsub(" \\ s*\\ ([^\\ )]+\\ )" ," " ,as.character(assignGRS $ HOMER_AP1 ))
41584165assignGRS $ HOMER_NFkB = gsub(" \\ s*\\ ([^\\ )]+\\ )" ," " ,as.character(assignGRS $ HOMER_NFkB ))
@@ -4162,23 +4169,31 @@ assignGRS$HOMER_AP1 = lapply(lapply(lapply(str_split(assignGRS$HOMER_AP1, ","),
41624169assignGRS $ HOMER_NFkB = lapply(lapply(lapply(str_split(assignGRS $ HOMER_NFkB , " ," ), FUN = as.numeric ), FUN = abs ),FUN = min )
41634170assignGRS $ HOMER_IRF = lapply(lapply(lapply(str_split(assignGRS $ HOMER_IRF , " ," ), FUN = as.numeric ), FUN = abs ),FUN = min )
41644171
4165- dist2TSS = 250
4172+ dist2TSS = 300
41664173assignGRS $ HOMER_AP1 = ifelse(assignGRS $ HOMER_AP1 > dist2TSS | assignGRS $ HOMER_AP1 == 0 | assignGRS $ HOMER_AP1 == " NA" | is.na(assignGRS $ HOMER_AP1 ),NA ," AP1" )
41674174assignGRS $ HOMER_NFkB = ifelse(assignGRS $ HOMER_NFkB > dist2TSS | assignGRS $ HOMER_NFkB == 0 | assignGRS $ HOMER_NFkB == " NA" | is.na(assignGRS $ HOMER_NFkB ),NA ," NFkB" )
41684175assignGRS $ HOMER_IRF = ifelse(assignGRS $ HOMER_IRF > dist2TSS | assignGRS $ HOMER_IRF == 0 | assignGRS $ HOMER_IRF == " NA" | is.na(assignGRS $ HOMER_IRF ),NA ," IRF" )
41694176
4170- assignGRS $ AREs = ifelse(assignGRS $ AREs == 1 , NA , assignGRS $ AREs )
4177+ assignGRS $ AREs = ifelse(assignGRS $ AREs > = 2 , " NFkB&p38 " , NA )
41714178
4172- assignGRS.m = melt(assignGRS [,c(1 ,4 ,5 ,6 ,7 ,8 ,10 : 12 ,3 )], id.vars = " gene" )
4179+ write.table(assignGRS [,c(1 : 3 ,5 , 7 : 8 , 14 , 9 ,11 : 13 , 4 )], " F://scRNAseq_macro/SuppTables/TableS4_gene_regulatory_strategies_allgenes_refs.txt" , quote = F , sep = " \t " , row.names = F )
4180+ assignGRS.m = melt(assignGRS [,c(1 ,5 , 7 : 8 , 14 , 9 ,11 : 13 , 4 )], id.vars = " gene" )
41734181assignGRS.m $ rank = seq(1 : nrow(assignGRS ))
41744182# ggplot(subset(assignGRS.m,!is.na(value)), aes(rank,variable)) +
41754183# geom_point(aes(color = value), size =2, alpha=0.5, shape=18)+#position = position_jitter(w = 0, h = 0.2)) +
41764184# # geom_point(subset(assignGRS.m,is.na(value)),aes(color = value), alpha =0.5,position = position_jitter(w = 0, h = 0.2)) +
41774185# theme_bw() +
41784186# theme(axis.text.x=element_text(angle=60, hjust=1))
41794187
4180- ggplot(subset(assignGRS.m ,! is.na(value )), aes(rank )) + facet_wrap(~ variable ,ncol = 1 )+
4188+ ggplot(subset(assignGRS.m ,! is.na(value )), aes(rank )) + facet_wrap(~ variable ,ncol = 1 , strip.position = " left " )+
41814189 geom_bar(aes(color = value ), size = 0.5 , alpha = 0.5 )+ # position = position_jitter(w = 0, h = 0.2)) +
41824190 # geom_point(subset(assignGRS.m,is.na(value)),aes(color = value), alpha =0.5,position = position_jitter(w = 0, h = 0.2)) +
4183- theme_bw() +
4191+ theme_bw(base_size = 10 ) +
41844192 theme(axis.text.x = element_text(angle = 60 , hjust = 1 ))
4193+ }
4194+
4195+ # plot ActD data----
4196+ ggplot(assignGRS , aes(clusters , (ActD_HLchange_3hr ), color = clusters ) )+
4197+ geom_violin()+ geom_point(position = " jitter" )+ ylim(- 500 ,1000 )
4198+
4199+
0 commit comments