andrewrech / antigen.garnish

Other
46 stars 13 forks source link

`system()` can't work correctly after running the demo in document #112

Closed SilenWang closed 4 years ago

SilenWang commented 4 years ago

Hi Lee, Sorry for opening a duplicate issue for my problem... But it seems that I can't reopen an issue closed by Collaborator, and I'm not sure if you can get my reply in a closed issue, so I opened this one.

Now I came across a new error in the latest docker image, detailed information was commented in #110, please delete this issue if you have noticed my reply.

Thanks a lot!

Silen

leeprichman commented 4 years ago

Hi, Lee Thanks a lot for your rapidly reply! But now I came across a new error:

Error in system("which mhcflurry-predict 2> /dev/null", intern = TRUE) : cannot popen 'which mhcflurry-predict 2> /dev/null', probable reason 'Cannot allocate memory' Removing temporary files And below is the code I ran:

library(magrittr)
library(data.table)
library(antigen.garnish)

dt <- data.table::data.table(
        sample_id = "test",
        pep_mut = "MTEYKLVVVGAGDVGKSALTIQLIQNHFVDEYDP",
        mutant_index = "12",
        MHC = "all_human") %>%
garnish_affinity %T>%
str

I tried to run which mhcflurry-predict 2> /dev/null directly in the container, and it could return the location of mhcflurry-predict correctly.

And I also tried to reopen an R process and run system("which mhcflurry-predict 2> /dev/null", intern = TRUE) before running the above code block, and it could also work correctly.

So the problem seems to be that the system() can't work correctly after running the above code block.

Silen

Hi Silen,

I've reproduced your comment above on the last issue #110 for reference. Always helpful to have these in one place for when people are googling how to fix error messages, especially for those running in a docker container.

I suspect this is your docker virtual machine running out of RAM. Running all possible human alleles is relatively memory intensive, since there are now thousands of rows in the table per peptide. If you just want to test if the docker image is working correctly, I would hand pick some HLA alleles of interest and pass those as the MHC argument MHC = "HLA-A*02:01 HLA-A*68:01 HLA-B*07:02" for example.

If you genuinely want to know the affinity of the example peptide for all human alleles, you can increase the amount of RAM available to the docker virtual machine using the Docker Desktop app. I am running this on my laptop now with 4 cores and 2gb memory allocated to the docker VM to test, I'll let you know how it works out.

If you are allocating less than that, I would try increasing the system resources available to the VM (and double check that the actual VM being launched has adopted those new settings, it may require a system restart). If that doesn't fix the problem, let me know and we can find other options.

leeprichman commented 4 years ago

I was able to complete this run (though it took a few hours), using those settings. I would recommend more resources for the VM for such a large job however, or consider running antigen.garnish natively on a linux server with more resources. I am going to change the example in the documentation to something much less system intensive, since there really isn't much of a need for this in example code. Silen please try running with just those three explicitly named HLA types and let me know if there are any errors.

SilenWang commented 4 years ago

Oh, I did run the demo in a virtual machine without many resources... I'll retry it according to your advice, Thanks for your kind guidance!