Skip to content

Commit c279fb2

Browse files
authored
Merge pull request #696 from bigbio/dev
Add QPX support and enhance PMultiQC documentation
2 parents 7b11825 + 53adb56 commit c279fb2

39 files changed

Lines changed: 4746 additions & 89 deletions

.github/workflows/python-app.yml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,4 +351,27 @@ jobs:
351351
name: Upload results
352352
with:
353353
name: results_single_cell_diann
354-
path: ./results_single_cell_diann
354+
path: ./results_single_cell_diann
355+
356+
test_qpx:
357+
needs: setup
358+
runs-on: ubuntu-latest
359+
steps:
360+
- uses: actions/checkout@v4
361+
- name: Set up Python 3.10
362+
uses: actions/setup-python@v4
363+
with:
364+
python-version: "3.10"
365+
- name: Install package
366+
run: pip install .
367+
- name: Test qpx dataset
368+
run: |
369+
wget -nv https://ftp.pride.ebi.ac.uk/pub/databases/pride/resources/proteomes/pmultiqc/example-projects/qpx_example.zip
370+
unzip -d ./qpx_example qpx_example.zip
371+
multiqc --qpx-plugin ./qpx_example --config ./qpx_example/results/multiqc_config.yml -o ./results_qpx
372+
- uses: actions/upload-artifact@v4
373+
if: always()
374+
name: Upload results
375+
with:
376+
name: results_qpx
377+
path: ./results_qpx

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ pmultiqc supports the following data sources:
7171
7. **[nf-core/mhcquant](https://nf-co.re/mhcquant)** result files:
7272
- `mhcquant/results-*`: folder containing mhcquant results
7373

74+
8. **[QPX](https://github.com/bigbio/qpx)** files:
75+
- `*.psm.parquet`: QPX PSMs
76+
- `*.pg.parquet`: QPX PG
77+
- `*.feature.parquet`: QPX feature
78+
- `*sdrf.tsv`: SDRF-Proteomics (optional)
79+
7480
## Installation
7581

7682
### Install from PyPI
@@ -163,6 +169,12 @@ multiqc --fragpipe-plugin /path/to/fragpipe/files -o ./report
163169
multiqc --mhcquant-plugin /path/to/mhcquant/files -o ./report
164170
```
165171

172+
#### For qpx files
173+
174+
```bash
175+
multiqc --qpx-plugin /path/to/qpx/files -o ./report
176+
```
177+
166178
### Command-line Options
167179

168180
| Option | Description | Default |
@@ -184,6 +196,7 @@ multiqc --mhcquant-plugin /path/to/mhcquant/files -o ./report
184196
| `--mzid-plugin` | Generate reports based on mzIdentML files | `False` |
185197
| `--fragpipe-plugin` | Generate reports based on FragPipe files | `False` |
186198
| `--mhcquant-plugin` | Generate reports based on mhcquant files | `False` |
199+
| `--qpx-plugin` | Generate reports based on qpx files | `False` |
187200
| `--disable-hoverinfo` | Disable interactive hover tooltips in the plots | `False` |
188201

189202
## QC Metrics and Visualizations

docs/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@ pmultiqc supports the following data sources:
9191
### 7. [nf-core/mhcquant](https://nf-co.re/mhcquant) result files:
9292
- `mhcquant/results-*`: folder containing mhcquant results
9393

94+
8. **[QPX](https://github.com/bigbio/qpx)** files:
95+
- `*.psm.parquet`: QPX PSMs
96+
- `*.pg.parquet`: QPX PG
97+
- `*.feature.parquet`: QPX feature
98+
- `*sdrf.tsv`: SDRF-Proteomics (optional)
99+
94100
## 💾 Installation
95101

96102
### Install from PyPI
@@ -178,6 +184,12 @@ multiqc --fragpipe-plugin /path/to/fragpipe/files -o ./report
178184
multiqc --mhcquant-plugin /path/to/mhcquant/files -o ./report
179185
```
180186

187+
#### For qpx files
188+
189+
```bash
190+
multiqc --qpx-plugin /path/to/qpx/files -o ./report
191+
```
192+
181193
### Command-line Options
182194

183195
| Option | Description | Default |
@@ -199,6 +211,7 @@ multiqc --mhcquant-plugin /path/to/mhcquant/files -o ./report
199211
| `--mzid-plugin` | Generate reports based on mzIdentML files | `False` |
200212
| `--fragpipe-plugin` | Generate reports based on FragPipe files | `False` |
201213
| `--mhcquant-plugin` | Generate reports based on mhcquant files | `False` |
214+
| `--qpx-plugin` | Generate reports based on qpx files | `False` |
202215
| `--disable-hoverinfo` | Disable interactive hover tooltips in the plots | `False` |
203216

204217
## 📊 QC Metrics and Visualizations
@@ -255,6 +268,7 @@ You can find example reports on the [docs page](https://bigbio.github.io/pmultiq
255268
| mzIdentML with MGF | mzIdentML with MGF files | [mzIdentML with MGF Example](https://pmultiqc.quantms.org/PXD054720/multiqc_report.html) ([disable_hoverinfo](https://pmultiqc.quantms.org/PXD054720_disable_hoverinfo/multiqc_report.html)) | [PXD054720 folder](https://ftp.pride.ebi.ac.uk/pride/data/archive/2024/08/PXD054720/) |
256269
| FragPipe | FragPipe results | [FragPipe Example](https://pmultiqc.quantms.org/PXD062399/multiqc_report.html) ([disable_hoverinfo](https://pmultiqc.quantms.org/PXD062399_disable_hoverinfo/multiqc_report.html)) | [PXD062399.zip](https://ftp.pride.ebi.ac.uk/pub/databases/pride/resources/proteomes/pmultiqc/example-projects/PXD062399.zip) |
257270
| mhcquant | mhcquant results | [mhcquant Example](https://pmultiqc.quantms.org/mhcquant/multiqc_report.html) ([disable_hoverinfo](https://pmultiqc.quantms.org/mhcquant_disable_hoverinfo/multiqc_report.html)) | [mhcquant_3-1-0_results.zip](https://ftp.pride.ebi.ac.uk/pub/databases/pride/resources/proteomes/pmultiqc/mhcquant/mhcquant_3-1-0_results.zip) |
271+
| QPX | QPX results | [QPX Example](https://pmultiqc.quantms.org/qpx/multiqc_report.html) ([disable_hoverinfo](https://pmultiqc.quantms.org/qpx_disable_hoverinfo/multiqc_report.html)) | [qpx_example.zip](https://ftp.pride.ebi.ac.uk/pub/databases/pride/resources/proteomes/pmultiqc/example-projects/qpx_example.zip) |
258272

259273
### 🔍 Large-Scale Dataset Reports
260274

docs/config.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,22 @@
227227
],
228228
"path": "docs/mhcquant_disable_hoverinfo",
229229
"file_type": ["mhcquant", "disable_hoverinfo"]
230+
},
231+
{
232+
"accession": "qpx",
233+
"urls": [
234+
"https://ftp.pride.ebi.ac.uk/pub/databases/pride/resources/proteomes/pmultiqc/example-projects/qpx_example.zip"
235+
],
236+
"path": "docs/qpx",
237+
"file_type": ["qpx", ""]
238+
},
239+
{
240+
"accession": "qpx_disable_hoverinfo",
241+
"urls": [
242+
"https://ftp.pride.ebi.ac.uk/pub/databases/pride/resources/proteomes/pmultiqc/example-projects/qpx_example.zip"
243+
],
244+
"path": "docs/qpx_disable_hoverinfo",
245+
"file_type": ["qpx", "disable_hoverinfo"]
230246
}
231247
]
232248
}

docs/update_examples.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,16 @@ def run_pmultiqc(download_path, report_path, plugin_type):
179179
]
180180
elif plugin_name == "diann":
181181
command = ["multiqc", "--diann-plugin", download_path, "-o", report_path]
182+
elif plugin_name == "qpx":
183+
command = [
184+
"multiqc",
185+
"--qpx-plugin",
186+
download_path,
187+
"--config",
188+
os.path.join(download_path, "results/multiqc_config.yml"),
189+
"-o",
190+
report_path
191+
]
182192
else:
183193
raise ValueError(f"Unknown plugin type: {plugin_name}")
184194

pmultiqc/cli.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,5 +82,6 @@ def print_version(ctx, params, value):
8282
mhcquant_plugin = click.option(
8383
"--mhcquant-plugin", "mhcquant_plugin", is_flag=True, help="Enable mhcquant plugin"
8484
)
85+
qpx_plugin = click.option("--qpx-plugin", "qpx_plugin", is_flag=True, help="Enable qpx plugin")
8586
disable_hoverinfo = click.option(
8687
"--disable-hoverinfo", "disable_hoverinfo", is_flag=True, help="Disable hoverinfo")

pmultiqc/main.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,4 +179,31 @@ def pmultiqc_plugin_execution_start():
179179
{"pmultiqc/fragger_params": {"fn": "*.params", "num_lines": 0}},
180180
)
181181

182+
# QPX file (https://github.com/bigbio/qpx)
183+
if "pmultiqc/qpx_psm" not in config.sp:
184+
config.update_dict(
185+
config.sp,
186+
{"pmultiqc/qpx_psm": {"fn": "*.psm.parquet", "num_lines": 0}},
187+
)
188+
if "pmultiqc/qpx_pg" not in config.sp:
189+
config.update_dict(
190+
config.sp,
191+
{"pmultiqc/qpx_pg": {"fn": "*.pg.parquet", "num_lines": 0}},
192+
)
193+
if "pmultiqc/qpx_feature" not in config.sp:
194+
config.update_dict(
195+
config.sp,
196+
{"pmultiqc/qpx_feature": {"fn": "*.feature.parquet", "num_lines": 0}},
197+
)
198+
if "pmultiqc/qpx_run" not in config.sp:
199+
config.update_dict(
200+
config.sp,
201+
{"pmultiqc/qpx_run": {"fn": "*.run.parquet", "num_lines": 0}},
202+
)
203+
if "pmultiqc/qpx_sample" not in config.sp:
204+
config.update_dict(
205+
config.sp,
206+
{"pmultiqc/qpx_sample": {"fn": "*.sample.parquet", "num_lines": 0}},
207+
)
208+
182209
config.update({"log_filesize_limit": 200 * pow(1024, 3), "thousandsSep_format": ""})

pmultiqc/modules/common/common_utils.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -897,3 +897,28 @@ def mods_statistics(df: pd.DataFrame, run_col: str):
897897
"cats": list(sorted(modified_cats, key=lambda x: (x == "Modified (Total)", x)))}
898898

899899
return modified_dict
900+
901+
902+
# if missed.cleavages is not given, it is assumed that Trypsin was used for digestion
903+
def cal_miss_cleavages(sequence, enzyme):
904+
if enzyme == "Trypsin/P":
905+
miss_cleavages = len(sequence[:-1]) - len(
906+
sequence[:-1].replace("K", "").replace("R", "").replace("P", "")
907+
)
908+
elif enzyme == "Arg-C":
909+
miss_cleavages = len(sequence[:-1]) - len(sequence[:-1].replace("R", ""))
910+
elif enzyme == "Asp-N":
911+
miss_cleavages = len(sequence[:-1]) - len(
912+
sequence[:-1].replace("B", "").replace("D", "")
913+
)
914+
elif enzyme == "Chymotrypsin":
915+
miss_cleavages = len(sequence[:-1]) - len(
916+
sequence[:-1].replace("F", "").replace("W", "").replace("Y", "").replace("L", "")
917+
)
918+
elif enzyme == "Lys-C":
919+
miss_cleavages = len(sequence[:-1]) - len(sequence[:-1].replace("K", ""))
920+
else:
921+
miss_cleavages = len(sequence[:-1]) - len(
922+
sequence[:-1].replace("K", "").replace("R", "")
923+
)
924+
return miss_cleavages

pmultiqc/modules/common/dia_utils.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def parse_diann_report(
3535
heatmap_color_list,
3636
sample_df,
3737
ms_with_psm,
38-
quantms_modified,
38+
modified,
3939
ms_paths,
4040
file_df=None,
4141
msstats_input_valid=False
@@ -64,7 +64,7 @@ def parse_diann_report(
6464

6565
# Process run-specific data (requires Modifications column from _process_modifications)
6666
if modifications_ok:
67-
cal_num_table_data = _process_run_data(report_data, ms_with_psm, quantms_modified, file_df)
67+
cal_num_table_data = _process_run_data(report_data, ms_with_psm, modified, file_df)
6868
else:
6969
log.warning("Skipping run data processing due to missing modifications data")
7070
cal_num_table_data = {"sdrf_samples": {}, "ms_runs": {}}
@@ -82,7 +82,7 @@ def parse_diann_report(
8282
peptide_search_score,
8383
ms_with_psm,
8484
cal_num_table_data,
85-
quantms_modified,
85+
modified,
8686
ms_without_psm,
8787
peptide_length
8888
)
@@ -591,6 +591,19 @@ def draw_protein_table(sub_sections, table_data, headers, report_type):
591591
* Peptides_Number: The number of peptides for each protein.
592592
* Average Intensity: Average intensity of each protein(0 or NA ignored).
593593
"""
594+
elif report_type == "qpx":
595+
description_text = """
596+
This plot shows the quantification information of proteins in the final result (quantms.io pg.parquet).
597+
"""
598+
helptext_text = """
599+
The quantification information of proteins is obtained from the `intensity` column of pg.parquet.
600+
Proteins are sorted by average intensity, and the most abundant ones are shown.
601+
602+
* Peptides_Number: The number of distinct peptide sequences for each protein.
603+
* Average Intensity: log10 of the average protein group intensity across runs (0 or NA ignored).
604+
* Global Q-value: The best (lowest) global q-value reported for the protein group.
605+
* Protein intensity in each condition: log10 average intensity within that condition.
606+
"""
594607
else:
595608
description_text = ""
596609
helptext_text = ""

pmultiqc/modules/common/plots/dia.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from multiqc.plots import heatmap, box, bargraph, linegraph
55

66
from pmultiqc.modules.common.plots.general import (
7+
summarise_box_data,
78
plot_html_check,
89
plot_data_check
910
)
@@ -120,6 +121,10 @@ def draw_dia_intensity_dis(sub_section, df, sdrf_file_df):
120121
"save_data_file": False,
121122
}
122123

124+
# Summarise to box statistics so a large report stays interactive rather than
125+
# falling back to a flat image that does not fill the panel.
126+
box_data = summarise_box_data(box_data)
127+
123128
box_html = box.plot(list_of_data_by_sample=box_data, pconfig=draw_config)
124129

125130
# box_html.flat

0 commit comments

Comments
 (0)