vanmooylipidomics/LOBSTAHS

excludeoddFAlength, IP_MAG class

j-e-hunter opened this issue · 9 comments

doLOBScreen doesn't remove odd FA bearing lipids of the IP_MAG class when exclude.oddFA = TRUE, i think.....

`

1

excludeoddFAlength = function(matched.frag_IDs, database) {
  |  
  | ID.eval = rep(TRUE, length(matched.frag_IDs)) # vector of logicals to record
  | # of the compliance of each
  | # assignment
  |  
  | if (length(matched.frag_IDs)>0) { # matches were made to this feature
  |  
  | for (i in 1:length(matched.frag_IDs)) {
  |  
  | if (lipid_class(database)[frag_ID(database)==
  | matched.frag_IDs[i]] %in%
  | c("IP_DAG","PUA","FFA","TAG")) {
  |  
  | if (FA_total_no_C(database)[frag_ID(database)==
  | matched.frag_IDs[i]]%%2!=0) {
  |  
  | ID.eval[i] = FALSE
  |  
  | }
  |  
  | }
  |  
  | }
  |  
  | }
  |  
  | return(matched.frag_IDs[ID.eval])
  |  
  | }

`

Further to the above, Do you guys have any ideas about how I might resolve the error:

Error in if (FA_total_no_C(database)[frag_ID(database) == matched.frag_IDs[i]]%%2 != :
missing value where TRUE/FALSE needed

During doLOBscreen, when using exclude.oddFA = TRUE? It does the first 60 pseudospectra and then crashes on pseudospectrum 61 weirdly.

I tried adding in “IP_MAG” to the exclude.oddFA code, but it didn’t help.

I don’t know where to start with this one.

hholm commented

I have also seen this problem.

lee-t commented

New version has resolved this issue. leaving open until its finalized and uploaded

Hello! I'm getting the same error as Jonathan Hunter when running doLOBscreen with exlcude.oddFA = T

Error in if (FA_total_no_C(database)[frag_ID(database) == matched.frag_IDs[i]]%%2 != :
missing value where TRUE/FALSE needed

It gets through 97 of 4529 pseudospectra before throwing the error.

I've tried uninstalling LOBSTAHS 1.18 .0 and re-installing 1.12.0 I also updated R 4.1.1. and started the xcms-CAMERA pipeline from the beginning with roughly the same result.

Any ideas on how to tackle this other than changing exclude.oddFA = F? Thanks!

hholm commented

Hey Bethanie! My apologies on this - this has been an outstanding bug for way too long. Obviously whatever patch t-lee had didn't resolve it. Ill have a look and see if I can fix it sometime in the next few days.

hholm commented

@br-edwards I think I have found the problem - could you give me a bit more info about what version of the database you are using?

hholm commented

I've duplicated the problem here with the default database - documenting it here for the future. The problem seems to be that some of our deuterated standards in the database have the class "FFA" or "TAG" BUT are unique species NOT acyl iteration species (i.e. they don't have a C number generated by the database, its just for that one species). The function first checks that a compound belongs to one of these classes:

if (lipid_class(database)[frag_ID(database)== matched.frag_IDs[i]] %in% c("IP_DAG","PUA","FFA","TAG","IP_MAG")) {

and then eliminates it if it is odd

if (FA_total_no_C(database)[frag_ID(database)== matched.frag_IDs[i]]%%2!=0) {

However carbon number for these species is "NA" as it wasn't generated by acyl interaction so you get NA != 0 which returns NA to an 'if' function and it throws an error. Too avoid this I have added the following code to check if the species has a numeric carbon number.

if(!is.na(FA_total_no_C(database)[frag_ID(database)== matched.frag_IDs[i]])){

There seems to be a few other places this is a problem - will address them and then put an update here.

hholm commented

Ok there was the same problem with exclude_dblebond I fixed that in the same way. @br-edwards I believe this fixed the issue but I am going to keep this open until I hear from you!

Use devtools::install_github("vanmooylipidomics/LOBSTAHS") to reinstall.

hholm commented

@br-edwards I am going to close this issue because I have not run into it since my patch 9 days ago. Please please reach out if you are experiencing any more errors around it!