Modificar gates_save para que no de error de ambiguedad

This commit is contained in:
2024-04-17 17:29:14 +02:00
parent e189ccebd0
commit 0813dbf52a
+6 -5
View File
@@ -235,13 +235,14 @@ LMD2FCS<-function(files, output.dir=NULL){
gates_save<-function(gs, file="gates.rds", save=T, include=NULL){ gates_save<-function(gs, file="gates.rds", save=T, include=NULL){
gates.list<-list() gates.list<-list()
pop_paths<-gs_get_pop_paths(gs)[gs_get_pop_paths(gs) != "root"] pop_paths_full<-gs_get_pop_paths(gs)[gs_get_pop_paths(gs) != "root"]
if(!is.null(include)){pop_paths<-pop_paths[pop_paths %in% include]} if(!is.null(include)){pop_paths_full<-pop_paths_full[pop_paths %in% include]}
pop_paths<-lapply(pop_paths, function(x) rev(rev(strsplit(x, "/")[[1]])[1:2])) pop_paths<-lapply(pop_paths_full, function(x) rev(rev(strsplit(x, "/")[[1]])[1:2]))
for (gate in pop_paths){ for (gate.in in 1:length(pop_paths)){
gate<-pop_paths[[gate.in]]
parent<-if (gate[1] == ""){"root"}else{gate[1]} parent<-if (gate[1] == ""){"root"}else{gate[1]}
gated_pop<-gate[2] gated_pop<-gate[2]
gates.list[[paste0(parent,"/",gated_pop)]]<-gs_pop_get_gate(gs, gated_pop) gates.list[[paste0(parent,"/",gated_pop)]]<-gs_pop_get_gate(gs, pop_paths_full[gate.in])
} }
if(save){saveRDS(gates.list, file)} if(save){saveRDS(gates.list, file)}
return(gates.list) return(gates.list)