MassBank / RMassBank

Playground for experiments on the official http://bioconductor.org/packages/devel/bioc/html/RMassBank.html
Other
12 stars 15 forks source link

Conditional creation of MassBank records #206

Open tsufz opened 5 years ago

tsufz commented 5 years ago

Add a structure to the record parser to parse only filled tags. Some tags such as publication and project may be not filled and thus doen't need to be parsed into the final record in order avoid post-processing.

schymane commented 5 years ago

Can you please clarify … do you mean that you want to exclude empty record fields during record creation? I.e. the PUBLICATION: field is taken from the settings but if empty, is currently included in the final MassBank records anyway? Is that what you mean? https://github.com/MassBank/RMassBank/blob/master/inst/RMB_options.ini#L41

We do not yet have a project tag implemented, as far as I know. Are there any other fields that are empty? As far as I am aware, it’s only (possibly) the publication one – unless people have not filled out their settings correctly. What happens if you just remove that publication field from your settings file? (if it works that’s the easiest solution!)

tsufz commented 5 years ago

I work on the implemenation and also of implemantion of the project tag #194

meowcat commented 3 years ago

I believe that the better solution is to modularize the annotations tag in the settings. Cf.

https://github.com/MassBank/RMassBank/blob/1d078a8f9d5625e1a4000329d78ddb1c9c4445b6/R/buildRecord.R#L130-L182

Here, we should instead just do

ac_ms <- getOption("RMassBank")$annotations$MASS_SPECTROMETRY
ac_lc <- getOption("RMassBank")$annotations$CHROMATOGRAPHY

plus fill in the retention time and mode. Note that we could move anything compound-specific to .buildRecord.RmbSpectrum2 and pull only settings data here. I think this would be cleaner.

https://github.com/MassBank/RMassBank/blob/17c69e1cc69ef80d18fc0e45f02a3a2ff43549b6/R/buildRecord.R#L204

We should then convert legacy settings files on loading them:

https://github.com/MassBank/RMassBank/blob/1d078a8f9d5625e1a4000329d78ddb1c9c4445b6/R/settings_example.R#L328

This would need to copy $annotations$lc_column to $annotations$CHROMATOGRAPHY$COLUMN_NAME, etc etc

We can also discuss whether we should allow completely arbitrary tags from the settings file, not only AC$MASS_SPECTROMETRY and AC$CHROMATOGRAPHY. This would remove the need for some Treutler fixes. We only need to substitute the dollar, inconveniently.

meowcat commented 3 years ago

We only need to substitute the dollar, inconveniently.

We don't really need to. Hendrik already used dollars in the settings file and it's fine.

meowcat commented 3 years ago

Then in .buildRecord.RmbSpectrum2: