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

Fix crash with overlapping isotoplogues #4

Open
lparsons opened this issue Jan 21, 2020 · 1 comment
Open

Fix crash with overlapping isotoplogues #4

lparsons opened this issue Jan 21, 2020 · 1 comment

Comments

@lparsons
Copy link
Collaborator

The application crashes without warning when isotoplogues are supplied that extend the number of atoms used for tracing. For example I have C6 but supply up to M+7. This probably doesn't happen with MAVEN but if users would use other tools. For example they usually run C-tracing experiments and extract all the possible isotopologues for C but at another point run N-tracing and just apply the same method, extract the same masses although the higher ones are empty then.
As the atoms are counted anyway it would be nice to remove any overlap, otherwise it has to be done beforehand.

Reported by Matthias P via email

@MPietzke
Copy link

MPietzke commented Oct 8, 2020

What I do is I filter the input before I save the input for Accucor.
For this I added a function to extract the number of atoms of the traced element from the supplied sum formula:

   Extract_Tracer_Count = function(SumFormula, Tracer) {
     if(str_detect(SumFormula, Tracer) == TRUE) {
       Count = str_extract(SumFormula, paste0("(?<=",Tracer,")\\d*"))
       return(ifelse(Count > 1, Count, 1))
     } else return(0) # Tracer not found
   }

and then remove all the rows with a higher isotope count.

      mutate(Tracercount = as.numeric(Extract_Tracer_Count(Formula, input$Tracer_Type))) %>%
      filter(Isotope <= Tracercount) %>%   

maybe this helps? I guess you extract the numbers anyway in the function and can just drop / skip the lines?

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

2 participants