ctlab / gamclust Goto Github PK
View Code? Open in Web Editor NEWGAM-clustering: Metabolic Modules Derivig From RNAseq Data
License: Other
GAM-clustering: Metabolic Modules Derivig From RNAseq Data
License: Other
Hi,
Thank you for providing your tools. But i'm got some issues.
When I run gamClustering function, it threw this error :
# GAM-clustering analysis
results <- gamClustering(E.prep = matrix.prep,
network.prep = network.prep,
cur.centers = cur.centers,
start.base = 0.5,
base.dec = 0.05,
max.module.size = 50,
cor.threshold = 0.7,
p.adj.val.threshold = 0.05,
batch.solver = seq_batch_solver(solver),
work.dir = work.dir,
show.intermediate.clustering = FALSE,
verbose = FALSE,
collect.stats = TRUE)
[*] Iteration 1
[*] Iteration 2
Max cor exceeded 0.7: 0.75
[*] Iteration 3
[*] Iteration 4
[*] Iteration 5
[*] Iteration 6
[*] Iteration 7
[*] Iteration 8
[*] Iteration 9
[*] Iteration 10
[*] Iteration 11
[*] Iteration 12
[*] Iteration 13
[*] Iteration 14
[*] Iteration 15
[*] Iteration 16
[*] Iteration 17
[*] Iteration 18
[*] Iteration 19
[*] Iteration 20
[*] Iteration 21
[*] Iteration 22
[*] Iteration 23
[*] Iteration 24
[*] Iteration 25
Error: Trying to fix variable with value that is out of possible range.
I modulated many options in this function like max.module.size , cor.threshold and p.adj value.
Could you tell me how can I solve this problem?
Hi,
Thank you for providing your tools. But i'm experiencing some issues.
I'm using it, on published data : GSE84901
I followed the tutorial on your git : https://rpubs.com/anastasiiaNG/GAMclust_BULK , to run GAM_clust on bulk RNA data.
but when I run gamClustering function, it threw this error :
[*] Iteration 1
Error in FUN(X[[i]], ...): Not all edge weights are finite numbers
Traceback:
1. gamClustering(E.prep = E.prep, network.prep = network.prep, cur.centers = cur.centers,
. start.base = 0.5, base.dec = 0.05, max.module.size = 30,
. cor.threshold = 0.9, p.adj.val.threshold = 0.001, batch.solver = seq_batch_solver(solver),
. work.dir = work.dir, show.intermediate.clustering = T, verbose = T,
. collect.stats = TRUE)
2. lapply(nets, mwcsr::normalize_sgmwcs_instance, edges.weight.column = "score",
. nodes.weight.column = "score", edges.group.by = "gene", nodes.group.by = NULL,
. group.only.positive = TRUE) # at line 89-94 of file <text>
3. lapply(nets, mwcsr::normalize_sgmwcs_instance, edges.weight.column = "score",
. nodes.weight.column = "score", edges.group.by = "gene", nodes.group.by = NULL,
. group.only.positive = TRUE)
4. FUN(X[[i]], ...)
5. stop(sprintf("Not all edge weights are finite numbers"))
I tried to modify the function gamClustering like this to prevent this error :
gamClustering <- function(E.prep,
network.prep,
cur.centers,
start.base = 0.5,
base.dec = 0.05,
max.module.size = 50,
cor.threshold = 0.8,
p.adj.val.threshold = 0.001,
batch.solver = seq_batch_solver(solver),
work.dir,
show.intermediate.clustering = TRUE,
verbose = TRUE,
collect.stats = TRUE
){
iteration <- 1
[...]
nets <- lapply(idxs, function(i) {
minOther <- pmin(apply(dist.to.centers[-i, , drop=F], 2, min), base)
score <- log2(minOther) - log2(dist.to.centers[i, ])
score[score == Inf] <- 0
score <- pmax(score, -1000)
posScores_keeping_var <<- c(posScores_keeping_var, length(which(score>0)))
EdgeTable <- data.table::as.data.table(data.table::copy(network.prep))
EdgeTable[, score := score[gene]]
EdgeTable[from > to, c("from", "to") := list(to, from)]
EdgeTable <- EdgeTable[order(score, decreasing = T)]
EdgeTable <- unique(EdgeTable, by=c("from", "to"))
# we still keep loops here
##Two line , I added
Iscore <- EdgeTable$score[is.finite(EdgeTable$score)]
EdgeTable <- EdgeTable %>% dplyr::filter(score %in% Iscore)
scored_graph <- igraph::graph_from_data_frame(EdgeTable, directed = F)
igraph::V(scored_graph)$score <- 0
scored_graph
})
nets_attr <- lapply(nets, mwcsr::normalize_sgmwcs_instance,
edges.weight.column = "score",
nodes.weight.column = "score",
edges.group.by = "gene",
nodes.group.by = NULL,
group.only.positive = TRUE)
[..]
With this I can run the function until second iteration but it threw this error :
[*] Iteration 1
>> base was equal to: 0.5;
>> number of modules was equal to: 32;
>> sizes of modules (unique genes) were in range: 0-4
Max diff: 0.42
[*] Iteration 2
Error in eval(expr, envir, enclos): Trying to fix variable with value that is out of possible range.
Traceback:
1. gamClustering(E.prep = E.prep, network.prep = network.prep, cur.centers = cur.centers,
. start.base = 0.5, base.dec = 0.05, max.module.size = 30,
. cor.threshold = 0.9, p.adj.val.threshold = 0.001, batch.solver = seq_batch_solver(solver),
. work.dir = work.dir, show.intermediate.clustering = T, verbose = T,
. collect.stats = TRUE)
2. batch.solver(nets_attr) # at line 99 of file <text>
3. lapply(instances, mwcsr::solve_mwcsp, solver = mwcs_solver)
4. FUN(X[[i]], ...)
5. solve_mwcsp.rnc_solver(X[[i]], ...)
6. sgmwcs_solve(inst_rep, solver)
Is there a way to prepare my count matrix or to fix the error in order to use GAMclust ?
Thank you for your time.
IGuy
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.