Skip to content

Commit

Permalink
Merge pull request #94 from WangHong007/main
Browse files Browse the repository at this point in the history
Prevent NoneType from intensity frame
  • Loading branch information
ypriverol authored Jan 20, 2024
2 parents 5f3e3e5 + 8d019ed commit 73e97eb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions pmultiqc/modules/quantms/quantms.py
Original file line number Diff line number Diff line change
Expand Up @@ -1008,6 +1008,7 @@ def CalHeatMapScore(self):
meta_data = dict(mztab_data.metadata)
if self.pep_table_exists:
pep_table = mztab_data.peptide_table
pep_table = pep_table.fillna(np.nan)
pep_table.loc[:, 'stand_spectra_ref'] = pep_table.apply(
lambda x: self.file_prefix(meta_data[x.spectra_ref.split(':')[0] + '-location']), axis=1)
study_variables = list(filter(lambda x: re.match(r'peptide_abundance_study_variable.*?', x) is not None,
Expand All @@ -1018,11 +1019,10 @@ def CalHeatMapScore(self):
group[group['accession'].str.contains(config.kwargs["contaminant_affix"])][study_variables])) / \
np.sum(np.sum(group[study_variables]))
if config.kwargs['remove_decoy']:
T = sum(group[(group['opt_global_cv_MS:1002217_decoy_peptide'] == 0)][study_variables].values. \
tolist(), [])
pep_median = np.nanmedian(group[(group['opt_global_cv_MS:1002217_decoy_peptide'] == 0)][study_variables]. \
to_numpy())
else:
T = sum(group[study_variables].values.tolist(), [])
pep_median = np.median([j for j in T if not math.isnan(j) is True])
pep_median = np.nanmedian(group[study_variables].to_numpy())
self.heatmap_pep_intensity[name] = np.minimum(1.0, pep_median / (2 ** 23)) # Threshold

# HeatMapMissedCleavages
Expand Down
4 changes: 2 additions & 2 deletions pmultiqc/modules/quantms/sparklines.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ def plot(data, headers=None, pconfig=None, maxValue=0.0):
for k, v in config.custom_plot_config[pconfig["id"]].items():
pconfig[k] = v

# Make a datatable object
dt = table_object.datatable(data, headers, pconfig)
# Make a DataTable object
dt = table_object.DataTable(data, headers, pconfig)

# Collect unique sample names
s_names = set()
Expand Down

0 comments on commit 73e97eb

Please sign in to comment.