Gates booleanas se hacen en R y no en Flowjo (que enlentece mucho el análisis).
This commit is contained in:
+37
-4
@@ -1079,17 +1079,47 @@ server <- function(input, output) {
|
|||||||
sampleNames(gs)<-sapply(sampleNames(gs), function(x) strsplit(x, "ICs ")[[1]][2]) %>%
|
sampleNames(gs)<-sapply(sampleNames(gs), function(x) strsplit(x, "ICs ")[[1]][2]) %>%
|
||||||
gsub("[[:space:]][0-9]*.fcs_.[0-9]*","", . , perl = T)
|
gsub("[[:space:]][0-9]*.fcs_.[0-9]*","", . , perl = T)
|
||||||
|
|
||||||
|
bool.comb<-apply(
|
||||||
|
expand.grid(c("","!"), c("","!"),c("","!"), c("","!"), c("","!")),
|
||||||
|
1,
|
||||||
|
function(x) paste0(x[1],"CTLA4 & ",x[2],"LAG3 & ",x[3],"PD1 & ",x[4], "TIGIT & ",x[5], "TIM3")
|
||||||
|
)
|
||||||
|
|
||||||
|
bool.name<-apply(
|
||||||
|
expand.grid(c("+","-"), c("+","-"),c("+","-"), c("+","-"), c("+","-")),
|
||||||
|
1,
|
||||||
|
function(x) paste0("CTLA4",x[1]," LAG3",x[2]," PD1",x[3]," TIGIT",x[4]," TIM3",x[5])
|
||||||
|
)
|
||||||
|
|
||||||
|
for (i in 1:length(bool.comb)){
|
||||||
|
print("Booleanos CD8")
|
||||||
|
call<-substitute(booleanFilter(v), list(v=as.symbol(bool.comb[i])))
|
||||||
|
boolgate<-eval(call)
|
||||||
|
gs_pop_add(gs, boolgate, parent="CD8", name = bool.name[i])
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i in 1:length(bool.comb)){
|
||||||
|
print("Booleanos CD4")
|
||||||
|
call<-substitute(booleanFilter(v), list(v=as.symbol(bool.comb[i])))
|
||||||
|
boolgate<-eval(call)
|
||||||
|
gs_pop_add(gs, boolgate, parent="CD4", name = bool.name[i])
|
||||||
|
}
|
||||||
|
|
||||||
|
recompute(gs)
|
||||||
|
|
||||||
nodes<-gs_get_pop_paths(gs)
|
nodes<-gs_get_pop_paths(gs)
|
||||||
# nodes<-gsub("â\u0081»", "-", nodes)
|
# nodes<-gsub("â\u0081»", "-", nodes)
|
||||||
# nodes<-gsub("â\u0081º", "+", nodes)
|
# nodes<-gsub("â\u0081º", "+", nodes)
|
||||||
nodes<-nodes[grepl("CTLA4", nodes)]
|
nodes<-nodes[grepl("CTLA4", nodes)]
|
||||||
nodes<-nodes[!grepl("CD4$|CD8$|CTLA4$|TIM3$|PD1$|LAG3$|TIGIT$|/CTLA4â\u0081»$|/TIM3â\u0081»$|/PD1â\u0081»$|/LAG3â\u0081»$|/TIGITâ\u0081»$", nodes)]
|
nodes<-nodes[!grepl("CD4$|CD8$|CTLA4$|TIM3$|PD1$|LAG3$|TIGIT$", nodes)]
|
||||||
|
|
||||||
pop<-gs_pop_get_stats(gs, nodes=nodes,type="percent") %>% as.data.frame %>% mutate(percent=percent*100)
|
pop<-gs_pop_get_stats(gs, nodes=nodes,type="percent") %>% as.data.frame %>% mutate(percent=percent*100)
|
||||||
pop$percent<-round(pop$percent, digits=2)
|
pop$percent<-round(pop$percent, digits=2)
|
||||||
|
|
||||||
pop$pop<-gsub("â\u0081»", "n", pop$pop)
|
# pop$pop<-gsub("â\u0081»", "n", pop$pop)
|
||||||
pop$pop<-gsub("â\u0081º", "p", pop$pop)
|
# pop$pop<-gsub("â\u0081º", "p", pop$pop)
|
||||||
|
pop$pop<-gsub("-", "n", pop$pop, fixed=T)
|
||||||
|
pop$pop<-gsub("+", "p", pop$pop, fixed=T)
|
||||||
pop$pop<-gsub(" ", "_", pop$pop)
|
pop$pop<-gsub(" ", "_", pop$pop)
|
||||||
|
|
||||||
pop["Type"]<-"ab"
|
pop["Type"]<-"ab"
|
||||||
@@ -1104,10 +1134,13 @@ server <- function(input, output) {
|
|||||||
pop_sp$pop<-sapply(strsplit(pop_sp$pop, "/"), tail, 1)
|
pop_sp$pop<-sapply(strsplit(pop_sp$pop, "/"), tail, 1)
|
||||||
|
|
||||||
pop_sp<-pop_sp %>% select(-ab,-iso) %>% spread(pop,Net)
|
pop_sp<-pop_sp %>% select(-ab,-iso) %>% spread(pop,Net)
|
||||||
pop_sp$`CTLA4n_LAG3n_PD1n_TIGITn_TIM3n`<- pop_sp %>% select(-`CTLA4n_LAG3n_PD1n_TIGITn_TIM3n`) %>% group_by(sample,Population) %>%
|
pop_sp$CTLA4n_LAG3n_PD1n_TIGITn_TIM3n<- pop_sp %>% select(-CTLA4n_LAG3n_PD1n_TIGITn_TIM3n) %>% group_by(sample,Population) %>%
|
||||||
gather(pop, value, -sample,-Population) %>% summarise(n=100-sum(value)) %>% pull(n)
|
gather(pop, value, -sample,-Population) %>% summarise(n=100-sum(value)) %>% pull(n)
|
||||||
pop_sp <- rename(pop_sp, "samples"="sample")
|
pop_sp <- rename(pop_sp, "samples"="sample")
|
||||||
|
|
||||||
|
pop_sql<-sqlFetch(dta, "IC") %>% slice(0)
|
||||||
|
pop_sp<-pop_sp %>% merge(pop_sql, all=T) %>% select(colnames(pop_sql))
|
||||||
|
|
||||||
vartypes<-rep("Number", pop_sp %>% select(-samples, -Population) %>% colnames %>% length)
|
vartypes<-rep("Number", pop_sp %>% select(-samples, -Population) %>% colnames %>% length)
|
||||||
names(vartypes)<-pop_sp %>% select(-samples, -Population) %>% colnames
|
names(vartypes)<-pop_sp %>% select(-samples, -Population) %>% colnames
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user