Code Monkey home page Code Monkey logo

Comments (8)

govekk avatar govekk commented on June 7, 2024

Hi, thanks for using our package! I'll need a bit more information to help with this:

  1. Could you please run it with num_cores=1 and see if there is a different error? The one you are getting typically hides any errors in the parallelized code.
  2. Are you running this on Windows, Mac, Linux or our Docker container?
  3. How many cells and proteins do you have? It is possible that you are running out of memory if you have many proteins, which might require you to use fewer cores or manually input the protein pairs you are interested in.

from stvea.

classycammy avatar classycammy commented on June 7, 2024

Thanks so much for your response. I deeply appreciate it. In regards to your following questions:

1. Could you please run it with num_cores=1 and see if there is a different error? The one you are getting typically hides any errors in the parallelized code.

The errors are:

> protein_adj <- AdjScoreProteins(stvea_object, k=3, num_cores=1)
Creating permutation matricesError in ext[[class2]] : no such index at level 1
In addition: Warning messages:
1: In if (class(f) != "matrix") { :
  the condition has length > 1 and only the first element will be used
2: In if (class(f_pairs) == "list") { :
  the condition has length > 1 and only the first element will be used

Are there any tricks to generate out the full errors? I did try verbose but it's not included in the argument.

2. Are you running this on Windows, Mac, Linux or our Docker container?

I am running in Linux. I also tried Mac and the same errors occurred.

3. How many cells and proteins do you have? It is possible that you are running out of memory if you have many proteins, which might require you to use fewer cores or manually input the protein pairs you are interested in.

I have 150K cells and 38 protein markers.

I do appreciate any advises. Thanks so much.

Cheers
Cam

from stvea.

govekk avatar govekk commented on June 7, 2024

Often calling traceback() right after you get an error can print out the full stack of that error in R. That would help me see if the error is occurring in our package or in an outside package we call. 

What version of R are you using? My guess is the warnings are caused by a recent change in R 4.0, where class() of a matrix is now ("matrix" "array"), not just "matrix". I don't believe this should be changing how the code runs, since the first element is still "matrix", but I will address the warning messages in a future commit. Thank you for bringing that to our attention.

It is possible the actual error is being caused by a similar change to R 4.0, as we have not tested the package on that R version since it was released in October. The code may run fine on your data in an earlier R version, but I appreciate any help you can give in figuring out this error so we can improve the package for the newest version.

Thanks!

from stvea.

classycammy avatar classycammy commented on June 7, 2024

See below for the print out:

> traceback()
9: possibleExtends(thisClass, Class)
8: isFALSE(ext)
7: as(t(sapply(1:nrow(permutations), function(j) f[i, ][permutations[j, 
       ]])), class(f))
6: FUN(X[[i]], ...)
5: lapply(X = X, FUN = FUN, ...)
4: mclapply(1:nrow(f), function(i) as(t(sapply(1:nrow(permutations), 
       function(j) f[i, ][permutations[j, ]])), class(f)), mc.cores = num_cores)
3: adjacency_score(adj_matrix, codex_protein_cut, protein_pairs, 
       c = c, num_cores = num_cores, num_perms = num_perms, perm_estimate = perm_estimate)
2: AdjScoreProteins.internal(knn_adj, stvea_object@codex_protein, 
       protein_pairs, c = c, num_cores = num_cores, num_perms = num_perms, 
       perm_estimate = perm_estimate)
1: AdjScoreProteins(stvea_object, k = 3, num_cores = 1)

Yes I am using R version 4.0.2 (2020-06-22). I look forward to your next suggestion and recommendation as this package is super helpful in analysing interesting cell-to-cell protein markers. I appreciate it. Thanks very much!

from stvea.

govekk avatar govekk commented on June 7, 2024

Thank you for your help with this. The error was caused by a similar change in the behavior of class() in our AdjacencyScore package, which this function uses. I have updated that package and it appears to be working. You will have to reinstall AdjacencyScore to apply the changes. Please let me know if there are any other issues.

from stvea.

classycammy avatar classycammy commented on June 7, 2024

Hi - Thanks so much for the lovely update! I have some issues running it. Please see below

> protein_adj <- AdjScoreProteins(stvea_object, k=3, num_cores=8)
Creating permutation matrices - 69.43 seconds
Computing adjacency score for each feature pairError: $ operator is invalid for atomic vectors
In addition: Warning messages:
1: In if (class(f) != "matrix") { :
  the condition has length > 1 and only the first element will be used
2: In if (class(f_pairs) == "list") { :
  the condition has length > 1 and only the first element will be used
3: In mclapply(1:nrow(f), function(i) as(t(sapply(1:nrow(permutations),  :
  all scheduled cores encountered errors in user code
4: In mclapply(work, worker, mc.cores = num_cores) :
  all scheduled cores encountered errors in user code
> traceback()
4: p.adjust(qqh$p, method = "BH")
3: adjacency_score(adj_matrix, codex_protein_cut, protein_pairs, 
       c = c, num_cores = num_cores, num_perms = num_perms, perm_estimate = perm_estimate)
2: AdjScoreProteins.internal(knn_adj, stvea_object@codex_protein, 
       protein_pairs, c = c, num_cores = num_cores, num_perms = num_perms, 
       perm_estimate = perm_estimate)
1: AdjScoreProteins(stvea_object, k = 3, num_cores = 8)

Could you please provide additional advise on whether it is my data or the code itself? I am running using my Linux/Ubuntu computer. Thanks so much. I really appreciate it again.

from stvea.

govekk avatar govekk commented on June 7, 2024

Hi, it looks like you didn't reinstall the AdjacencyScore package or R didn't reload the package once installed. It worked for me to run devtools::install_github("CamaraLab/AdjacencyScore") and then restart my R session.

from stvea.

classycammy avatar classycammy commented on June 7, 2024

Hi, Thanks so much for the advises! It works like a charm. On a side note, if this is useful for others, I used num_cores=1 as R has difficulty with multi-thread processing using 8 cores. I deeply appreciate this @govekk

from stvea.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.