Skip to content

Commit a3f889e

Browse files
author
Sanjay Gopala Krishna
committed
Fix issue where samples with zero peptides were not displayed in graphs; now empty sample rows are presented
1 parent 740b969 commit a3f889e

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

ProtPeptigram/runner.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,14 @@ def run_pipeline(
169169
viz = ImmunoViz(immunoviz_df)
170170

171171
# 7. Determine proteins to visualize
172-
if specific_proteins:
172+
if specific_proteins is not None:
173173
# Filter to ensure proteins exist in the data
174174
proteins_to_visualize = [p for p in specific_proteins if p in unique_proteins]
175175
if len(proteins_to_visualize) == 0:
176-
console.print("Warning: None of the specified proteins were found in the data.")
176+
console.log("[WARNINGS][Proteins]: None of the specified proteins were found in the data.", style="bold yellow")
177177
# # Fall back to top proteins if specified proteins not found
178178
# proteins_to_visualize = select_abundant_proteins(processor, top_n=top, min_peptides=1)
179-
sys.exit(0)
179+
# sys.exit(0)
180180
else:
181181
# Use top proteins by peptide count
182182
proteins_to_visualize = select_abundant_proteins(processor, top_n=top, min_peptides=1)
@@ -188,6 +188,7 @@ def run_pipeline(
188188
console.log(f"Generating PeptiGram for protein: {prot}", style="bold")
189189
fig, _ = viz.plot_peptigram(
190190
[prot],
191+
groups= unique_samples,
191192
group_by='Sample',
192193
color_by='protein',
193194
figsize=(14, 12),

ProtPeptigram/viz.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import pandas as pd
44
import matplotlib.patheffects as path_effects
55
from typing import List, Dict, Union, Tuple, Optional
6+
from ProtPeptigram.logger import CONSOLE as console
67
import os
78

89

@@ -197,7 +198,8 @@ def plot_peptigram(
197198
for g in peptide_groups['Groups']:
198199
all_groups.extend(g)
199200
groups = sorted(list(set(all_groups)))
200-
201+
console.log(f"Groups to plot: {groups}", style="bold green")
202+
201203
# groups = sorted(list({g for group_list in peptide_groups['Groups'] for g in group_list}))
202204
# print(f"Groups to plot: {groups}")
203205
# print(f"Proteins to plot: {peptide_groups}")

0 commit comments

Comments
 (0)