wkumler / RaMS

R-based access to Mass-Spectrometry data
Other
20 stars 7 forks source link

Parsing extra metadata and parsing encoding only when required #7

Closed ricardo-cunha closed 1 year ago

ricardo-cunha commented 1 year ago

Hi William,

here a suggestion for extra metadata that could be parsed. Also, I changed the parsing of encoding to happen only when necessary (i.e., for "MS1", "MS2", "EIC" and "EIC_MS2"). That is because, if the file does not have spectra (such as mzML with only chromatograms) an error is returned. Maybe would be better to make a check for returning an empty list rather than an error to facilitate downstream data processing. A small change I did was to make ms_levels instead of mslevels to match the other entries. For metadata, we are converting the data.table into a named list. Perhaps that is a better approach than a data.table as it handles better metadata entries with length above one (e.g., ms_levels, analyser, possibly polarity for polarity switching, etc.). Let me know what you think about that as we have that already implemented offline.

Another change I did was to import only the functions you need from utils. If you import the entire package, the utils::View() function is also attached, overwriting the View() default function of RStudio. Basically, the data cannot be seen as pane. Before we bring this to master, all the functions should be added to importFrom. For now I added only txtProgressBar setTxtProgressBar as I could not find others as the functions ran all fine after installing the change RaMS pkg. Are you using others?

ps: please feel free to edit/amend my suggestion. The RoxygenNote version was changed to 7.2.1 in the DESCRIPTION.

Hope to hear from you.

Cheers, Ricardo

wkumler commented 1 year ago

Hi @ricardobachertdacunha, I've just merged your PR into a new branch to make some edits of my own to your contributions. Can you tell me more about the RStudio vs utils conflict and maybe provide a reprex? I don't seem to run into the same issues you're having when importing utils - Viewing a data frame before and after loading RaMS seems to be function identically. I've also forgotten why exactly I've added utils to the import list since it seems to come with base R so this may be entirely removable.