Skip to content

Commit

Permalink
added hackathon content
Browse files Browse the repository at this point in the history
  • Loading branch information
haeussma committed Sep 22, 2024
1 parent 98f55bb commit 64813b4
Show file tree
Hide file tree
Showing 3 changed files with 173 additions and 1 deletion.
88 changes: 88 additions & 0 deletions docs/workshop_2024/chromatography.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Process Chromatographic Data

In this hackathon session, you will process your own chromatographic data using the `chromatopy` Python package. Alternatively, if you do not have your own data, or something fails, you can use the provided example data.

## πŸ“š Topics

1. You will get familiar with using Jupyter Notebooks and how you can run Python code locally on your computer.
2. You will learn how to process and enrich your chromatographic data using the `chromatopy` Python package.
3. You will yield a structured EnzymeML Document that can be used for further data analysis.

## πŸ› οΈ Setup

### Start Jupyter Notebook
Start with opening Anaconda and launching a Jupyter Notebook. If this is the first time you ever used a Jupyter Notebook, you can find a short introduction [:simple-youtube: here](https://youtu.be/IMrxB8Mq5KU?si=UdcbsNZYd2S-Geg6&t=64). Otherwise, you can skip this step.

### Setup a project folder and notebook
Navigate to your desired location and create a new folder for your project. This folder will contain all the files you will create during this session.
Afterwards, create a new Jupyter Notebook in this folder. You can create new folders and the notebook directly from the Jupyter Notebook interface. Therefore, you can use the `New`:octicons-triangle-down-16: button in the top right corner and select `Folder` or `Notebook Python3 (ipykernel)`.

### Add the data to your project folder

__If you brought your own chromatographic data...__
If you brought your own chromatographic file, add it to the project folder. Please make sure that your data is organized and processed in a way that it can be read by the `chromatopy` package. You can find the supported formats and data preparation in the [documentation of `chromatopy`](https://fairchemistry.github.io/chromatopy/supported_formats/).

__If you do not have your own data...__
If you do not have your own data, you can [download](https://github.com/FAIRChemistry/chromatopy/raw/refs/heads/main/docs/examples/data/asm.zip) the example data set and add it to your project folder.

### Install the `chromatopy` package
Copy the following code snippet into the first cell of your Jupyter Notebook and run it. This code snippet will install the `chromatopy` package if it is not already installed. This is a one-time setup and will not be required for future sessions.

```python
import sys
import subprocess
import shutil

# install git via conda if not installed
if not shutil.which("git"):
print("Installing git via conda")
subprocess.run(["conda", "install", "-y", "git"])
if not shutil.which("git"):
print("git is not installed")
sys.exit(1)
print("git is installed")

# install chromatopy
try:
from chromatopy import ChromAnalyzer
except ImportError:
print("Installing chromatopy...")
!pip install git+https://github.com/FAIRChemistry/chromatopy.git
print("🏁 All set! Restart the Notebook once and you are ready to go.")
```

After you have run this code snippet, restart the Jupyter Notebook. You can do this by clicking on `Kernel` > `Restart Kernel...` in the top menu, or by clicking on the :material-reload: button in the top.

Verify that the installation was successful by running the following code snippet in a new cell:

```python
from chromatopy import ChromAnalyzer
```

If you do not get an error message, the installation was successful and the `ChromAnalyzer` is ready to use. Otherwise, please let us know.

## πŸš€ Start using the `ChromAnalyzer`

The workflow for processing chromatographic data with the `ChromAnalyzer` is as follows:

If you use the example data, familiarize yourself with the [experimental scenario](https://fairchemistry.github.io/chromatopy/examples/peak_assignment/#kinetic-measurements)
If you have calibration measurements for quantification, you should process these first.

1. Follow the instructions on how to find and integrate peaks with OpenChrom as outlined [here](https://fairchemistry.github.io/chromatopy/supported_formats/#spectrum-processing-with-openchrom-from-lablicate). If you already processed your data with OpenChrom, you can skip this step.

2. Read the chromatographic data files of one time-course series to create a `ChromAnalyzer` object. This can as outlined
[in the documentation](https://fairchemistry.github.io/chromatopy/examples/read_data/).

3. Visualize the chromatograms and the peak areas to check the quality of the data. This can be done as outlined
[in the documentation](https://fairchemistry.github.io/chromatopy/examples/visualize/). Are all peaks found? Are the peaks integrated correctly?

4. Assign the peaks to the respective compounds. This can be done as outlined [in the documentation](https://fairchemistry.github.io/chromatopy/examples/peak_assignment/#define-molecules).

5. If you plan to quantify the compounds, you find the instructions [here](https://fairchemistry.github.io/chromatopy/examples/peak_assignment/#calibration-measurements).

6. Lastly, you can export the data to an EnzymeML document. This can be done as outlined [in the documentation](https://fairchemistry.github.io/chromatopy/examples/peak_assignment/#convert-data).

## 🐞 If something doesn't work
Please let us know and we will help you.

Alternatively, [use ChatGPT](https://chatgpt.com/) to ask for help. Therefore, copy and past the error message of the code cell into the chat and ask for help. The chatbot can mostly provide you with helpful. Furthermore, you can ask follow-up questions to get a better understanding of the problem.
12 changes: 11 additions & 1 deletion docs/workshop_2024/hackathon.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,14 @@ graph LR
SUITE <--->|read / write| EnzymeMLDocument
EMLD <-->|read / write| EnzymeMLDocument
```
```


## 🏁 Let's start!

<div class="grid cards" markdown>

- πŸ”¬ __[Process Plate Reader Data](plate_reader.md)__
- 🌈 __[Process Chromatographic Data](chromatography.md)__

</div>
74 changes: 74 additions & 0 deletions docs/workshop_2024/plate_reader.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Process Plate Reader Data

In this hackathon session, you will process your own plate reader data using the `mtphandler` Python package. Alternatively, if you do not have your own data, or something fails, you can use the provided example data.

## πŸ“š Topics

1. You will get familiar with using Jupyter Notebooks and how you can run Python code locally on your computer.
2. You will learn how to process and enrich you plate reader data using the `mtphandler` Python package.
3. You will yield a structured EnzymeML Document that can be used for further data analysis.

## πŸ› οΈ Setup

### Start Jupyter Notebook
Start with opening Anaconda and launching a Jupyter Notebook. If this is the first time you ever used a Jupyter Notebook, you can find a short introduction [:simple-youtube: here](https://youtu.be/IMrxB8Mq5KU?si=UdcbsNZYd2S-Geg6&t=64). Otherwise, you can skip this step.

### Setup a project folder and notebook
Navigate to your desired location and create a new folder for your project. This folder will contain all the files you will create during this session.
Afterwards, create a new Jupyter Notebook in this folder. You can create new folders and the notebook directly from the Jupyter Notebook interface. Therefore, you can use the `New`:octicons-triangle-down-16: button in the top right corner and select `Folder` or `Notebook Python3 (ipykernel)`.

### Add the data to your project folder
If you brought your own plate reader file, add it to the project folder. If you do not have your own data, you can <a href="https://github.com/FAIRChemistry/MTPHandler/raw/refs/heads/main/docs/examples/data/spectra_max_190.txt" download>download</a>
the provided example data and the respective pre-filled out [plate map](https://github.com/FAIRChemistry/MTPHandler/raw/refs/heads/main/docs/examples/data/plate_map_SAHH_kinetics.xlsx).

### Install the `mtphandler` package
Copy the following code snippet into the first cell of your Jupyter Notebook and run it. This code snippet will install the `mtphandler` package if it is not already installed. This is a one-time setup and will not be required for future sessions.

```python
import sys
import subprocess
import shutil

# install git via conda if not installed
if not shutil.which("git"):
print("Installing git via conda")
subprocess.run(["conda", "install", "-y", "git"])
if not shutil.which("git"):
print("git is not installed")
sys.exit(1)
print("git is installed")

# install mtphandler
try:
from mtphandler import PlateManager

except ImportError:
print("Installing mtphandler...")
!pip install git+https://github.com/FAIRChemistry/MTPHandler.git --quiet

print("🏁 All set! Restart the Notebook once and you are ready to go.")
```

After you have run this code snippet, restart the Jupyter Notebook. You can do this by clicking on `Kernel` > `Restart Kernel...` in the top menu, or by clicking on the :material-reload: button in the top.

Verify that the installation was successful by running the following code snippet in a new cell:

```python
from mtphandler import PlateManager
```

If you do not get an error message, the installation was successful and the `PlateManager` is ready to use. Otherwise, please let us know.

## πŸš€ Start using the `PlateManager`
Information on how to use the `PlateManager` can be found in the usage section of the [MTPHandler documentation](https://fairchemistry.github.io/MTPHandler/usage/).

__If you brougt your own data...__
you can adjust the code snippets in the documentation to your needs and process your own data.

__If you do not have your own data...__
the provided data set is identical to the one used in the documentation. You can follow the steps in the documentation to process the provided data set.

## 🐞 If something doesn't work
Please let us know and we will help you.

Alternatively, [use ChatGPT](https://chatgpt.com/) to ask for help. Therefore, copy and past the error message of the code cell into the chat and ask for help. The chatbot can mostly provide you with helpful. Furthermore, you can ask follow-up questions to get a better understanding of the problem.

0 comments on commit 64813b4

Please sign in to comment.