Closed sugyun closed 4 years ago
Hi @sugyun,
did you install CARNIVAL through github or through bioconductor? There is an extensive tutorial available here: https://github.com/saezlab/transcriptutorial/ (e.g. https://github.com/saezlab/transcriptutorial/blob/master/scripts/sample_resolution_carnival.R)
If this doesn't help, can you share your dataframes so we can reproduce your error?
Hi @ivanovaos. Thank you for your reply.
I installed CARNIVAL through bioconductor.
I uploaded my input dataframes. CARNIVALobj.zip (unzip and load in R) Now, I got the following error message. "Error in checkWeightObj(weightObj = weightObj, netObj = netObj) : Something wrong with your weight object/network object. No weighted node is present in the network. You can set the weightObj to NULL." I want to put the ROGENy pathway score (not measured protein activities). (I know that runCARNIVAL function works when I put some protein activities with uniprot ID.)
When I clicked the github websites you gave above, I got "page not found" message. Could you check that it is public github address?
Hi @sugyun, you are right, the repository now is private, but this will change soon. The team works now on publishing it. We will let you know when it is ready.
As for now, how did you request the prior knowledge network? Did you do any filtering on omnipath? CARNIVAL will require you to use weightObj that is matching the nodes in the network, it will help the solver find the optimal solutions faster. So you need to translate the pathways to the most logical representations of them, e.g. see the function below
assignPROGENyScores <- function (progeny = progeny, progenyMembers = progenyMembers,
id = "gene", access_idx = 1)
{
if (id == "uniprot") {
idx <- which(names(progenyMembers) == "uniprot")
progenyMembers <- progenyMembers[[idx]]
}
else {
idx <- which(names(progenyMembers) == "gene")
progenyMembers <- progenyMembers[[idx]]
}
members <- matrix(data = , nrow = 1, ncol = 2)
pathways <- colnames(progeny)
ctrl <- intersect(x = access_idx, y = 1:nrow(progeny))
if (length(ctrl) == 0) {
stop("The indeces you inserted do not correspond to \n the number of rows/samples")
}
for (ii in 1:length(pathways)) {
mm <- progenyMembers[[which(names(progenyMembers) ==
pathways[ii])]]
for (jj in 1:length(mm)) {
members <- rbind(members, c(pathways[ii], mm[jj]))
}
}
members <- members[-1, ]
scores <- matrix(data = , nrow = nrow(progeny), ncol = nrow(members))
colnames(scores) <- members[, 2]
rownames(scores) <- rownames(progeny)
members <- unique(members)
for (i in 1:ncol(scores)) {
for (j in 1:nrow(scores)) {
scores[j, i] <- as.numeric(progeny[j, members[which(members[,
2] == colnames(scores)[i]), 1]])
}
}
pxList <- list()
for (ii in 1:length(access_idx)) {
pxList[[length(pxList) + 1]] <- as.data.frame(t(as.matrix(scores[access_idx[ii],
])))
}
names(pxList) <- rownames(progeny)[ctrl]
return(pxList)
}
progenylist = assignPROGENyScores(progeny = t(weightObj),
progenyMembers = progenyMembers,
id = "uniprot",
access_idx = 1)
runCARNIVAL(inputObj = NULL, measObj = measObj, netObj = netObj, weightObj = progenylist$sample)
Please let me know if it worked out.
Hi @ivanovaos. I don't know input dataframe of assignPROGENyScores function. Could you provide any example dataframe of 'progeny' and 'progenyMembers'? (I uploaded my input dataframes above as you requested. Are those dataframes not enough for runCARNIVAL?)
(+) My weightObj contains 2 rows. The first row contains the names of all "pathways" for contextualising the network while the second row contains the "scores" of each "pathways".
Hi @ivanovaos. I finally solved the problem!
I used your "assignPROGENyScores" function and used "progenyMembers.RData" in CARNIVAL pacakge.
I uploaded my example code (including code, weightObj, netObj, measObj, and progenyMembers.RData). examplecode.zip
Thank you so much for your help! :)
Happy to hear it was helpful. Thanks for sharing the resulting code!
When I put progeny pathway score (dataframe, 1obs. of 14 variables) into runCARNIVAL function as weightObj, I got the following error message. "Error in if (nrow(weightObj) != nrow(measObj)) "
However, my weightObj (dataframe, 1obs. of 14 variables) and measObj (dataframe, 1obs. of 289 variables) have the same number of row.
If you provide example pipeline using progeny pathway score as weightObj, it will be very helpful.
R version 4.0.2 (2020-06-22) CARNIVAL version 1.0.0