masster 0.5.12__py3-none-any.whl → 0.5.14__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of masster might be problematic. Click here for more details.
- masster/_version.py +1 -1
- masster/lib/lib.py +371 -57
- masster/study/helpers.py +1 -0
- masster/study/id.py +237 -39
- masster/study/importers.py +331 -0
- masster/study/merge.py +3 -1
- masster/study/plot.py +93 -29
- masster/study/study.py +4 -0
- masster/study/study5_schema.json +12 -0
- masster/wizard/__init__.py +4 -4
- masster/wizard/wizard.py +437 -19
- {masster-0.5.12.dist-info → masster-0.5.14.dist-info}/METADATA +1 -1
- {masster-0.5.12.dist-info → masster-0.5.14.dist-info}/RECORD +16 -15
- {masster-0.5.12.dist-info → masster-0.5.14.dist-info}/WHEEL +0 -0
- {masster-0.5.12.dist-info → masster-0.5.14.dist-info}/entry_points.txt +0 -0
- {masster-0.5.12.dist-info → masster-0.5.14.dist-info}/licenses/LICENSE +0 -0
masster/wizard/wizard.py
CHANGED
|
@@ -228,9 +228,10 @@ class Wizard:
|
|
|
228
228
|
that process raw MS data through the complete pipeline: file discovery, feature
|
|
229
229
|
detection, sample processing, study assembly, alignment, merging, and export.
|
|
230
230
|
|
|
231
|
-
This simplified version focuses on
|
|
232
|
-
-
|
|
233
|
-
-
|
|
231
|
+
This simplified version focuses on three core functions:
|
|
232
|
+
- create_analysis(): Generate standalone analysis scripts
|
|
233
|
+
- create_notebook(): Generate marimo interactive notebooks
|
|
234
|
+
- analyze(): Create and run analysis scripts with interactive notebook
|
|
234
235
|
"""
|
|
235
236
|
|
|
236
237
|
def __init__(
|
|
@@ -349,7 +350,7 @@ class Wizard:
|
|
|
349
350
|
"""Get the adduct specifications."""
|
|
350
351
|
return self.params.adducts
|
|
351
352
|
|
|
352
|
-
def
|
|
353
|
+
def create_analysis(self, filename: str = "run_masster.py") -> bool:
|
|
353
354
|
"""
|
|
354
355
|
Generate a standalone Python script for the analysis pipeline.
|
|
355
356
|
|
|
@@ -373,7 +374,31 @@ class Wizard:
|
|
|
373
374
|
print(f"Failed to create script: {e}")
|
|
374
375
|
return False
|
|
375
376
|
|
|
376
|
-
def
|
|
377
|
+
def create_notebook(self, filename: str = "interactive.py") -> bool:
|
|
378
|
+
"""
|
|
379
|
+
Generate a marimo notebook for interactive analysis of the study.
|
|
380
|
+
|
|
381
|
+
Parameters:
|
|
382
|
+
filename: Name for the generated notebook file
|
|
383
|
+
|
|
384
|
+
Returns:
|
|
385
|
+
True if notebook was generated successfully, False otherwise
|
|
386
|
+
"""
|
|
387
|
+
try:
|
|
388
|
+
notebook_path = self.folder_path / filename
|
|
389
|
+
notebook_content = self._generate_notebook_content()
|
|
390
|
+
|
|
391
|
+
with open(notebook_path, 'w', encoding='utf-8') as f:
|
|
392
|
+
f.write(notebook_content)
|
|
393
|
+
|
|
394
|
+
print(f"Interactive notebook created: {notebook_path}")
|
|
395
|
+
return True
|
|
396
|
+
|
|
397
|
+
except Exception as e:
|
|
398
|
+
print(f"Failed to create notebook: {e}")
|
|
399
|
+
return False
|
|
400
|
+
|
|
401
|
+
def analyze(self, filename: str = "run_masster.py") -> bool:
|
|
377
402
|
"""
|
|
378
403
|
Create and execute a standalone analysis script.
|
|
379
404
|
|
|
@@ -383,11 +408,15 @@ class Wizard:
|
|
|
383
408
|
Returns:
|
|
384
409
|
True if execution completed successfully, False otherwise
|
|
385
410
|
"""
|
|
386
|
-
# First create the script
|
|
387
|
-
if not self.
|
|
411
|
+
# First create the analysis script
|
|
412
|
+
if not self.create_analysis(filename):
|
|
388
413
|
return False
|
|
389
414
|
|
|
390
|
-
#
|
|
415
|
+
# Create interactive notebook
|
|
416
|
+
if not self.create_notebook("interactive.py"):
|
|
417
|
+
print("Warning: Failed to create interactive notebook")
|
|
418
|
+
|
|
419
|
+
# Then execute the analysis script
|
|
391
420
|
script_path = self.folder_path / filename
|
|
392
421
|
|
|
393
422
|
try:
|
|
@@ -403,6 +432,10 @@ class Wizard:
|
|
|
403
432
|
if success:
|
|
404
433
|
print("=" * 70)
|
|
405
434
|
print("Script execution completed successfully")
|
|
435
|
+
print("=" * 70)
|
|
436
|
+
print("For interactive analysis, run:")
|
|
437
|
+
print(f" uv run marimo edit {self.folder_path / 'interactive.py'}")
|
|
438
|
+
print("=" * 70)
|
|
406
439
|
else:
|
|
407
440
|
print("=" * 70)
|
|
408
441
|
print(f"Script execution failed with return code: {result.returncode}")
|
|
@@ -718,8 +751,154 @@ class Wizard:
|
|
|
718
751
|
|
|
719
752
|
return '\n'.join(script_lines)
|
|
720
753
|
|
|
754
|
+
def _generate_notebook_content(self) -> str:
|
|
755
|
+
"""Generate the content for a marimo interactive notebook."""
|
|
756
|
+
|
|
757
|
+
notebook_lines = [
|
|
758
|
+
'import marimo',
|
|
759
|
+
'',
|
|
760
|
+
'__generated_with = "0.9.14"',
|
|
761
|
+
'app = marimo.App(width="medium")',
|
|
762
|
+
'',
|
|
763
|
+
'',
|
|
764
|
+
'@app.cell',
|
|
765
|
+
'def __():',
|
|
766
|
+
' import marimo as mo',
|
|
767
|
+
' return (mo,)',
|
|
768
|
+
'',
|
|
769
|
+
'',
|
|
770
|
+
'@app.cell',
|
|
771
|
+
'def __(mo):',
|
|
772
|
+
' mo.md(r"""',
|
|
773
|
+
' # MASSter Interactive Analysis',
|
|
774
|
+
' ',
|
|
775
|
+
' This notebook provides interactive exploration of your mass spectrometry study results.',
|
|
776
|
+
' The study has been processed and is ready for analysis.',
|
|
777
|
+
' """)',
|
|
778
|
+
'',
|
|
779
|
+
'',
|
|
780
|
+
'@app.cell',
|
|
781
|
+
'def __():',
|
|
782
|
+
' # Import masster',
|
|
783
|
+
' import masster',
|
|
784
|
+
' return (masster,)',
|
|
785
|
+
'',
|
|
786
|
+
'',
|
|
787
|
+
'@app.cell',
|
|
788
|
+
'def __(masster):',
|
|
789
|
+
' # Load the processed study',
|
|
790
|
+
f' study = masster.Study(folder=".")',
|
|
791
|
+
' study.load()',
|
|
792
|
+
' return (study,)',
|
|
793
|
+
'',
|
|
794
|
+
'',
|
|
795
|
+
'@app.cell',
|
|
796
|
+
'def __(mo, study):',
|
|
797
|
+
' # Display study information',
|
|
798
|
+
' mo.md(f"""',
|
|
799
|
+
' ## Study Overview',
|
|
800
|
+
' ',
|
|
801
|
+
' **Samples:** {len(study.samples) if hasattr(study, "samples") else "Not loaded"}',
|
|
802
|
+
' ',
|
|
803
|
+
' **Features:** {len(study.consensus_df) if hasattr(study, "consensus_df") else "Not available"}',
|
|
804
|
+
' ',
|
|
805
|
+
' **Polarity:** {study.polarity if hasattr(study, "polarity") else "Unknown"}',
|
|
806
|
+
' """)',
|
|
807
|
+
'',
|
|
808
|
+
'',
|
|
809
|
+
'@app.cell',
|
|
810
|
+
'def __(study):',
|
|
811
|
+
' # Print detailed study info',
|
|
812
|
+
' study.info()',
|
|
813
|
+
'',
|
|
814
|
+
'',
|
|
815
|
+
'@app.cell',
|
|
816
|
+
'def __(mo):',
|
|
817
|
+
' mo.md(r"""',
|
|
818
|
+
' ## Quick Visualizations',
|
|
819
|
+
' ',
|
|
820
|
+
' Use the cells below to create interactive plots of your data.',
|
|
821
|
+
' """)',
|
|
822
|
+
'',
|
|
823
|
+
'',
|
|
824
|
+
'@app.cell',
|
|
825
|
+
'def __(study):',
|
|
826
|
+
' # Generate consensus 2D plot',
|
|
827
|
+
' if hasattr(study, "consensus_df") and len(study.consensus_df) > 0:',
|
|
828
|
+
' study.plot_consensus_2d(filename="consensus_interactive.html")',
|
|
829
|
+
' print("Consensus 2D plot saved as: consensus_interactive.html")',
|
|
830
|
+
' else:',
|
|
831
|
+
' print("No consensus features available for plotting")',
|
|
832
|
+
'',
|
|
833
|
+
'',
|
|
834
|
+
'@app.cell',
|
|
835
|
+
'def __(study):',
|
|
836
|
+
' # Generate PCA plot',
|
|
837
|
+
' if hasattr(study, "samples") and len(study.samples) > 1:',
|
|
838
|
+
' study.plot_samples_pca(filename="pca_interactive.html")',
|
|
839
|
+
' print("PCA plot saved as: pca_interactive.html")',
|
|
840
|
+
' else:',
|
|
841
|
+
' print("Not enough samples for PCA analysis")',
|
|
842
|
+
'',
|
|
843
|
+
'',
|
|
844
|
+
'@app.cell',
|
|
845
|
+
'def __(mo):',
|
|
846
|
+
' mo.md(r"""',
|
|
847
|
+
' ## Data Export',
|
|
848
|
+
' ',
|
|
849
|
+
' Export your processed data in various formats.',
|
|
850
|
+
' """)',
|
|
851
|
+
'',
|
|
852
|
+
'',
|
|
853
|
+
'@app.cell',
|
|
854
|
+
'def __(study):',
|
|
855
|
+
' # Export options',
|
|
856
|
+
' if hasattr(study, "consensus_df"):',
|
|
857
|
+
' # Export to Excel',
|
|
858
|
+
' study.export_xlsx(filename="study_results.xlsx")',
|
|
859
|
+
' print("✓ Results exported to: study_results.xlsx")',
|
|
860
|
+
' ',
|
|
861
|
+
' # Export to MGF',
|
|
862
|
+
' study.export_mgf(filename="study_spectra.mgf")',
|
|
863
|
+
' print("✓ Spectra exported to: study_spectra.mgf")',
|
|
864
|
+
' else:',
|
|
865
|
+
' print("No data available for export")',
|
|
866
|
+
'',
|
|
867
|
+
'',
|
|
868
|
+
'@app.cell',
|
|
869
|
+
'def __(mo):',
|
|
870
|
+
' mo.md(r"""',
|
|
871
|
+
' ## Custom Analysis',
|
|
872
|
+
' ',
|
|
873
|
+
' Add your own analysis code in the cells below.',
|
|
874
|
+
' """)',
|
|
875
|
+
'',
|
|
876
|
+
'',
|
|
877
|
+
'@app.cell',
|
|
878
|
+
'def __(study):',
|
|
879
|
+
' # Access consensus features dataframe',
|
|
880
|
+
' if hasattr(study, "consensus_df"):',
|
|
881
|
+
' df = study.consensus_df',
|
|
882
|
+
' print(f"Consensus features shape: {df.shape}")',
|
|
883
|
+
' print("\\nFirst 5 features:")',
|
|
884
|
+
' print(df.head())',
|
|
885
|
+
' return (df,) if "df" in locals() else ()',
|
|
886
|
+
'',
|
|
887
|
+
'',
|
|
888
|
+
'@app.cell',
|
|
889
|
+
'def __():',
|
|
890
|
+
' # Your custom analysis here',
|
|
891
|
+
' pass',
|
|
892
|
+
'',
|
|
893
|
+
'',
|
|
894
|
+
'if __name__ == "__main__":',
|
|
895
|
+
' app.run()',
|
|
896
|
+
]
|
|
897
|
+
|
|
898
|
+
return '\n'.join(notebook_lines)
|
|
899
|
+
|
|
721
900
|
|
|
722
|
-
def
|
|
901
|
+
def create_analysis(
|
|
723
902
|
source: str,
|
|
724
903
|
folder: str,
|
|
725
904
|
filename: str = 'run_masster.py',
|
|
@@ -750,8 +929,8 @@ def create_script(
|
|
|
750
929
|
True if script was generated successfully, False otherwise
|
|
751
930
|
|
|
752
931
|
Example:
|
|
753
|
-
>>> from masster.wizard import
|
|
754
|
-
>>>
|
|
932
|
+
>>> from masster.wizard import create_analysis
|
|
933
|
+
>>> create_analysis(
|
|
755
934
|
... source=r'D:\\Data\\raw_files',
|
|
756
935
|
... folder=r'D:\\Data\\output',
|
|
757
936
|
... filename='run_masster.py',
|
|
@@ -798,7 +977,7 @@ def create_script(
|
|
|
798
977
|
temp_wizard = Wizard(params=wizard_params)
|
|
799
978
|
|
|
800
979
|
# Generate the script using the instance method
|
|
801
|
-
success = temp_wizard.
|
|
980
|
+
success = temp_wizard.create_analysis(filename)
|
|
802
981
|
|
|
803
982
|
return success
|
|
804
983
|
|
|
@@ -809,7 +988,7 @@ def create_script(
|
|
|
809
988
|
return False
|
|
810
989
|
|
|
811
990
|
|
|
812
|
-
def
|
|
991
|
+
def analyze(
|
|
813
992
|
source: str,
|
|
814
993
|
folder: str,
|
|
815
994
|
filename: str = 'run_masster.py',
|
|
@@ -822,7 +1001,7 @@ def execute(
|
|
|
822
1001
|
"""
|
|
823
1002
|
Create and execute a standalone analysis script for automated MS data processing.
|
|
824
1003
|
|
|
825
|
-
This function generates a Python script with the same parameters as
|
|
1004
|
+
This function generates a Python script with the same parameters as create_analysis(),
|
|
826
1005
|
but immediately executes it after creation. Combines script generation and execution
|
|
827
1006
|
in a single step.
|
|
828
1007
|
|
|
@@ -840,8 +1019,8 @@ def execute(
|
|
|
840
1019
|
True if script was created and executed successfully, False otherwise
|
|
841
1020
|
|
|
842
1021
|
Example:
|
|
843
|
-
>>> from masster.wizard import
|
|
844
|
-
>>>
|
|
1022
|
+
>>> from masster.wizard import analyze
|
|
1023
|
+
>>> analyze(
|
|
845
1024
|
... source=r'D:\\Data\\raw_files',
|
|
846
1025
|
... folder=r'D:\\Data\\output',
|
|
847
1026
|
... polarity='positive'
|
|
@@ -849,8 +1028,8 @@ def execute(
|
|
|
849
1028
|
"""
|
|
850
1029
|
|
|
851
1030
|
try:
|
|
852
|
-
# First, create the script using
|
|
853
|
-
script_created =
|
|
1031
|
+
# First, create the script using create_analysis()
|
|
1032
|
+
script_created = create_analysis(
|
|
854
1033
|
source=source,
|
|
855
1034
|
folder=folder,
|
|
856
1035
|
filename=filename,
|
|
@@ -910,5 +1089,244 @@ def execute(
|
|
|
910
1089
|
return False
|
|
911
1090
|
|
|
912
1091
|
|
|
1092
|
+
def create_notebook(
|
|
1093
|
+
source: str,
|
|
1094
|
+
folder: str,
|
|
1095
|
+
filename: str = 'interactive.py',
|
|
1096
|
+
polarity: str = "positive",
|
|
1097
|
+
adducts: Optional[List[str]] = None,
|
|
1098
|
+
params: Optional[wizard_def] = None,
|
|
1099
|
+
num_cores: int = 0,
|
|
1100
|
+
**kwargs
|
|
1101
|
+
) -> bool:
|
|
1102
|
+
"""
|
|
1103
|
+
Create a marimo interactive notebook for analysis without initializing a Wizard instance.
|
|
1104
|
+
|
|
1105
|
+
This function generates a marimo notebook file that provides interactive exploration
|
|
1106
|
+
of mass spectrometry study results with the specified configuration.
|
|
1107
|
+
|
|
1108
|
+
Parameters:
|
|
1109
|
+
source: Directory containing raw data files
|
|
1110
|
+
folder: Output directory for processed study
|
|
1111
|
+
filename: Filename for the generated notebook (should end with .py)
|
|
1112
|
+
polarity: Ion polarity mode ("positive" or "negative")
|
|
1113
|
+
adducts: List of adduct specifications (auto-set if None)
|
|
1114
|
+
params: Custom wizard_def parameters (optional)
|
|
1115
|
+
num_cores: Number of CPU cores (0 = auto-detect)
|
|
1116
|
+
**kwargs: Additional parameters to override defaults
|
|
1117
|
+
|
|
1118
|
+
Returns:
|
|
1119
|
+
True if notebook was generated successfully, False otherwise
|
|
1120
|
+
|
|
1121
|
+
Example:
|
|
1122
|
+
>>> from masster.wizard import create_notebook
|
|
1123
|
+
>>> create_notebook(
|
|
1124
|
+
... source=r'D:\\Data\\raw_files',
|
|
1125
|
+
... folder=r'D:\\Data\\output',
|
|
1126
|
+
... filename='interactive.py',
|
|
1127
|
+
... polarity='positive'
|
|
1128
|
+
... )
|
|
1129
|
+
"""
|
|
1130
|
+
|
|
1131
|
+
try:
|
|
1132
|
+
# Create parameters
|
|
1133
|
+
if params is not None:
|
|
1134
|
+
# Use provided params as base
|
|
1135
|
+
wizard_params = params
|
|
1136
|
+
# Update with provided values
|
|
1137
|
+
wizard_params.source = source
|
|
1138
|
+
wizard_params.folder = folder
|
|
1139
|
+
if polarity != "positive": # Only override if explicitly different
|
|
1140
|
+
wizard_params.polarity = polarity
|
|
1141
|
+
if num_cores > 0:
|
|
1142
|
+
wizard_params.num_cores = num_cores
|
|
1143
|
+
if adducts is not None:
|
|
1144
|
+
wizard_params.adducts = adducts
|
|
1145
|
+
else:
|
|
1146
|
+
# Create new params with provided values
|
|
1147
|
+
wizard_params = wizard_def(
|
|
1148
|
+
source=source,
|
|
1149
|
+
folder=folder,
|
|
1150
|
+
polarity=polarity,
|
|
1151
|
+
num_cores=max(1, int(multiprocessing.cpu_count() * 0.75)) if num_cores <= 0 else num_cores
|
|
1152
|
+
)
|
|
1153
|
+
|
|
1154
|
+
if adducts is not None:
|
|
1155
|
+
wizard_params.adducts = adducts
|
|
1156
|
+
|
|
1157
|
+
# Apply any additional kwargs
|
|
1158
|
+
for key, value in kwargs.items():
|
|
1159
|
+
if hasattr(wizard_params, key):
|
|
1160
|
+
setattr(wizard_params, key, value)
|
|
1161
|
+
|
|
1162
|
+
# Ensure study folder exists
|
|
1163
|
+
study_path = Path(folder)
|
|
1164
|
+
study_path.mkdir(parents=True, exist_ok=True)
|
|
1165
|
+
|
|
1166
|
+
# Generate notebook content
|
|
1167
|
+
notebook_content = _generate_notebook_content(wizard_params)
|
|
1168
|
+
|
|
1169
|
+
# Write notebook file
|
|
1170
|
+
notebook_path = study_path / filename
|
|
1171
|
+
with open(notebook_path, 'w', encoding='utf-8') as f:
|
|
1172
|
+
f.write(notebook_content)
|
|
1173
|
+
|
|
1174
|
+
print(f"Interactive notebook created: {notebook_path}")
|
|
1175
|
+
return True
|
|
1176
|
+
|
|
1177
|
+
except Exception as e:
|
|
1178
|
+
print(f"Failed to create notebook: {e}")
|
|
1179
|
+
import traceback
|
|
1180
|
+
traceback.print_exc()
|
|
1181
|
+
return False
|
|
1182
|
+
|
|
1183
|
+
|
|
1184
|
+
def _generate_notebook_content(params: wizard_def) -> str:
|
|
1185
|
+
"""Generate the content for a marimo interactive notebook."""
|
|
1186
|
+
|
|
1187
|
+
notebook_lines = [
|
|
1188
|
+
'import marimo',
|
|
1189
|
+
'',
|
|
1190
|
+
'__generated_with = "0.9.14"',
|
|
1191
|
+
'app = marimo.App(width="medium")',
|
|
1192
|
+
'',
|
|
1193
|
+
'',
|
|
1194
|
+
'@app.cell',
|
|
1195
|
+
'def __():',
|
|
1196
|
+
' import marimo as mo',
|
|
1197
|
+
' return (mo,)',
|
|
1198
|
+
'',
|
|
1199
|
+
'',
|
|
1200
|
+
'@app.cell',
|
|
1201
|
+
'def __(mo):',
|
|
1202
|
+
' mo.md(r"""',
|
|
1203
|
+
' # MASSter Interactive Analysis',
|
|
1204
|
+
' ',
|
|
1205
|
+
' This notebook provides interactive exploration of your mass spectrometry study results.',
|
|
1206
|
+
' The study has been processed and is ready for analysis.',
|
|
1207
|
+
' """)',
|
|
1208
|
+
'',
|
|
1209
|
+
'',
|
|
1210
|
+
'@app.cell',
|
|
1211
|
+
'def __():',
|
|
1212
|
+
' # Import masster',
|
|
1213
|
+
' import masster',
|
|
1214
|
+
' return (masster,)',
|
|
1215
|
+
'',
|
|
1216
|
+
'',
|
|
1217
|
+
'@app.cell',
|
|
1218
|
+
'def __(masster):',
|
|
1219
|
+
' # Load the processed study',
|
|
1220
|
+
f' study = masster.Study(folder=".")',
|
|
1221
|
+
' study.load()',
|
|
1222
|
+
' return (study,)',
|
|
1223
|
+
'',
|
|
1224
|
+
'',
|
|
1225
|
+
'@app.cell',
|
|
1226
|
+
'def __(mo, study):',
|
|
1227
|
+
' # Display study information',
|
|
1228
|
+
' mo.md(f"""',
|
|
1229
|
+
' ## Study Overview',
|
|
1230
|
+
' ',
|
|
1231
|
+
' **Samples:** {len(study.samples) if hasattr(study, "samples") else "Not loaded"}',
|
|
1232
|
+
' ',
|
|
1233
|
+
' **Features:** {len(study.consensus_df) if hasattr(study, "consensus_df") else "Not available"}',
|
|
1234
|
+
' ',
|
|
1235
|
+
' **Polarity:** {study.polarity if hasattr(study, "polarity") else "Unknown"}',
|
|
1236
|
+
' """)',
|
|
1237
|
+
'',
|
|
1238
|
+
'',
|
|
1239
|
+
'@app.cell',
|
|
1240
|
+
'def __(study):',
|
|
1241
|
+
' # Print detailed study info',
|
|
1242
|
+
' study.info()',
|
|
1243
|
+
'',
|
|
1244
|
+
'',
|
|
1245
|
+
'@app.cell',
|
|
1246
|
+
'def __(mo):',
|
|
1247
|
+
' mo.md(r"""',
|
|
1248
|
+
' ## Quick Visualizations',
|
|
1249
|
+
' ',
|
|
1250
|
+
' Use the cells below to create interactive plots of your data.',
|
|
1251
|
+
' """)',
|
|
1252
|
+
'',
|
|
1253
|
+
'',
|
|
1254
|
+
'@app.cell',
|
|
1255
|
+
'def __(study):',
|
|
1256
|
+
' # Generate consensus 2D plot',
|
|
1257
|
+
' if hasattr(study, "consensus_df") and len(study.consensus_df) > 0:',
|
|
1258
|
+
' study.plot_consensus_2d(filename="consensus_interactive.html")',
|
|
1259
|
+
' print("Consensus 2D plot saved as: consensus_interactive.html")',
|
|
1260
|
+
' else:',
|
|
1261
|
+
' print("No consensus features available for plotting")',
|
|
1262
|
+
'',
|
|
1263
|
+
'',
|
|
1264
|
+
'@app.cell',
|
|
1265
|
+
'def __(study):',
|
|
1266
|
+
' # Generate PCA plot',
|
|
1267
|
+
' if hasattr(study, "samples") and len(study.samples) > 1:',
|
|
1268
|
+
' study.plot_samples_pca(filename="pca_interactive.html")',
|
|
1269
|
+
' print("PCA plot saved as: pca_interactive.html")',
|
|
1270
|
+
' else:',
|
|
1271
|
+
' print("Not enough samples for PCA analysis")',
|
|
1272
|
+
'',
|
|
1273
|
+
'',
|
|
1274
|
+
'@app.cell',
|
|
1275
|
+
'def __(mo):',
|
|
1276
|
+
' mo.md(r"""',
|
|
1277
|
+
' ## Data Export',
|
|
1278
|
+
' ',
|
|
1279
|
+
' Export your processed data in various formats.',
|
|
1280
|
+
' """)',
|
|
1281
|
+
'',
|
|
1282
|
+
'',
|
|
1283
|
+
'@app.cell',
|
|
1284
|
+
'def __(study):',
|
|
1285
|
+
' # Export options',
|
|
1286
|
+
' if hasattr(study, "consensus_df"):',
|
|
1287
|
+
' # Export to Excel',
|
|
1288
|
+
' study.export_xlsx(filename="study_results.xlsx")',
|
|
1289
|
+
' print("✓ Results exported to: study_results.xlsx")',
|
|
1290
|
+
' ',
|
|
1291
|
+
' # Export to MGF',
|
|
1292
|
+
' study.export_mgf(filename="study_spectra.mgf")',
|
|
1293
|
+
' print("✓ Spectra exported to: study_spectra.mgf")',
|
|
1294
|
+
' else:',
|
|
1295
|
+
' print("No data available for export")',
|
|
1296
|
+
'',
|
|
1297
|
+
'',
|
|
1298
|
+
'@app.cell',
|
|
1299
|
+
'def __(mo):',
|
|
1300
|
+
' mo.md(r"""',
|
|
1301
|
+
' ## Custom Analysis',
|
|
1302
|
+
' ',
|
|
1303
|
+
' Add your own analysis code in the cells below.',
|
|
1304
|
+
' """)',
|
|
1305
|
+
'',
|
|
1306
|
+
'',
|
|
1307
|
+
'@app.cell',
|
|
1308
|
+
'def __(study):',
|
|
1309
|
+
' # Access consensus features dataframe',
|
|
1310
|
+
' if hasattr(study, "consensus_df"):',
|
|
1311
|
+
' df = study.consensus_df',
|
|
1312
|
+
' print(f"Consensus features shape: {df.shape}")',
|
|
1313
|
+
' print("\\nFirst 5 features:")',
|
|
1314
|
+
' print(df.head())',
|
|
1315
|
+
' return (df,) if "df" in locals() else ()',
|
|
1316
|
+
'',
|
|
1317
|
+
'',
|
|
1318
|
+
'@app.cell',
|
|
1319
|
+
'def __():',
|
|
1320
|
+
' # Your custom analysis here',
|
|
1321
|
+
' pass',
|
|
1322
|
+
'',
|
|
1323
|
+
'',
|
|
1324
|
+
'if __name__ == "__main__":',
|
|
1325
|
+
' app.run()',
|
|
1326
|
+
]
|
|
1327
|
+
|
|
1328
|
+
return '\n'.join(notebook_lines)
|
|
1329
|
+
|
|
1330
|
+
|
|
913
1331
|
# Export the main classes and functions
|
|
914
|
-
__all__ = ["Wizard", "wizard_def", "
|
|
1332
|
+
__all__ = ["Wizard", "wizard_def", "create_analysis", "create_notebook", "analyze"]
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
masster/__init__.py,sha256=ueZ224WPNRRjQEYTaQUol818nwQgJwB93HbEfmtPRmg,1041
|
|
2
|
-
masster/_version.py,sha256=
|
|
2
|
+
masster/_version.py,sha256=HWZ2aK3uDRjW8aYpiY6nMhjbQlGgpYob-iIn8U0ejaU,257
|
|
3
3
|
masster/chromatogram.py,sha256=iYpdv8C17zVnlWvOFgAn9ns2uFGiF-GgoYf5QVVAbHs,19319
|
|
4
4
|
masster/logger.py,sha256=XT2gUcUIct8LWzTp9n484g5MaB89toT76CGA41oBvfA,18375
|
|
5
5
|
masster/spectrum.py,sha256=TWIgDcl0lveG40cLVZTWGp8-FxMolu-P8EjZyRBtXL4,49850
|
|
@@ -17,7 +17,7 @@ masster/data/wiff/2025_01_14_VW_7600_LpMx_DBS_CID_2min_TOP15_030msecMS1_005msecR
|
|
|
17
17
|
masster/data/wiff/2025_01_14_VW_7600_LpMx_DBS_CID_2min_TOP15_030msecMS1_005msecReac_CE35_DBS-ON_3.wiff.scan,sha256=ahi1Y3UhAj9Bj4Q2MlbgPekNdkJvMOoMXVOoR6CeIxc,13881220
|
|
18
18
|
masster/data/wiff/2025_01_14_VW_7600_LpMx_DBS_CID_2min_TOP15_030msecMS1_005msecReac_CE35_DBS-ON_3.wiff2,sha256=TFB0HW4Agkig6yht7FtgjUdbXax8jjKaHpSZSvuU5vs,3252224
|
|
19
19
|
masster/lib/__init__.py,sha256=TcePNx3SYZHz6763TL9Sg4gUNXaRWjlrOtyS6vsu-hg,178
|
|
20
|
-
masster/lib/lib.py,sha256=
|
|
20
|
+
masster/lib/lib.py,sha256=cDV4bL2Ax0WWZReiTYze0W6XVMTJRC9DMlVYd6piRIs,38934
|
|
21
21
|
masster/sample/__init__.py,sha256=HL0m1ept0PMAYUCQtDDnkdOS12IFl6oLAq4TZQz83uY,170
|
|
22
22
|
masster/sample/adducts.py,sha256=aBDoBKRjh6rMIF65yH6vx7KpQxeMUv796q3H46TySwY,32603
|
|
23
23
|
masster/sample/h5.py,sha256=X5VBHBpgJ2FJc9mtCggJ1HSQ3ujRmb1Wnpr9sJ8bGVA,115445
|
|
@@ -42,16 +42,17 @@ masster/study/__init__.py,sha256=55axdFuqRX4aXtJ8ocnhcLB32fNtmmJpCi58moO0r4g,237
|
|
|
42
42
|
masster/study/analysis.py,sha256=L-wXBnGZCLB5UUDrjIdOiMG9zdej3Tw_SftcEmmTukM,84264
|
|
43
43
|
masster/study/export.py,sha256=c1HJdLAM6Ply0n8f0DjMk4mXd9lOYePr60UJTBksUho,60092
|
|
44
44
|
masster/study/h5.py,sha256=bznE9kKEfLNo0QtbyC6a6snfnR3Zjkx5BcjBNbRVlJ8,99579
|
|
45
|
-
masster/study/helpers.py,sha256=
|
|
46
|
-
masster/study/id.py,sha256=
|
|
45
|
+
masster/study/helpers.py,sha256=FdvQV-CgQyBhXMqk6_92aKSBsZhJBK4joLxEdKzmuhw,192011
|
|
46
|
+
masster/study/id.py,sha256=YJP9i1BdmphZJ4dze5KjFsUlVi1cmMuyJw6Me3KLOjA,90598
|
|
47
|
+
masster/study/importers.py,sha256=1Oco0yMid_siMMZdK7rQlhS20XikgjBBNAirbTHx5O8,13958
|
|
47
48
|
masster/study/load.py,sha256=BMjoUDkXNI6iU2tRE2eBRzxMrvW0gRyLepqYOWaMPXU,101192
|
|
48
|
-
masster/study/merge.py,sha256=
|
|
49
|
+
masster/study/merge.py,sha256=SwrsbcoI6hIuepvTJEFNoXncwMx1XXr6FVOvkSyfIbs,169239
|
|
49
50
|
masster/study/parameters.py,sha256=bTvmcwX9INxzcrEAmTiFH8qeWVhwkvMTZjuP394pz5o,3279
|
|
50
|
-
masster/study/plot.py,sha256=
|
|
51
|
+
masster/study/plot.py,sha256=z2uNU_pZnKCVhymBiDt8OBzgkLNoKzVGQpc0yToYNYM,113956
|
|
51
52
|
masster/study/processing.py,sha256=5b8K4tP-Xu1-mhdf0om-m-g65Z9Uz3Dp4UBhuMLh0yU,58627
|
|
52
53
|
masster/study/save.py,sha256=47AP518epJJ9TjaGGyrLKsMsyjIk8_J4ka7bmsnRtFQ,9268
|
|
53
|
-
masster/study/study.py,sha256=
|
|
54
|
-
masster/study/study5_schema.json,sha256=
|
|
54
|
+
masster/study/study.py,sha256=pu6JQKvrT2AVKhAixlt3vfaKzJqbJfBY3xPt6-MWdyU,38833
|
|
55
|
+
masster/study/study5_schema.json,sha256=uLA9TIb5loki87_BEdwSNyPYahwOanacYisXdIK0_Z0,8044
|
|
55
56
|
masster/study/defaults/__init__.py,sha256=m3Z5KXGqsTdh7GjYzZoENERt39yRg0ceVRV1DeCt1P0,610
|
|
56
57
|
masster/study/defaults/align_def.py,sha256=Du0F592ej2einT8kOx8EUs610axSvur8_-6N19O-uJY,10209
|
|
57
58
|
masster/study/defaults/export_def.py,sha256=eXl3h4aoLX88XkHTpqahLd-QZ2gjUqrmjq8IJULXeWo,1203
|
|
@@ -64,11 +65,11 @@ masster/study/defaults/integrate_def.py,sha256=Vf4SAzdBfnsSZ3IRaF0qZvWu3gMDPHdgP
|
|
|
64
65
|
masster/study/defaults/merge_def.py,sha256=krR099IkENLlJVxpSjdje3E6h-_qtlc3Ep6Hpy6inrU,12978
|
|
65
66
|
masster/study/defaults/study_def.py,sha256=h8dYbi9xv0sesCSQik49Z53IkskMmNtW6ixl7it5pL0,16033
|
|
66
67
|
masster/wizard/README.md,sha256=mL1A3YWJZOefpJ6D0-HqGLkVRmUlOpwyVFdvJBeeoZM,14149
|
|
67
|
-
masster/wizard/__init__.py,sha256=
|
|
68
|
+
masster/wizard/__init__.py,sha256=_AAemrVTj3u0PSqW8-TG8PLEmV2oOY-0ltrvh_a3wrU,727
|
|
68
69
|
masster/wizard/example.py,sha256=xEZFTH9UZ8HKOm6s3JL8Js0Uw5ChnISWBHSZCL32vsM,7983
|
|
69
|
-
masster/wizard/wizard.py,sha256=
|
|
70
|
-
masster-0.5.
|
|
71
|
-
masster-0.5.
|
|
72
|
-
masster-0.5.
|
|
73
|
-
masster-0.5.
|
|
74
|
-
masster-0.5.
|
|
70
|
+
masster/wizard/wizard.py,sha256=rw7bjYvtpb2s2kdJ6keani95PByz1pXKe9_7cNYyU4c,53141
|
|
71
|
+
masster-0.5.14.dist-info/METADATA,sha256=r7_dIpYH1P9j8nEbJVV77D0z1_Ui_U335kJFw3btAkY,45191
|
|
72
|
+
masster-0.5.14.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
73
|
+
masster-0.5.14.dist-info/entry_points.txt,sha256=ZHguQ_vPmdbpqq2uGtmEOLJfgP-DQ1T0c07Lxh30wc8,58
|
|
74
|
+
masster-0.5.14.dist-info/licenses/LICENSE,sha256=bx5iLIKjgAdYQ7sISn7DsfHRKkoCUm1154sJJKhgqnU,35184
|
|
75
|
+
masster-0.5.14.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|