-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnotebook-refactoring-2024-april-02.r
More file actions
88 lines (67 loc) · 2.43 KB
/
notebook-refactoring-2024-april-02.r
File metadata and controls
88 lines (67 loc) · 2.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#' ---
#' title: "cyttools refactoring"
#' author: "Brian Capaldo"
#' date: "4/2/2024"
#' output:
#' html_document:
#' toc: true
#' toc_float: true
#' number_sections: true
#' code_folding: hide
#' ---
#+ message = FALSE, warning = FALSE
#### environment creation ####
#' # Prototyping environment
#'
#' Will be creating a conda env using mamba to get things up and running as
#' quickly as possible. Reviewing code, definitely some inefficiencies to be
#' addressed, but right now, focus is on getting the project running again.
#' Extensive refactoring will be taking place. `cyttoolsFunctions.R` contains
#' all the libraries of packages required.
#+ message = FALSE, warning = FALSE
package_list <- c("radian",
"r-base",
"r-essentials",
"r-devtools",
"r-biocmanager",
"bioconductor-limma",
"bioconductor-ncdfflow",
"bioconductor-opencyto",
"bioconductor-biocparallel",
"bioconductor-edger",
"bioconductor-flowsom",
"bioconductor-flowcore")
create_string <- paste(c("mamba create --name cyttools_env",
package_list),
collapse = " ")
#### test for libraries ####
libraryList <- c("flowCore",
"limma",
"edgeR",
"FlowSOM",
"ncdfFlow",
"openCyto",
"tidyverse")
lapply(libraryList, require, quietly = T, character.only = TRUE)
#### add in docopt ####
install.packages("docopt")
#### export yml ####
export_string <- "conda env export > cyttools.yml"
#### test flowVS code ####
source("cyttoolsFunctions.R")
dir <- "/data/capaldobj/cidc-cyttools-test-bed/"
file <- list.files(dir,
pattern = '.fcs$',
full = TRUE)
#### use panel blank code as template ####
library(flowVS)
flowSet <- read.ncdfFlowSet(file)
panel <- as.data.frame(pData(parameters(flowSet[[1]])))
cofactors_est <- flowVS::estParamFlowVS(flowSet, colnames(flowSet)[-c(1:2)])
dev.off()
targets <- targets %>% mutate(Lineage = if_else(desc %in% c("Time",
"Event_length",
"Viability",
"DNA") | desc == name,
0,
1))