Mesnage-Org / pgfinder

Peptidoglycan MS1 Analysis Tool
https://mesnage-org.github.io/pgfinder
GNU Lesser General Public License v3.0
4 stars 2 forks source link

Add Cross-Replicate Consolidation #270

Open TheLostLambda opened 6 months ago

TheLostLambda commented 6 months ago

Here are some pointers that I think might help with the implementation!

The goal is to generate an extra, consolidated CSV file when several datasets are uploaded and an "Advanced > Consolidation" option is ticked. If you uploaded three datasets, enabled consolidation, then ran PGFinder, it should download four files. Three of those will be the three it returns now (one CSV file per dataset), and the fourth will be the consolidation of those other three.

The place to loop into this is here: https://github.com/Mesnage-Org/pgfinder/blob/a334000b23fa7a676c0bfb93b40218341e5f7dc7/lib/pgfinder/gui/shim.py#L17-L36

Writing the actual consolidation function should be relatively straightforward:

  1. Stack / vcat the dataframes from each dataset
  2. Group by structure
  3. Compute mean and stddev for each group (for parameters like intensity and RT)
  4. Write into a final table

@smesnage should be able to supply another reference file against which to check this process!

Finally, on the web side, you'll need to add that option to the "Advanced" options for toggling this feature.

  1. Add the button to this column of the advanced options: https://github.com/Mesnage-Org/pgfinder/blob/a334000b23fa7a676c0bfb93b40218341e5f7dc7/web/src/routes/AdvancedOptions.svelte#L19-L54
  2. Add an exported property representing that boolean button state here, and bind it in the <input> object https://github.com/Mesnage-Org/pgfinder/blob/a334000b23fa7a676c0bfb93b40218341e5f7dc7/web/src/routes/AdvancedOptions.svelte#L5-L10
  3. Add a bool to the Pyio type — used to shuttle data from the webUI to PGFinder: https://github.com/Mesnage-Org/pgfinder/blob/a334000b23fa7a676c0bfb93b40218341e5f7dc7/web/src/app.d.ts#L3-L10
  4. Bind the boolean property here, connecting the pyio field to the button state in the <AdvancedOptions>: https://github.com/Mesnage-Org/pgfinder/blob/a334000b23fa7a676c0bfb93b40218341e5f7dc7/web/src/routes/%2Bpage.svelte#L117-L124

That should be more than enough to get started with, and I'm happy to guide whoever through the implementation!

TheLostLambda commented 1 month ago

@Ankur-AVP-Patel is being set off on this adventure now, but is waiting on @smesnage for some examples / test cases!

smesnage commented 1 month ago

There it is. Attached is an example of what we are dreaming of. All relevant info (ftrs, database and model output) is in the shared drive: "G:\Shared drives\PG Mass Spec Analysis\PGFinder wishlist\Automation consolidation (for Ankur)" Please @Ankur-AVP-Patel , get in touch if you have any questions!

image Cross sample consolidation example_Ankur.xlsx