Skip to content

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

Description

@ArashDepp007

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions