Browse Source

Modificar gates_save para que no de error de ambiguedad

main
marcelcosta 7 months ago
parent
commit
0813dbf52a
1 changed files with 6 additions and 5 deletions
  1. +6
    -5
      functionsCyto.R

+ 6
- 5
functionsCyto.R

@ -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"]
if(!is.null(include)){pop_paths<-pop_paths[pop_paths %in% include]}
pop_paths<-lapply(pop_paths, function(x) rev(rev(strsplit(x, "/")[[1]])[1:2]))
for (gate in pop_paths){
pop_paths_full<-gs_get_pop_paths(gs)[gs_get_pop_paths(gs) != "root"]
if(!is.null(include)){pop_paths_full<-pop_paths_full[pop_paths %in% include]}
pop_paths<-lapply(pop_paths_full, function(x) rev(rev(strsplit(x, "/")[[1]])[1:2]))
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)

Loading…
Cancel
Save