andrewrech / antigen.garnish

Other
45 stars 13 forks source link

garnish_affinity fails when specify mut, wt peptide and index #119

Closed ShixiangWang closed 4 years ago

ShixiangWang commented 4 years ago
library(magrittr)
library(data.table)
library(antigen.garnish)

# input a data table of peptides for all human MHC types
dt <- data.table::data.table(
  sample_id = "test",
  pep_mut = "MRLVDRRWA",
  pep_wt="VRLVDRRWA",
  mutant_index = "1",
  MHC = "HLA-A*02:01 HLA-A*01:01 HLA-B*07:02 HLA-B*08:01 HLA-C*07:01 HLA-C*07:02")%>%
  garnish_affinity %T>%
  str

Generating variants
Generating nmers
Filtering WT peptide matches.
Checking netMHC scripts in antigen.garnish data directory.
Done.
Running blastp-short to find close matches for differential agretopicity calculation.
Error in if (length(blastdt) == 0 || all(file.info(blastdt)$size == 0)) { : 
  missing value where TRUE/FALSE needed
In addition: Warning messages:
1: In file.remove(.) :
  cannot remove file 'df84072ed6a94ce1_blastpout.csv', reason 'No such file or directory'
2: In utils::download.file("http://get.rech.io/antigen.garnish.usage.txt",  :
  URL 'http://get.rech.io/antigen.garnish.usage.txt': status was 'Couldn't resolve host name'
Removing temporary fasta files
Removing temporary files
ShixiangWang commented 4 years ago

I debugged the process and found the error comes from the following code:

https://github.com/immune-health/antigen.garnish/blob/8e762733bbedd7892a337c4ddb7d59abd4116832/R/antigen.garnish_predict.R#L1995

Before the code, the dt is

> dt                                               
                               var_uuid sample_id   pep_mut
1: 065ad7ba-2565-11ea-ac51-0cc47ab1fdc3      test MRLVDRRWA
2: 065ad7ba-2565-11ea-ac51-0cc47ab1fdc3      test MRLVDRRWA
3: 065ad7ba-2565-11ea-ac51-0cc47ab1fdc3      test MRLVDRRWA
4: 065ad7ba-2565-11ea-ac51-0cc47ab1fdc3      test MRLVDRRWA
      pep_wt mutant_index
1: VRLVDRRWA            1
2: VRLVDRRWA            1
3: VRLVDRRWA            1
4: VRLVDRRWA            1
                                                                       MHC
1: HLA-A*02:01 HLA-A*01:01 HLA-B*07:02 HLA-B*08:01 HLA-C*07:01 HLA-C*07:02
2: HLA-A*02:01 HLA-A*01:01 HLA-B*07:02 HLA-B*08:01 HLA-C*07:01 HLA-C*07:02
3: HLA-A*02:01 HLA-A*01:01 HLA-B*07:02 HLA-B*08:01 HLA-C*07:01 HLA-C*07:02
4: HLA-A*02:01 HLA-A*01:01 HLA-B*07:02 HLA-B*08:01 HLA-C*07:01 HLA-C*07:02
   frameshift      nmer nmer_i  pep_base pep_type nmer_l
1:      FALSE VRLVDRRWA      1 VRLVDRRWA       wt      9
2:      FALSE  VRLVDRRW      1 VRLVDRRWA       wt      8
3:      FALSE MRLVDRRWA      1 MRLVDRRWA   mutnfs      9
4:      FALSE  MRLVDRRW      1 MRLVDRRWA   mutnfs      8

After running this line, all mutant peptides are removed.

Browse[2]> dt %<>% .[!(nmer %chin% mv & pep_type != "wt")]  

Browse[2]> dt                                               
                               var_uuid sample_id   pep_mut
1: 065ad7ba-2565-11ea-ac51-0cc47ab1fdc3      test MRLVDRRWA
2: 065ad7ba-2565-11ea-ac51-0cc47ab1fdc3      test MRLVDRRWA
      pep_wt mutant_index
1: VRLVDRRWA            1
2: VRLVDRRWA            1
                                                                       MHC
1: HLA-A*02:01 HLA-A*01:01 HLA-B*07:02 HLA-B*08:01 HLA-C*07:01 HLA-C*07:02
2: HLA-A*02:01 HLA-A*01:01 HLA-B*07:02 HLA-B*08:01 HLA-C*07:01 HLA-C*07:02
   frameshift      nmer nmer_i  pep_base pep_type nmer_l
1:      FALSE VRLVDRRWA      1 VRLVDRRWA       wt      9
2:      FALSE  VRLVDRRW      1 VRLVDRRWA       wt      8

And I also cannot understand why a 8 mer comes out here. I just want to calculate the 9-mer specified by input.

 pep_mut = "MRLVDRRWA",
 pep_wt="VRLVDRRWA",
 mutant_index = "1"

Any suggestions?

ShixiangWang commented 4 years ago

Finally, I understand this code removes mutant peptides in the normal genome and causes this failure. I think it is not necessary to do this, I want to all self-proteome dissimilarity for all input mutant peptides.

I also want to report that all users in Linux server will get sh: /dev/null: Permission denied after running this tool using the root user. May you take care of the operation permission of this tool?

Best, Shixiang

leeprichman commented 4 years ago

Hi Silen,

The wild-type filter against the reference proteome can be turned off with garnish_affinity(dt, remove_wt = FALSE).

antigen.garnish generates all 8-15mer potential epitopes from the input mutant and wild-type peptides to provide all potential epitopes. Peptide length preference by allele is still not known for many alleles, so we do not restrict the output. You can restrict to only desired peptide lengths in your output table with a vector (9 to 11 here):

dto <- dto[nchar(nmer) %in% 9:11]

I'm not familiar with the /dev/null error, and haven't reproduced it myself. Can you provide more information? Please feel free to open this as a new issue if it persists. Otherwise, perhaps try the solution here.

I'm going to close this out for now because this reflects an input specific problem regarding an empty data.table after wild type filtering that can be resolved by changing the remove_wt input flag.

Best, Lee

ShixiangWang commented 4 years ago

Thanks.

For the permission problem, I have tried the code many times, it works but I will get the same error after running this tool. I am sorry that I don't know how to reproduce it with an example.

rm -f /dev/null; mknod -m 666 /dev/null c 1 3