Skip to content

Commit

Permalink
Fixes implemented after first presentation run through
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-l-kong committed Dec 17, 2024
1 parent 41ef086 commit d6f36b6
Showing 1 changed file with 15 additions and 44 deletions.
59 changes: 15 additions & 44 deletions templates/maldi-pipeline.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -148,23 +148,12 @@
"plt.rcParams[\"figure.constrained_layout.use\"] = False"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 1.3. Intensity percentile\n",
"\n",
"Define the percentile to use for thresholding intensity values."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"intensity_percentile = 99"
]
"source": []
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -196,26 +185,13 @@
" imz_data=imz_data, intensity_percentile=intensity_percentile\n",
")\n",
"\n",
"# display the format and the top few peaks extracted\n",
"display(total_mass_df.head())"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"* `global_intensity_threshold`: the intensity threshold defined by `intensity_percentile`, computed across all intensities extracted. This is used by the plotting functions."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# define the global intensity threshold\n",
"intensity_percentile = 99\n",
"global_intensity_threshold = np.percentile(total_mass_df[\"intensity\"].values, intensity_percentile)\n",
"print(f\"Global Intensity Threshold: {global_intensity_threshold}\")"
"print(f\"Global Intensity Threshold: {global_intensity_threshold}\")\n",
"\n",
"# display the format and the top few peaks extracted\n",
"display(total_mass_df.head())"
]
},
{
Expand Down Expand Up @@ -269,9 +245,7 @@
"\n",
"Although various peaks can be identified across a run's spectra, the vast majority of them will be too small to indicate any meaningful signal. To address this, a prominence-based peak filtering method is used (see https://www.mathworks.com/help/signal/ug/prominence.html for a good definition of prominence).\n",
"\n",
"The first step is to use a rolling window-based approach to extract the prominence thresholds to use for peak filtering.\n",
"\n",
"* `window_size`: this parameter can be increased or decreased for more or less aggressive peak filtering respectively"
"The first step is to use a rolling window-based approach to extract the prominence thresholds to use for peak filtering."
]
},
{
Expand Down Expand Up @@ -427,9 +401,7 @@
"source": [
"## 4. Coordinate Integration\n",
"\n",
"Once peaks have been identified, we need a way of mapping this information back to the slide. Across a coordinate's m/z spectrum, if it is also an identified peak from step 3, we store the corresponding intensity at that coordinate.\n",
"\n",
"**NOTE: recording the raw intensity is not a traditional coordinate integration technique, which normally uses AOC. The AOC technique is currently in development.**"
"Once peaks have been identified, we need a way of mapping this information back to the slide. Across a coordinate's m/z spectrum, if it is also an identified peak from step 3, we store the corresponding intensity at that coordinate."
]
},
{
Expand Down Expand Up @@ -471,7 +443,10 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Save the integrated intensity images per peak to the `\"extracted\"` folder. For every peak, a float32 and int32 image will be saved to the `float` and `int` subdirectories respectively."
"Save the integrated intensity images per peak to the `extracted` folder. For every peak, a float32 and int32 image will be saved to the `float` and `int` subdirectories respectively.\n",
"\n",
"* The `float` images should be used for quantitative downstresam analysis\n",
"* The `int` images are saved for visualization, as they're more compatible with most image viewers"
]
},
{
Expand All @@ -491,9 +466,7 @@
"source": [
"## 5. Glycan Library Matching\n",
"\n",
"While the filtered peaks provide meaningful information, they're not particularly useful without knowing what glycan encompasses them. The master glycan library list (`library_peak_df`) defines the glycans of interest as well as the m/z value they're centered at. In this way, peak values can be mapped to their corresponding glycan within a tolerance range.\n",
"\n",
"* `ppm`: the tolerance range. Smaller values will lead to stricter matching and vice versa for larger values."
"While the filtered peaks provide meaningful information, they're not particularly useful without knowing what glycan encompasses them. The master glycan library list (`library_peak_df`) defines the glycans of interest as well as the m/z value they're centered at. In this way, peak values can be mapped to their corresponding glycan within a tolerance range."
]
},
{
Expand All @@ -504,10 +477,8 @@
},
"outputs": [],
"source": [
"ppm = 100\n",
"\n",
"matched_peaks_df = extraction.library_matching(\n",
" image_xr=image_data, library_peak_df=library_peak_df, ppm=ppm, extraction_dir=extraction_dir\n",
" image_xr=image_data, library_peak_df=library_peak_df, ppm=100, extraction_dir=extraction_dir\n",
")"
]
},
Expand Down Expand Up @@ -678,7 +649,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
"version": "3.11.10"
},
"vscode": {
"interpreter": {
Expand Down

0 comments on commit d6f36b6

Please sign in to comment.