mirror of
https://github.com/johrpan/geposan.git
synced 2025-10-26 10:47:25 +01:00
Store more method results
This commit is contained in:
parent
f2bc4318a2
commit
51e7176a1a
5 changed files with 46 additions and 7 deletions
|
|
@ -52,7 +52,7 @@ analyze <- function(preset, progress = NULL) {
|
|||
method_results <- methods[[method_id]](
|
||||
preset,
|
||||
progress = method_progress
|
||||
)
|
||||
)$results
|
||||
|
||||
setnames(method_results, "score", method_id)
|
||||
|
||||
|
|
|
|||
|
|
@ -65,6 +65,14 @@ clusteriness <- function(preset, progress = NULL) {
|
|||
score
|
||||
}
|
||||
|
||||
results[, score := compute(gene), by = 1:nrow(results)]
|
||||
structure(
|
||||
list(
|
||||
results = results[,
|
||||
score := compute(gene),
|
||||
by = gene
|
||||
]
|
||||
),
|
||||
class = "geposan_method_results"
|
||||
)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,6 +76,14 @@ correlation <- function(preset, progress = NULL) {
|
|||
]
|
||||
|
||||
results[, .(gene, score)]
|
||||
|
||||
structure(
|
||||
list(
|
||||
results = results[, .(gene, score)],
|
||||
all_correlations = results
|
||||
),
|
||||
class = "geposan_method_results"
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
|
|
|||
26
R/neural.R
26
R/neural.R
|
|
@ -120,7 +120,7 @@ neural <- function(preset, progress = NULL, seed = 49641) {
|
|||
colnames(training_matrix) <- NULL
|
||||
training_matrix <- keras::normalize(training_matrix)
|
||||
|
||||
keras::fit(
|
||||
fit <- keras::fit(
|
||||
model,
|
||||
x = training_matrix,
|
||||
y = training_data$score,
|
||||
|
|
@ -142,22 +142,40 @@ neural <- function(preset, progress = NULL, seed = 49641) {
|
|||
progress_buffer <<- progress_buffer + progress_step
|
||||
progress(progress_buffer)
|
||||
}
|
||||
|
||||
list(
|
||||
training_gene_ids = training_gene_ids,
|
||||
gene_ids = gene_ids,
|
||||
model = model,
|
||||
fit = fit
|
||||
)
|
||||
}
|
||||
|
||||
# Apply the network to all non-training genes first.
|
||||
apply_network(
|
||||
network <- apply_network(
|
||||
training_data$gene,
|
||||
gene_ids[!gene_ids %chin% training_data$gene]
|
||||
)
|
||||
|
||||
cross_networks <- NULL
|
||||
|
||||
# Apply the network to the training genes leaving out the gene itself.
|
||||
for (training_gene_id in training_data$gene) {
|
||||
apply_network(
|
||||
cross_network <- apply_network(
|
||||
training_data[gene != training_gene_id, gene],
|
||||
training_gene_id
|
||||
)
|
||||
|
||||
cross_networks <- c(cross_networks, cross_network)
|
||||
}
|
||||
|
||||
data[, .(gene, score)]
|
||||
structure(
|
||||
list(
|
||||
results = data[, .(gene, score)],
|
||||
network = network,
|
||||
cross_networks = cross_networks
|
||||
),
|
||||
class = "geposan_method_results"
|
||||
)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,11 @@ proximity <- function(preset, progress = NULL) {
|
|||
progress(1.0)
|
||||
}
|
||||
|
||||
data[, .(gene, score)]
|
||||
structure(
|
||||
list(
|
||||
results = data[, .(gene, score)]
|
||||
),
|
||||
class = "geposan_method_results"
|
||||
)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue