> For the complete documentation index, see [llms.txt](https://disc4all-qupath.gitbook.io/qupath-project/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://disc4all-qupath.gitbook.io/qupath-project/result-analysis-docs/processing-package-tutorial/in-depth-python-usage.md).

# In-Depth Python usage

This section of the Docs is to describe each function  and its utility in the ProcessMRXS Class.

## Functions specifics

> Call the process\_data method to process MRXS data, merge it with inventory, and calculate immunopositivity statistics for every slide (this function is called internally for each file in the process\_directory method):
>
> ```
> result_df = processor.process_data()
> ```

***

> To process immunopositivity rate from Excel/CSV files and merge into a unique main DataFrame, call the process\_positivity method:
>
> ```python
> xlsx_file = "path/to/your/immunopositivity_data.xlsx"
> final_df = ProcessMRXSData.process_positivity(xlsx_file, result_df)
> ```

***

> Process MRXS data from a directory, save antibody-specific data, and return the final DataFrame using the process\_directory method (internally calling the process\_data):
>
> {% code overflow="wrap" %}
>
> ```python
> directory_path = "path/to/your/mrxs/files/directory"
> output_path = "path/to/output/data/directory"
> output_filename = "output_data.csv"  # Name of the output CSV file
> final_data = ProcessMRXSData.process_directory(directory_path, inventory_file, output_path, output_filename)
> ```
>
> {% endcode %}

***

> Process immunopositivity rate from saved files and merge it into a final DataFrame using the process\_rate method:
>
> ```
> final_rate = ProcessMRXSData.process_rate(output_path, final_data)
> ```

***

> To generate and save correlation heatmaps based on immunopositivity rate data, call the process\_heatmaps method:
>
> ```
> data_file = "path/to/your/immunopositivity_data.csv"
> ProcessMRXSData.process_heatmaps(data_file)
> ```

***

> To generate and save scatterplots based on immunopositivity rate data, use the process\_scatterplots method:
>
> ```
> data_file = "path/to/your/immunopositivity_data.csv"
> ProcessMRXSData.process_scatterplots(data_file)
> ```

***

#### For more details, examples, and command-line usage, please refer to the code and documentation in this [repository](https://github.com/mapoferri/process_mrxs).

### License

This project is licensed under the MIT License - see the LICENSE file for details to the rightful owner.
