rickhelmus / patRoon

Workflow solutions for mass-spectrometry based non-target analysis.
https://rickhelmus.github.io/patRoon/
GNU General Public License v3.0
58 stars 17 forks source link

Report generation occasionally fails #111

Open MK3491 opened 2 weeks ago

MK3491 commented 2 weeks ago

Hi, The new report looks very nice and works correctly 99.99% of the time. However, recently, after using sirius to generate formulas and structure candidates, followed by MS2Quant estimation, I am getting this error:

report(fGroups,

  • MSPeakLists = mslists,
  • formulas = formulas,
  • compounds = compounds,
  • components = NULL,
  • settingsFile = "report.yml",
  • openReport = TRUE) Loading all EICs... Verifying if your data is centroided... Done! Done! [...] Generating report parts: Feature groups... Features... MS peak lists... Formulas... Quitting from lines 38-370 [unnamed-chunk-12] (./details.Rmd)

Quitting from lines 38-370 [unnamed-chunk-3] (./details.Rmd) Error in transpose(): ! Item 2 of list input is not an atomic vector Backtrace:

  1. bslib::layout_column_wrap(...)
    1. utils$genFormulasTable()
    2. patRoon:::makeAnnReactable(...)
    3. patRoon:::makeReactable(...)
    4. reactable::reactable(...) ...
    5. patRoon:::makeAnnDetailsReact("Formula properties", ft, if (isFGSet(objects$fGroups)) sets(objects$fGroups) else NULL)
    6. patRoon:::makePropTab(tab, sets, FALSE)
    7. base::lapply(...)
    8. patRoon (local) FUN(X[[i]], ...)
    9. data.table::transpose(trow, keep.names = "property")

Legacy CSV table generation also fails:

reportCSV(fGroups,

  • path = "report",
  • formulas = formulas,
  • compounds = compounds,
  • components = NULL) Exporting feature group tables...Done! Exporting formula table... Error in utils::write.table(ft, out, col.names = NA, sep = ",", dec = ".", : unimplemented type 'list' in 'EncodeElement'

Is there anything I can do to help fix this? Best regards, MK

rickhelmus commented 2 weeks ago

Hi MK,

Which version of SIRIUS are you running? I didn't get the chance yet to verify if SIRIUS 6.0 still works with patRoon.

In any case, would you be able to share your formulas object (e.g. with saveRDS)? Then I can hopefully have a look myself.

Thanks, Rick

MK3491 commented 2 weeks ago

formulas.zip Hi, I used Sirius 5.6.2, which I think is the bundled version for the 2.3.1 release. I haven't tried the 6.0 version yet. The zipped formulas.rds is attached, although I am not sure what the attachment size limit for the mailing list is; the file size is almost 14 MB, so likely it will not go through. NULL-ing formulas object works, and both the report and the legacy results csv can be generated correctly, but it's a pity to lose that formula information entirely. Best regards, MK

rickhelmus commented 2 weeks ago

Hello,

Thanks for the file! The attachment went through fine.

It seems in rare cases the ion_formula_mz column data was not filled in correctly. I just pushed a change to GitHub that should mitigate this. Would you be able to test this? You may need to update directly from GitHub, e.g. by running remotes::install_github("rickhelmus/patRoon").

Thanks, Rick

MK3491 commented 2 weeks ago

Hi, Thanks for the info and speedy fix. I updated patRoon from GitHub and started testing it, but it will take a while. I'll probably let you know if it works on Monday. Best regards,MK

On Wednesday, June 19th, 2024 at 14:46, rickhelmus @.***> wrote:

Hello,

Thanks for the file! The attachment went through fine.

It seems in rare cases the ion_formula_mz column data was not filled in correctly. I just pushed a change to GitHub that should mitigate this. Would you be able to test this? You may need to update directly from GitHub, e.g. by running remotes::install_github("rickhelmus/patRoon").

Thanks, Rick

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

rickhelmus commented 2 weeks ago

Great, thanks!

PS: I realize now that forgot to mention you will also need to clearout any cached data to force re-calculation of data, e.g. by running clearCache("formulasSIRIUS")

MK3491 commented 2 weeks ago

I am aware of that, and I did clear the formulas from the cache before starting the test, which is why it will take so long. The dataset I'm using has about 1,400 formulas to calculate. Sorry, but I don't have anything smaller at hand right now.

On Thursday, June 20th, 2024 at 13:48, rickhelmus @.***> wrote:

Great, thanks!

PS: I realize now that forgot to mention you will also need to clearout any cached data to force re-calculation of data, e.g. by running clearCache("formulasSIRIUS")

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

MK3491 commented 1 week ago

Hi, I tested report generation on the three datasets that produced errors before. In the first two cases, the report was generated without any problems. In the third case, an error occurred during the generation of compound annotation plots:

Error in fifelse(!is.na(ret$ion_formula), ret$ion_formula, annPLForms$ion_formula) : Length of 'no' is 2 but must be 1 or length of 'test' (3).

Best regards. MK

On Thursday, June 20th, 2024 at 1:56 PM, MK @.***> wrote:

I am aware of that, and I did clear the formulas from the cache before starting the test, which is why it will take so long. The dataset I'm using has about 1,400 formulas to calculate. Sorry, but I don't have anything smaller at hand right now.

On Thursday, June 20th, 2024 at 13:48, rickhelmus @.***> wrote:

Great, thanks!

PS: I realize now that forgot to mention you will also need to clearout any cached data to force re-calculation of data, e.g. by running clearCache("formulasSIRIUS")

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

rickhelmus commented 1 week ago

Hi MK,

At least we are progressing!

Hmm my hunch is that somehow the MSPeakLists, formulas and compounds are not in sync. Would you be able to share the objects for the mslists, compounds and updated formulas? If GitHub complains about the size being to big, perhaps you could use a filetransfer website like wetransfer.com and send the link to r.helmus@uva.nl.

Thanks, Rick

rickhelmus commented 1 day ago

Hi MK,

Thanks for emailing me the files!

It seemed there were some bugs when dealing with features with more exotic adduct assignments. I just pushed some more fixes, can you give the new version a try? Again, clearing the cache and re-producing the objects will be necessary.

Thanks, Rick