I have the following class which begins as follows:
dataSeries <- R6Class("dataSeries",
public = list(
geoAccession = NULL,
species = NULL,
tissue = NULL,
seuratObjectPath = NULL,
markerType = NULL,
clusters = NULL,
clusterTable = NULL,
clusterSymbols = NULL,
clusterPVs = NULL,
clusterGIDs = NULL,
clusterKGs = NULL,
clusterKPs = NULL,
clusterKOs = NULL,
I have another class which begins as follows:
metaSeries <- R6Class("metaSeries",
public = list(
seriesList = NULL,
initialize = function(dataDir="Data/Data_Series/Current"){
browser()
if(!is.null(dataDir)){
toProcess = list.files(dataDir,full.names = T)
self$seriesList = vector("list", length(toProcess))
count = 1
for(file in toProcess){
series <- readRDS(file)
self$seriesList[[count]] <- series
count = count + 1
}
}
},
findMetaFeatures = function(feature="clusterKPs", rank=3, plot=TRUE){
In practice, metaSeries$seriesList will be initialized as a list of type dataSeries. dataSeries$findMetaFeatures must be able to make calls to dataSeries$seriesList[[i]]$feature where feature is in {clusterGIDs,clusterKGs,clusterKPs,clusterKOs}. By default findMetaFeatures is called with feature="clusterKPs". Within metaSeries$findMetaFeatures, I need a way to match the string "clusterKPs" with the attribute that has that name, when examining some object of type dataSeries located in self$seriesList.