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

runMagic segfault error #105

Closed
RZiffra opened this issue Sep 26, 2019 · 3 comments
Closed

runMagic segfault error #105

RZiffra opened this issue Sep 26, 2019 · 3 comments

Comments

@RZiffra
Copy link

RZiffra commented Sep 26, 2019

Hi Rongxin,

Whenever I try to run the runMagic function on large samples (i.e. 77K cells & 93K cells) I keep getting a segfault error. I have also tried with small number of genes (16) and large numbers (58K). When I run the function with smaller numbers of cells (i.e. 5K & 27K) I don't run into this error.

x.sp <- readRDS("AllPrimary_LSA_Harmony_PreMagic.snap.rds")
x.sp = runMagic(

  • obj=x.sp,
  • input.mat="gmat",
  • step.size=3
  • )
    Epoch: checking the inputs ...

*** caught segfault ***
address 0xffffffff92b506b0, cause 'memory not mapped'

Traceback:
1: A %% A
2: A %
% A
3: runMagic(obj = x.sp, input.mat = "gmat", step.size = 3)

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace

@r3fang
Copy link
Owner

r3fang commented Sep 27, 2019 via email

@suragnair
Copy link

You can try this (described in #149) :

myRunMagic <- function (obj, input.mat, step.size) {
    A = obj@graph@mat;
    data.use = obj@gmat;
    
    # smooth
    A = A + t(A);
    A = A / Matrix::rowSums(A);
    data.use.smooth = A %*% data.use;
    if(step.size > 1){
        for(i in 1:step.size){
            data.use.smooth = A %*% data.use.smooth;
        }
    }
    
    slot(obj, input.mat) = data.use.smooth;    
    return(obj)
}

In the original implementation step.size of 3 would compute A^8, whereas it would compute A^3 in the above. But it is much faster and memory efficient.

@RZiffra
Copy link
Author

RZiffra commented Jan 29, 2020

Thanks, this works well!

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

3 participants