Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when calculating significance using lo$calculateSignificanceLevel(100) #13

Open
ArashDepp007 opened this issue Dec 27, 2024 · 0 comments

Comments

@ArashDepp007
Copy link

Dear @konsolerr,
Your tool is giving some good results but, I am getting an error when trying to calculate the significance of correlations using the lo$calculateSignificanceLevel(100) function.
My input data consisted of TPM values for 8000 genes and 1000 samples, to which I ran the following commands:

lo <- LinseedObject$new(a, topGenes = 5000); lo$calculatePairwiseLinearity(); lo$calculateSpearmanCorrelation(); lo$calculateSignificanceLevel(100);
However the last command raises the following error

Error in sparseMatrix(i = ij[, 1], j = ij[, 2], x = values, dims = c(genes, : length(x) must not exceed length(i)

I tried to do some debugging, and identified the problematic part of the code

ij <- which(upper.tri(self$pairwise) & self$pairwise > 0 & self$spearman > spearmanThreshold, arr.ind = T)

values <- self$pairwise[upper.tri(self$pairwise) & self$pairwise > 0 & self$spearman > spearmanThreshold] * self$spearman[upper.tri(self$pairwise) & self$pairwise > 0 & self$spearman > spearmanThreshold]

genes <- nrow(self$pairwise)
edges <- length(values)

So in this section of code, for my data, the variable ij is a matrix of indices with 163623 rows and 2 columns. However, the variable named as values contained 163630 values. Therefore, in next step, when trying to create a sparse matrix with the following code

sparsePP <- sparseMatrix(i = ij[, 1], j = ij[, 2], x = values, dims=c(genes, genes))

It raises an error saying
Error in sparseMatrix(i = ij[, 1], j = ij[, 2], x = values, dims = c(genes, : length(x) must not exceed length(i)

I believe this results from the facts that there is mismatch between the dimensions of ij and length of variable values.
Could you please take a look and help me trouble shoot it?

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

No branches or pull requests

1 participant