Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Update modeling.R #203

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Update modeling.R #203

wants to merge 4 commits into from

Conversation

stemangiola
Copy link

@stemangiola stemangiola commented May 20, 2021

In my dataset, the third dimension is 1, so drop=F avoids software crash.

Could you also please advise whether this is sometimes expected?

@@ -49,7 +49,7 @@ netAnalysis_contribution <- function(object, signaling, signaling.name = NULL, w
pairLR <- pairLR[pairLR.name.use,]
}

prob <- prob[,,pairLR.name.use]
prob <- prob[,,pairLR.name.use, drop=FALSE]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not necessary as we have if (length(dim(prob)) == 2) below.

R/modeling.R Outdated
@@ -375,7 +375,7 @@ computeCommunProbPathway <- function(object = NULL, net = NULL, pairLR.use = NUL
group <- factor(pairLR.use$pathway_name, levels = pathways)
prob.pathways <- aperm(apply(prob, c(1, 2), by, group, sum), c(2, 3, 1))
pathways.sig <- pathways[apply(prob.pathways, 3, sum) != 0]
prob.pathways.sig <- prob.pathways[,,pathways.sig]
prob.pathways.sig <- prob.pathways[,,pathways.sig, drop=FALSE]
idx <- sort(apply(prob.pathways.sig, 3, sum), decreasing=TRUE, index.return = TRUE)$ix
pathways.sig <- pathways.sig[idx]
prob.pathways.sig <- prob.pathways.sig[, , idx]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also change line 381 prob.pathways.sig <- prob.pathways.sig[, , idx] to prob.pathways.sig <- prob.pathways.sig[, , idx, drop=FALSE]

@sqjin
Copy link
Owner

sqjin commented May 20, 2021

@stemangiola Thanks for your contribution. I made two comments. Can you please edit them and then I will merge these pull requests.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants